From 01c3903c1b9108c784f30f430e66d22451fc5550 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 8 Sep 2008 11:46:01 +0000 Subject: Qpid-1277: AMQP 0.10 support git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@693060 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/Client.csproj | 210 + .../client-010/client/Properties/AssemblyInfo.cs | 35 + qpid/dotnet/client-010/client/client.sln | 32 + qpid/dotnet/client-010/client/client.suo | Bin 0 -> 130048 bytes qpid/dotnet/client-010/client/client/Client.cs | 111 + .../client/client/ClientConnectionDelegate.cs | 76 + .../client-010/client/client/ClientInterface.cs | 60 + .../client-010/client/client/ClientSession.cs | 43 + .../client/client/ClientSessionDelegate.cs | 57 + .../client/client/ClosedListenerInterface.cs | 29 + qpid/dotnet/client-010/client/client/ErrorCode.cs | 140 + .../client/client/MessageListenerInterface.cs | 31 + qpid/dotnet/client-010/client/transport/Binary.cs | 129 + qpid/dotnet/client-010/client/transport/Binding.cs | 34 + qpid/dotnet/client-010/client/transport/Channel.cs | 175 + .../client-010/client/transport/ChannelDelegate.cs | 33 + .../client-010/client/transport/ClientDelegate.cs | 35 + .../client-010/client/transport/Connection.cs | 172 + .../client/transport/ConnectionDelegate.cs | 109 + qpid/dotnet/client-010/client/transport/Field.cs | 75 + qpid/dotnet/client-010/client/transport/Future.cs | 38 + qpid/dotnet/client-010/client/transport/Header.cs | 83 + qpid/dotnet/client-010/client/transport/Method.cs | 150 + .../client/transport/ProtocolDelegate.cs | 37 + .../client-010/client/transport/ProtocolError.cs | 86 + .../client-010/client/transport/ProtocolEvent.cs | 42 + .../client-010/client/transport/ProtocolHeader.cs | 125 + qpid/dotnet/client-010/client/transport/Range.cs | 117 + .../dotnet/client-010/client/transport/RangeSet.cs | 153 + .../client-010/client/transport/ReceivedPayload.cs | 43 + .../dotnet/client-010/client/transport/Receiver.cs | 39 + qpid/dotnet/client-010/client/transport/Result.cs | 35 + qpid/dotnet/client-010/client/transport/Sender.cs | 32 + qpid/dotnet/client-010/client/transport/Session.cs | 513 + .../client-010/client/transport/SessionDelegate.cs | 128 + qpid/dotnet/client-010/client/transport/Struct.cs | 122 + .../client/transport/codec/AbstractDecoder.cs | 392 + .../client/transport/codec/AbstractEncoder.cs | 582 + .../client-010/client/transport/codec/Decoder.cs | 65 + .../client-010/client/transport/codec/Encodable.cs | 37 + .../client-010/client/transport/codec/Encoder.cs | 62 + .../client-010/client/transport/codec/MSDecoder.cs | 82 + .../client-010/client/transport/codec/MSEncoder.cs | 141 + .../transport/exception/ConnectionException.cs | 49 + .../client/transport/exception/ExceptionArgs.cs | 41 + .../exception/ProtocolVersionException.cs | 59 + .../transport/exception/SessionClosedException.cs | 38 + .../client/transport/exception/SessionException.cs | 45 + .../transport/exception/TransportException.cs | 46 + .../client/transport/network/Assembler.cs | 282 + .../client/transport/network/Disassembler.cs | 222 + .../client-010/client/transport/network/Frame.cs | 143 + .../client/transport/network/InputHandler.cs | 273 + .../client/transport/network/NetworkDelegate.cs | 40 + .../client/transport/network/NetworkEvent.cs | 32 + .../client/transport/network/io/IoReceiver.cs | 187 + .../client/transport/network/io/IoSender.cs | 132 + .../client/transport/network/io/IoTransport.cs | 143 + .../client/transport/util/ByteEncoder.cs | 199 + .../client/transport/util/CircularBuffer.cs | 134 + .../client-010/client/transport/util/Functions.cs | 42 + .../client-010/client/transport/util/Logger.cs | 114 + .../client/transport/util/ResultFuture.cs | 59 + .../client-010/client/transport/util/Serial.cs | 94 + .../client-010/client/transport/util/UUID.cs | 88 + qpid/dotnet/client-010/demo/Demo.csproj | 84 + qpid/dotnet/client-010/demo/Form1.Designer.cs | 39 + qpid/dotnet/client-010/demo/Form1.cs | 18 + qpid/dotnet/client-010/demo/Program.cs | 99 + .../client-010/demo/Properties/AssemblyInfo.cs | 33 + .../demo/Properties/Resources.Designer.cs | 71 + .../client-010/demo/Properties/Resources.resx | 117 + .../demo/Properties/Settings.Designer.cs | 30 + .../client-010/demo/Properties/Settings.settings | 7 + qpid/dotnet/client-010/gentool/Composite.tpl | 273 + qpid/dotnet/client-010/gentool/Composite.tpl.bak | 273 + qpid/dotnet/client-010/gentool/Constant.tpl | 16 + qpid/dotnet/client-010/gentool/Enum.tpl | 38 + qpid/dotnet/client-010/gentool/Invoker.tpl | 46 + qpid/dotnet/client-010/gentool/MethodDelegate.tpl | 14 + .../client-010/gentool/MethodDelegate.tpl.bak | 14 + qpid/dotnet/client-010/gentool/Option.tpl | 21 + qpid/dotnet/client-010/gentool/StructFactory.tpl | 43 + qpid/dotnet/client-010/gentool/Type.tpl | 82 + qpid/dotnet/client-010/gentool/build.xml | 52 + qpid/dotnet/client-010/gentool/build.xml.bak | 52 + qpid/dotnet/client-010/gentool/codegen | 64 + .../client-010/gentool/dotnetgenutil$py.class | Bin 0 -> 19091 bytes qpid/dotnet/client-010/gentool/dotnetgenutil.py | 252 + .../client-010/lib/log4net/log4net-licence.txt | 201 + qpid/dotnet/client-010/lib/log4net/log4net.dll | Bin 0 -> 266240 bytes qpid/dotnet/client-010/lib/log4net/log4net.xml | 28655 +++++++++++++++++++ qpid/dotnet/client-010/lib/nunit/nunit-licence.txt | 23 + .../client-010/lib/nunit/nunit.framework.dll | Bin 0 -> 45056 bytes .../client-010/test/Properties/AssemblyInfo.cs | 35 + qpid/dotnet/client-010/test/Test.csproj | 61 + .../client-010/test/transport/util/UUIDTest.cs | 22 + 97 files changed, 37887 insertions(+) create mode 100644 qpid/dotnet/client-010/client/Client.csproj create mode 100644 qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/client/client.sln create mode 100644 qpid/dotnet/client-010/client/client.suo create mode 100644 qpid/dotnet/client-010/client/client/Client.cs create mode 100644 qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs create mode 100644 qpid/dotnet/client-010/client/client/ClientInterface.cs create mode 100644 qpid/dotnet/client-010/client/client/ClientSession.cs create mode 100644 qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs create mode 100644 qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs create mode 100644 qpid/dotnet/client-010/client/client/ErrorCode.cs create mode 100644 qpid/dotnet/client-010/client/client/MessageListenerInterface.cs create mode 100644 qpid/dotnet/client-010/client/transport/Binary.cs create mode 100644 qpid/dotnet/client-010/client/transport/Binding.cs create mode 100644 qpid/dotnet/client-010/client/transport/Channel.cs create mode 100644 qpid/dotnet/client-010/client/transport/ChannelDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/ClientDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/Connection.cs create mode 100644 qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/Field.cs create mode 100644 qpid/dotnet/client-010/client/transport/Future.cs create mode 100644 qpid/dotnet/client-010/client/transport/Header.cs create mode 100644 qpid/dotnet/client-010/client/transport/Method.cs create mode 100644 qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/ProtocolError.cs create mode 100644 qpid/dotnet/client-010/client/transport/ProtocolEvent.cs create mode 100644 qpid/dotnet/client-010/client/transport/ProtocolHeader.cs create mode 100644 qpid/dotnet/client-010/client/transport/Range.cs create mode 100644 qpid/dotnet/client-010/client/transport/RangeSet.cs create mode 100644 qpid/dotnet/client-010/client/transport/ReceivedPayload.cs create mode 100644 qpid/dotnet/client-010/client/transport/Receiver.cs create mode 100644 qpid/dotnet/client-010/client/transport/Result.cs create mode 100644 qpid/dotnet/client-010/client/transport/Sender.cs create mode 100644 qpid/dotnet/client-010/client/transport/Session.cs create mode 100644 qpid/dotnet/client-010/client/transport/SessionDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/Struct.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/Decoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/Encodable.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/Encoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/SessionException.cs create mode 100644 qpid/dotnet/client-010/client/transport/exception/TransportException.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/Assembler.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/Disassembler.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/Frame.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/InputHandler.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IoSender.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/Functions.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/Logger.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/ResultFuture.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/Serial.cs create mode 100644 qpid/dotnet/client-010/client/transport/util/UUID.cs create mode 100644 qpid/dotnet/client-010/demo/Demo.csproj create mode 100644 qpid/dotnet/client-010/demo/Form1.Designer.cs create mode 100644 qpid/dotnet/client-010/demo/Form1.cs create mode 100644 qpid/dotnet/client-010/demo/Program.cs create mode 100644 qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs create mode 100644 qpid/dotnet/client-010/demo/Properties/Resources.resx create mode 100644 qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs create mode 100644 qpid/dotnet/client-010/demo/Properties/Settings.settings create mode 100644 qpid/dotnet/client-010/gentool/Composite.tpl create mode 100644 qpid/dotnet/client-010/gentool/Composite.tpl.bak create mode 100644 qpid/dotnet/client-010/gentool/Constant.tpl create mode 100644 qpid/dotnet/client-010/gentool/Enum.tpl create mode 100644 qpid/dotnet/client-010/gentool/Invoker.tpl create mode 100644 qpid/dotnet/client-010/gentool/MethodDelegate.tpl create mode 100644 qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak create mode 100644 qpid/dotnet/client-010/gentool/Option.tpl create mode 100644 qpid/dotnet/client-010/gentool/StructFactory.tpl create mode 100644 qpid/dotnet/client-010/gentool/Type.tpl create mode 100644 qpid/dotnet/client-010/gentool/build.xml create mode 100644 qpid/dotnet/client-010/gentool/build.xml.bak create mode 100644 qpid/dotnet/client-010/gentool/codegen create mode 100644 qpid/dotnet/client-010/gentool/dotnetgenutil$py.class create mode 100644 qpid/dotnet/client-010/gentool/dotnetgenutil.py create mode 100644 qpid/dotnet/client-010/lib/log4net/log4net-licence.txt create mode 100644 qpid/dotnet/client-010/lib/log4net/log4net.dll create mode 100644 qpid/dotnet/client-010/lib/log4net/log4net.xml create mode 100644 qpid/dotnet/client-010/lib/nunit/nunit-licence.txt create mode 100644 qpid/dotnet/client-010/lib/nunit/nunit.framework.dll create mode 100644 qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/test/Test.csproj create mode 100644 qpid/dotnet/client-010/test/transport/util/UUIDTest.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj new file mode 100644 index 0000000000..0f532bea88 --- /dev/null +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -0,0 +1,210 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {B911FFD7-754F-4735-A188-218D5065BE79} + Library + Properties + client + Qpid Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e1804b779a --- /dev/null +++ b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Client")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Client")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("dac7ef42-e9c8-45a5-8050-1301b6f8160e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/client.sln b/qpid/dotnet/client-010/client/client.sln new file mode 100644 index 0000000000..5b4a732545 --- /dev/null +++ b/qpid/dotnet/client-010/client/client.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\test\Test.csproj", "{95CB4C90-7C53-44A9-B11C-96235F158ACA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" +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 + {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 + {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 + 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 new file mode 100644 index 0000000000..f32ed7f95f Binary files /dev/null and b/qpid/dotnet/client-010/client/client.suo differ diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs new file mode 100644 index 0000000000..646192c25d --- /dev/null +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -0,0 +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.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 ClientSession _session; + 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 + + 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); + 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(); + } + + + public void close() + { + Channel ch = _conn.getChannel(0); + ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); + lock (CloseOk) + { + long start = DateTime.Now.Millisecond; + long elapsed = 0; + while (!Closed && elapsed < timeout) + { + Monitor.Wait(CloseOk, (int) (timeout - elapsed)); + elapsed = DateTime.Now.Millisecond - start; + } + 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 new file mode 100644 index 0000000000..c38dccce7a --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -0,0 +1,76 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; +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; + + public ClientConnectionDelegate(Client client) + { + _client = client; + } + + public override SessionDelegate getSessionDelegate() + { + return new ClientSessionDelegate(); + } + + public override void exception(Exception t) + { + throw t; + } + + 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 new 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 new file mode 100644 index 0000000000..ed95933799 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ClientInterface.cs @@ -0,0 +1,60 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; +using client.client; + +namespace org.apache.qpid.client +{ + public interface ClientInterface + { + /// + /// Establish a connection with the broker using the given parameters + /// + /// + /// host name + /// port number + /// virtualHost the virtual host name + /// username user name + /// password password + void connect(String host, int port, String virtualHost, String username, String passwor); + + /// + /// Close this client + /// + void close(); + + /// + /// Create a session for this connection. + /// The returned session is suspended + /// (i.e. this session is not attached to an underlying channel) + /// + /// Expiry time expressed in seconds, if the value is less than + /// or equal to 0 then the session does not expire. + /// A newly created (suspended) session. + ClientSession createSession(long expiryInSeconds); + + /// + /// If the communication layer detects a serious problem with a connection, it + // informs the client's ClosedListener + /// + /// + ClosedListener ClosedListener { set; } + } +} diff --git a/qpid/dotnet/client-010/client/client/ClientSession.cs b/qpid/dotnet/client-010/client/client/ClientSession.cs new file mode 100644 index 0000000000..10f1109031 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ClientSession.cs @@ -0,0 +1,43 @@ + + +using System; +using System.Collections.Generic; +using client.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + /// Implements a Qpid Sesion. + public class ClientSession : Session + { + public static short TRANSFER_ACQUIRE_MODE_NO_ACQUIRE = 1; + public static short TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE = 0; + public static short TRANSFER_CONFIRM_MODE_REQUIRED = 0; + public static short TRANSFER_CONFIRM_MODE_NOT_REQUIRED = 1; + public static short MESSAGE_FLOW_MODE_CREDIT = 0; + public static short MESSAGE_FLOW_MODE_WINDOW = 1; + public static short MESSAGE_FLOW_UNIT_MESSAGE = 0; + public static short MESSAGE_FLOW_UNIT_BYTE = 1; + public static long MESSAGE_FLOW_MAX_BYTES = 0xFFFFFFFF; + public static short MESSAGE_REJECT_CODE_GENERIC = 0; + public static short MESSAGE_REJECT_CODE_IMMEDIATE_DELIVERY_FAILED = 1; + public static short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0; + public static short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1; + + private Dictionary _listeners = new Dictionary(); + + public ClientSession(byte[] name) : base(name) + { + } + + public void attachMessageListener(MessageListener listener, string Destination) + { + _listeners.Add(Destination, listener); + } + + public Dictionary MessageListeners + { + get { return _listeners; } + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs new file mode 100644 index 0000000000..087f2d2006 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs @@ -0,0 +1,57 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +using System; +using client.client; +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())) + { + MessageListener listener = ((ClientSession) session).MessageListeners[xfr.getDestination()]; + listener.messageTransfer(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 new file mode 100644 index 0000000000..8089c3bd90 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ClosedListenerInterface.cs @@ -0,0 +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); + } +} diff --git a/qpid/dotnet/client-010/client/client/ErrorCode.cs b/qpid/dotnet/client-010/client/client/ErrorCode.cs new file mode 100644 index 0000000000..226f078dac --- /dev/null +++ b/qpid/dotnet/client-010/client/client/ErrorCode.cs @@ -0,0 +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); + } + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs new file mode 100644 index 0000000000..ac56ff8c99 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs @@ -0,0 +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 org.apache.qpid.transport; + +namespace client.client +{ + public interface MessageListener + { + /// + /// Inform the listener of the message transfer + /// + /// The message transfer object + void messageTransfer(MessageTransfer xfr); + } +} diff --git a/qpid/dotnet/client-010/client/transport/Binary.cs b/qpid/dotnet/client-010/client/transport/Binary.cs new file mode 100644 index 0000000000..ab829dfb69 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Binary.cs @@ -0,0 +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 +{ + + + /// + /// Binary + /// + + 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 new file mode 100644 index 0000000000..25884fc772 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Binding.cs @@ -0,0 +1,34 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; + +namespace org.apache.qpid.transport +{ + /// + /// Binding + /// + internal interface Binding + { + E endpoint(Sender sender); + + Receiver receiver(E endpoint) where T : 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 new file mode 100644 index 0000000000..d7ccc6eec8 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Channel.cs @@ -0,0 +1,175 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +using org.apache.qpid.transport.network; +using org.apache.qpid.transport.util; +using SessionDelegate=org.apache.qpid.transport.SessionDelegate; + +namespace org.apache.qpid.transport +{ + /// + /// Channel + /// + public class Channel : Invoker, ProtocolDelegate + { + private static readonly Logger log = Logger.get(typeof (Channel)); + + private readonly Connection _connection; + private readonly int _channel; + private readonly MethodDelegate _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 payload) + { + if (payload.Payload.Channel == _channel) + { + payload.Payload.ProcessProtocolEvent(null, this); + } + } + + #region ProtocolDelegate + + 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 new file mode 100644 index 0000000000..5e9fad6e40 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs @@ -0,0 +1,33 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport +{ + + + /// + /// ChannelDelegate + /// + /// + + class ChannelDelegate : MethodDelegate + { + } +} \ 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 new file mode 100644 index 0000000000..fa0062ef19 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ClientDelegate.cs @@ -0,0 +1,35 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +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 new file mode 100644 index 0000000000..863f90e093 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Connection.cs @@ -0,0 +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 +{ + /// + /// Connection + /// + public class Connection + { + private static readonly Logger log = Logger.get(typeof (Connection)); + + private readonly Sender _sender; + private readonly ConnectionDelegate _connDdelegate; + private int _channelMax = 1; + private int _connectionId; + private readonly Receiver> _receiver; + + private readonly Dictionary _channels = new Dictionary(); + + public Connection(Receiver> receiver, Sender 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 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 new file mode 100644 index 0000000000..ae3fb11fdd --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -0,0 +1,109 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + /// + /// ConnectionDelegate + /// + /// Currently only implemented client specific methods + /// + public abstract class ConnectionDelegate : MethodDelegate + { + 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 plain = new List(); + plain.Add("PLAIN"); + List utf8 = new List(); + 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) + { + // todo SASL + Dictionary props = new Dictionary(); + 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 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 new file mode 100644 index 0000000000..e8c3cb3497 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Field.cs @@ -0,0 +1,75 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +using Decoder = org.apache.qpid.transport.codec.Decoder; +using Encoder = org.apache.qpid.transport.codec.Encoder; + +namespace org.apache.qpid.transport +{ + /// + /// Field + /// + public abstract class Field + { + 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 new file mode 100644 index 0000000000..f636e91914 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Future.cs @@ -0,0 +1,38 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +namespace org.apache.qpid.transport +{ + /// + /// Future + /// + public interface Future + { + T 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 new file mode 100644 index 0000000000..74b8a7fe2e --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Header.cs @@ -0,0 +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 +{ + /// + /// Header + /// + public class Header + { + private readonly Struct[] _mystructs; + + public Header(List 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 new file mode 100644 index 0000000000..0f9a84d778 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Method.cs @@ -0,0 +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 +{ + /// + /// Method + /// + public abstract class Method : Struct, ProtocolEvent + { + public 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 context, MethodDelegate mdelegate ); + + #region ProtocolEvent + + public int Channel + { + get { return channel; } + set { channel = value; } + } + + public abstract byte EncodedTrack { get; set; } + + public void ProcessProtocolEvent(C context, ProtocolDelegate 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 new file mode 100644 index 0000000000..d269b01b79 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ProtocolDelegate.cs @@ -0,0 +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 +{ + /// + /// ProtocolDelegate + /// + public interface ProtocolDelegate + { + 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 new file mode 100644 index 0000000000..933a18c78a --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ProtocolError.cs @@ -0,0 +1,86 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +using NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate; +using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent; + +namespace org.apache.qpid.transport +{ + /// + /// ProtocolError + /// + 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 context, ProtocolDelegate 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 new file mode 100644 index 0000000000..0f6529dfd3 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ProtocolEvent.cs @@ -0,0 +1,42 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport +{ + /// + /// ProtocolEvent + /// + public interface ProtocolEvent + { + int Channel + { + get; + set; + } + + byte EncodedTrack + { + set; + get; + } + + void ProcessProtocolEvent(C context, ProtocolDelegate 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 new file mode 100644 index 0000000000..39a3f5670c --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs @@ -0,0 +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 +{ + /// ProtocolHeader + /// + /// + 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 context, ProtocolDelegate 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 new file mode 100644 index 0000000000..37e0761794 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Range.cs @@ -0,0 +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 +{ + + /// + /// Range + /// + + + public sealed class Range + { + private int lower; + private int upper; + + public Range(int lower, int upper) + { + this.lower = lower; + this.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 subtract(Range range) + { + List result = new List(); + + 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 new file mode 100644 index 0000000000..d0ee1d4916 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/RangeSet.cs @@ -0,0 +1,153 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + + + /// + /// RangeSet + /// + + public sealed class RangeSet : IEnumerable + { + private readonly LinkedList ranges = new LinkedList(); + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public IEnumerator GetEnumerator() + { + return ranges.GetEnumerator(); + } + + + public int size() + { + return ranges.Count; + } + + + + public Range getFirst() + { + return ranges.First.Value; + } + + 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) + { + foreach (Range r in ranges) + { + if (range.touches(r)) + { + ranges.Remove(r); + range = range.span(r); + } + else if (Serial.lt(range.Upper, r.Lower )) + { + ranges.AddBefore(ranges.Find(r), range); + return; + } + } + ranges.AddLast(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.AddLast(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 new file mode 100644 index 0000000000..792ca4f977 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ReceivedPayload.cs @@ -0,0 +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 : 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 new file mode 100644 index 0000000000..be28d4ab6e --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Receiver.cs @@ -0,0 +1,39 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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; + +namespace org.apache.qpid.transport +{ + /// + /// a receiver will raise an event when: + /// - data is received + /// - an exception is thrown + /// - it is closed + /// + public interface Receiver where T : EventArgs + { + event EventHandler Received; + event EventHandler Exception; + event EventHandler Closed; + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/Result.cs b/qpid/dotnet/client-010/client/transport/Result.cs new file mode 100644 index 0000000000..bde1a2f98c --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Result.cs @@ -0,0 +1,35 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +namespace org.apache.qpid.transport +{ + + + /// Result + /// + /// + /// Rafael H. Schloming + /// + + public abstract class Result:Struct + { + } +} \ 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 new file mode 100644 index 0000000000..564dd83789 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Sender.cs @@ -0,0 +1,32 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport +{ + /// + /// Sender + /// + public interface Sender + { + 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 new file mode 100644 index 0000000000..54c5c2c462 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -0,0 +1,513 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 org.apache.qpid.transport; +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 +{ + /// + /// Session + /// + /// + 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 _commands = new Dictionary(); + private int _maxComplete = - 1; + private bool _needSync = false; + private bool _closed; + private readonly Dictionary> _results = new Dictionary>(); + private readonly List _exceptions = new List(); + + + public bool Closed + { + get + { + lock (this) + { + return _closed; + } + } + set + { + lock (this) + { + _closed = value; + } + } + } + + public Session(byte[] name) + { + _name = name; + } + + public byte[] getName() + { + return _name; + } + + public void setAutoSync(bool value) + { + lock (_commands) + { + _autoSync = value; + } + } + + public Dictionary 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 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); + } + + long start = DateTime.Now.Millisecond; + 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.Millisecond - start; + } + + 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 getExceptions() + { + lock (_exceptions) + { + return new List(_exceptions); + } + } + + public override Future invoke(Method m, Future future) + { + lock (_commands) + { + future.Session = this; + int command = _commandsOut; + lock (_results) + { + _results.Add(command, (Future) 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) + { + long start = DateTime.Now.Millisecond; + long elapsed = 0; + + while (! Closed && elapsed < _timeout) + { + Monitor.Wait(_commands, (int) (_timeout - elapsed)); + elapsed = DateTime.Now.Millisecond - start; + } + } + } + + 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 new file mode 100644 index 0000000000..daae528eb0 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs @@ -0,0 +1,128 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + /// + /// SessionDelegate + /// + /// + public abstract class SessionDelegate : MethodDelegate, ProtocolDelegate + { + 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 new file mode 100644 index 0000000000..718dcbc978 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/Struct.cs @@ -0,0 +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 +{ + /// + /// Struct + /// + + 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(Field f) + { + return Equals(f.Type, typeof(Boolean)); + } + + private bool packed() + { + return getPackWidth() > 0; + } + + private bool encoded(Field 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 Fields + { + get; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append(GetType()); + str.Append("("); + bool first = true; + foreach (KeyValuePair 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 new file mode 100644 index 0000000000..eeb08ce2ae --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs @@ -0,0 +1,392 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + /// + /// AbstractDecoder + /// + public abstract class AbstractDecoder : Decoder + { + private readonly Dictionary str8cache = new Dictionary(); + + 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 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 readMap() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + Dictionary result = new Dictionary(); + 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 readList() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + List result = new List(); + 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 readArray() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + byte code = get(); + QpidType t = getType(code); + long count = readUint32(); + + List result = new List(); + 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) readUint32(); + + case Code.BIN64: + case Code.UINT64: + case Code.INT64: + case Code.DATETIME: + return readUint64(); + + case Code.DOUBLE: + return (double) 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); + } + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs new file mode 100644 index 0000000000..a34bd43331 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -0,0 +1,582 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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.codec; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// + /// AbstractEncoder + /// + public abstract class AbstractEncoder : Encoder + { + private static readonly Dictionary ENCODINGS = new Dictionary(); + private readonly Dictionary str8cache = new Dictionary(); + + 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), Code.MAP); + ENCODINGS.Add(typeof (List), 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 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 == null) + { + throw new Exception + ("unable to resolve type: " + klass + ", " + value); + } + else + { + return type; + } + } + + private static Code resolve(Type klass) + { + Code type = ENCODINGS[klass]; + if (type != null) + { + return type; + } + Type sup = klass.BaseType; + if (sup != null) + { + type = resolve(sup); + + if (type != null) + { + return type; + } + } + foreach (Type iface in klass.GetInterfaces()) + { + type = resolve(iface); + if (type != null) + { + return type; + } + } + return Code.VOID; + } + + public void writeMap(Dictionary map) + { + int pos = beginSize32(); + if (map != null) + { + writeUint32(map.Count); + writeMapEntries(map); + } + endSize32(pos); + } + + protected void writeMapEntries(Dictionary map) + { + foreach (KeyValuePair 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 list) + { + int pos = beginSize32(); + if (list != null) + { + writeUint32(list.Count); + writeListEntries(list); + } + endSize32(pos); + } + + protected void writeListEntries(List list) + { + foreach (Object value in list) + { + Code type = encoding(value); + put((byte) type); + write(type, value); + } + } + + public void writeArray(List array) + { + int pos = beginSize32(); + if (array != null) + { + writeArrayEntries(array); + } + endSize32(pos); + } + + protected void writeArrayEntries(List 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: + put((byte) value); + 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((long) value); + break; + + case Code.BIN64: + case Code.UINT64: + case Code.INT64: + case Code.DATETIME: + writeUint64((long) value); + break; + + case Code.DOUBLE: + writeUint64((long) 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) value); + break; + case Code.LIST: + writeList((List) value); + break; + case Code.ARRAY: + writeList((List) 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; + } + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/Decoder.cs b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs new file mode 100644 index 0000000000..207bd60df1 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs @@ -0,0 +1,65 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; +using System.Collections.Generic; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// + /// Decoder + /// + + public interface Decoder + { + + bool hasRemaining(); + + short readUint8(); + int readUint16(); + long readUint32(); + long readUint64(); + + 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 readMap(); + List readList(); + List readArray(); + + Struct readStruct(int type); + } + +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/Encodable.cs b/qpid/dotnet/client-010/client/transport/codec/Encodable.cs new file mode 100644 index 0000000000..12ab7c52f1 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/Encodable.cs @@ -0,0 +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 +{ + + + /// + /// Encodable + /// + + 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 new file mode 100644 index 0000000000..32950ee02e --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/Encoder.cs @@ -0,0 +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 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 +{ + /// + /// Encoder + /// + + public interface Encoder + { + + void writeUint8(short b); + void writeUint16(int s); + void writeUint32(long i); + void writeUint64(long l); + + 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 map); + void writeList(List list); + void writeArray(List array); + + void writeStruct(int type, Struct s); + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs new file mode 100644 index 0000000000..a4f2a24801 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs @@ -0,0 +1,82 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; +using System.IO; +using System.Text; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + + + /// + /// MSDecoder + /// + /// + + + 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((Double) reader.ReadInt64()); + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs new file mode 100644 index 0000000000..bb78aa8680 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs @@ -0,0 +1,141 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + /// + /// MSEncoder + /// + 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((Double) l)); + } + + 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); + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs b/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs new file mode 100644 index 0000000000..d380024c39 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs @@ -0,0 +1,49 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +namespace org.apache.qpid.transport +{ + + + /// + /// ConnectionException + /// + + [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 new file mode 100644 index 0000000000..e9cc1b6cad --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs @@ -0,0 +1,41 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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 new file mode 100644 index 0000000000..2182ab9ba4 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs @@ -0,0 +1,59 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +namespace org.apache.qpid.transport +{ + + + /// ProtocolVersionException + /// + /// + + [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 new file mode 100644 index 0000000000..9f3080ac96 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/SessionClosedException.cs @@ -0,0 +1,38 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System.Collections.Generic; + +namespace org.apache.qpid.transport +{ + + + /// + /// SessionClosedException + /// + + public class SessionClosedException : SessionException + { + + public SessionClosedException(): base(new List()) + { + } + } +} \ 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 new file mode 100644 index 0000000000..b586019802 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/SessionException.cs @@ -0,0 +1,45 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; +using System.Collections.Generic; + +namespace org.apache.qpid.transport +{ + /// + /// SessionException + /// + public class SessionException : Exception + { + private readonly List _exceptions; + + public SessionException(List exceptions) + : base(exceptions.Count == 0 ? "" : exceptions.ToString()) + + { + _exceptions = exceptions; + } + + public List 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 new file mode 100644 index 0000000000..1c216d51e4 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/exception/TransportException.cs @@ -0,0 +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 +{ + + + /// + /// TransportException + /// + + + 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 new file mode 100644 index 0000000000..89bd592f96 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -0,0 +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 +{ + /// + /// Assembler + /// + public delegate void Processor(NetworkDelegate ndelegate); + + public class Assembler : NetworkDelegate, Receiver> + { + private static readonly Logger log = Logger.get(typeof (Assembler)); + private readonly Dictionary> 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> ReceivedEvent; + public event EventHandler ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver>.Closed + { + add + { + lock (m_objectLock) + { + HandlerClosed += value; + } + } + remove + { + lock (m_objectLock) + { + HandlerClosed -= value; + } + } + } + + public Assembler() + { + segments = new Dictionary>(); + incomplete = new Method[64*1024]; + } + + // Invoked when a network event is received + public void On_ReceivedEvent(object sender, ReceivedPayload 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()) + { + segment = frame.Body; + assemble(frame, segment); + } + else + { + List frames; + if (frame.isFirstFrame()) + { + frames = new List(); + setSegment(frame, frames); + } + else + { + frames = getSegment(frame); + } + + frames.Add(frame); + + if (frame.isLastFrame()) + { + clearSegment(frame); + segment = new MemoryStream(); + BinaryWriter w = new BinaryWriter(segment); + foreach (Frame f in frames) + { + w.Write(f.Body.ToArray()); + } + 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 structs = new List(); + //while (decoder.hasRemaining()) + for (int i = 0; i < 2; i++ ) + { + 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]; + byte[] b = new byte[frame.BodySize]; + MemoryStream body = new MemoryStream(); + segment.Read(b, 0, b.Length); + body.Write(b, 0, b.Length); + body.Seek(0, SeekOrigin.Begin); + command.Body = body; + 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 getSegment(Frame frame) + { + return segments[segmentKey(frame)]; + } + + private void setSegment(Frame frame, List 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 payload = new ReceivedPayload(); + 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 new file mode 100644 index 0000000000..c1e6744f2c --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs @@ -0,0 +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 +{ + /// + /// Disassembler + /// + public sealed class Disassembler : Sender, ProtocolDelegate + { + private readonly Sender _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(Sender 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 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); + } + } + + 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; + 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 new file mode 100644 index 0000000000..5b7e15b1aa --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/Frame.cs @@ -0,0 +1,143 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +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/InputHandler.cs b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs new file mode 100644 index 0000000000..244bf5a3ff --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs @@ -0,0 +1,273 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + /// + /// InputHandler + /// + public sealed class InputHandler : Receiver> + { + 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> ReceivedEvent; + public event EventHandler ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver>.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 payload) + { + MemoryStream buf = payload.Payload; + int remaining = (int)buf.Length; + try + { + while (remaining > 0) + { + if (remaining >= needed) + { + if (input != null) + { + remaining += (int) input.Length; + byte[] tmp = new byte[remaining]; + buf.Read(tmp, 0, remaining); + input.Write(tmp, 0, remaining); + 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 + { + if (input == null) + { + input = new MemoryStream(); + } + byte[] tmp = new byte[remaining]; + buf.Read(tmp, 0, remaining); + input.Write(tmp, 0, remaining); + 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 payload = new ReceivedPayload(); + 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 new file mode 100644 index 0000000000..9549f5c295 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/NetworkDelegate.cs @@ -0,0 +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 +{ + + + /// + /// NetworkDelegate + /// + + 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 new file mode 100644 index 0000000000..c682e77560 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/NetworkEvent.cs @@ -0,0 +1,32 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport.network +{ + + /// + /// NetworkEvent + /// + + public interface NetworkEvent + { + void ProcessNetworkEvent(NetworkDelegate networkDelegate); + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs new file mode 100644 index 0000000000..b4544fe072 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -0,0 +1,187 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 TransportException = org.apache.qpid.transport.TransportException; +using Logger = org.apache.qpid.transport.util.Logger; + + +namespace org.apache.qpid.transport.network.io +{ + /// + /// IoReceiver + /// + public sealed class IoReceiver : Receiver> + { + 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> ReceivedBuffer; + event EventHandler ExceptionReading; + event EventHandler ReceiverClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedBuffer += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedBuffer -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionReading += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionReading -= value; + } + } + } + + event EventHandler Receiver>.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 payload = new ReceivedPayload(); + 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 (Exception t) + { + Console.WriteLine(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/IoSender.cs b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs new file mode 100644 index 0000000000..38fda3e1e2 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -0,0 +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.Collections.Generic; +using System.IO; +using System.Net.Sockets; +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 : Sender + { + private static readonly Logger log = Logger.get(typeof (IoReceiver)); + private readonly NetworkStream bufStream; + private bool closed; + private readonly Mutex mutClosed = new Mutex(); + private readonly CircularBuffer queue; + private readonly Thread thread; + private readonly int timeout; + private MemoryStream _tobeSent = new MemoryStream(); + public IoSender(IoTransport transport, int queueSize, int timeout) + { + this.timeout = timeout; + bufStream = transport.Stream; + queue = new CircularBuffer(2); + 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) + { + mutClosed.WaitOne(); + if (closed) + { + throw new TransportException("sender is closed"); + } + mutClosed.ReleaseMutex(); + int length = (int)str.Position; + str.Seek(0, SeekOrigin.Begin); + byte[] buf = new byte[length]; + str.Read(buf, 0, length); + _tobeSent.Write(buf, 0, length); + } + + 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 new file mode 100644 index 0000000000..f2ebab67c9 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs @@ -0,0 +1,143 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +using System; +using System.IO; +using System.Net.Sockets; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.network.io +{ + /// + /// 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 + /// + public sealed class IoTransport + { + // 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 NetworkStream m_stream; + private IoSender m_sender; + private Receiver> 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> Receiver + { + get { return m_receiver; } + set { m_receiver = value; } + } + + public IoSender Sender + { + get { return m_sender; } + set { m_sender = value; } + } + + + public NetworkStream 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 new file mode 100644 index 0000000000..75526eb432 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace org.apache.qpid.transport.util +{ + public static class ByteEncoder + { + #region Endian conversion helper routines + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static Int32 GetBigEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + else + { + return value; + } + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static UInt16 GetBigEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + else + { + return value; + } + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static UInt32 GetBigEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + else + { + return value; + } + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static Double GetBigEndian(Double value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + else + { + return value; + } + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static Int32 GetLittleEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + else + { + return swapByteOrder(value); + } + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static UInt32 GetLittleEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + else + { + return swapByteOrder(value); + } + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static UInt16 GetLittleEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + else + { + return swapByteOrder(value); + } + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static Double GetLittleEndian(Double value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + else + { + return swapByteOrder(value); + } + } + + /// + /// Swaps the Byte order of an . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static Int32 swapByteOrder(Int32 value) + { + Int32 swapped = (Int32)((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// + /// Swaps the byte order of a . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static UInt16 swapByteOrder(UInt16 value) + { + return (UInt16)((0x00FF & (value >> 8)) + | (0xFF00 & (value << 8))); + } + + /// + /// Swaps the byte order of a . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static UInt32 swapByteOrder(UInt32 value) + { + UInt32 swapped = ((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// + /// Swaps the byte order of a (double precision IEEE 754) + /// + /// to swap. + /// Byte order swapped value. + 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 new file mode 100644 index 0000000000..13bdc8caf1 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -0,0 +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.Threading; + +namespace common.org.apache.qpid.transport.util +{ + internal class CircularBuffer + { + private readonly T[] buffer; + private Int32 nrp, nwp; + private readonly Int32 len; + private Int32 countValue; + private readonly Int32 add; + + + /// + /// Constructor creates N=len element + /// Circular Buffer that olds MemoryStream + /// + 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; + countValue = nwp - nrp; + if (countValue == 0) + countValue += len; + } + + 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 = nwp - nrp; + 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 new file mode 100644 index 0000000000..0ced53c335 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/Functions.cs @@ -0,0 +1,42 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; + +namespace org.apache.qpid.transport.util +{ + + /// + /// Functions + /// + + 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 new file mode 100644 index 0000000000..04473575c2 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/Logger.cs @@ -0,0 +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 +{ + + /// Logger + /// + /// + + 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/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs new file mode 100644 index 0000000000..8a38cdb356 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -0,0 +1,59 @@ +using System; +using System.Threading; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace common.org.apache.qpid.transport.util +{ + public class ResultFuture : Future where T : Struct + { + const long _timeout = 60000; + private Struct _result; + private Session _session; + private static readonly Logger log = Logger.get(typeof(ResultFuture)); + + public Struct get(long timeout) + { + lock (this) + { + long start = DateTime.Now.Millisecond; + long elapsed = 0; + while (! _session.Closed && _timeout - elapsed > 0 && _result == null) + { + log.debug("{0} waiting for result: {1}", _session, this ); + Monitor.Wait(this, (int) (timeout - elapsed)); + elapsed = DateTime.Now.Millisecond - start; + } + } + if( _session.Closed ) + { + throw new SessionException(_session.getExceptions()); + } + return _result; + } + + public T Result + { + get { return (T) get(_timeout); } + set + { + lock (this) + { + _result = value; + Monitor.PulseAll(this); + } + } + } + + public Session Session + { + set { _session = value; } + } + + public String toString() + { + return String.Format("Future({0})", _result); + } + + } +} diff --git a/qpid/dotnet/client-010/client/transport/util/Serial.cs b/qpid/dotnet/client-010/client/transport/util/Serial.cs new file mode 100644 index 0000000000..e47a6745a5 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/Serial.cs @@ -0,0 +1,94 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport.util +{ + /// + /// This class provides basic serial number comparisons as defined in + /// RFC 1982. + /// + 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 new file mode 100644 index 0000000000..788c5b99c8 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/util/UUID.cs @@ -0,0 +1,88 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; + +namespace org.apache.qpid.transport.util +{ + public class UUID + { + private long _mostSigBits; + + private long _leastSigBits; + + + 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 random = new Random(); + random.NextBytes(randomBytes); + randomBytes[6] &= 0x0f; + randomBytes[6] |= 0x40; + randomBytes[8] &= 0x3f; + randomBytes[8] |= 0x80; + return new UUID(randomBytes); + } + + public new 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); + } + } +} diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj new file mode 100644 index 0000000000..541ee246eb --- /dev/null +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -0,0 +1,84 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {E4C46FBC-7560-406D-BFEF-CA010E584DF4} + WinExe + Properties + demo + Qpid Demo + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + Form + + + Form1.cs + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/demo/Form1.Designer.cs b/qpid/dotnet/client-010/demo/Form1.Designer.cs new file mode 100644 index 0000000000..c6c633a823 --- /dev/null +++ b/qpid/dotnet/client-010/demo/Form1.Designer.cs @@ -0,0 +1,39 @@ +namespace demo +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "Form1"; + } + + #endregion + } +} + diff --git a/qpid/dotnet/client-010/demo/Form1.cs b/qpid/dotnet/client-010/demo/Form1.cs new file mode 100644 index 0000000000..68a240189e --- /dev/null +++ b/qpid/dotnet/client-010/demo/Form1.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace demo +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/demo/Program.cs b/qpid/dotnet/client-010/demo/Program.cs new file mode 100644 index 0000000000..62730eb9b0 --- /dev/null +++ b/qpid/dotnet/client-010/demo/Program.cs @@ -0,0 +1,99 @@ +using System; +using System.IO; +using System.Text; +using System.Threading; +using client.client; +using log4net.Config; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace WindowsClient +{ + class Program + { + static void Main(string[] args) + { + XmlConfigurator.Configure(new FileInfo("..\\..\\log.xml")); + // DOMConfigurator.Configure(); + + Console.WriteLine("befing"); + Client client = new Client(); + Console.WriteLine("Client created"); + client.connect("192.168.1.14", 5673, "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); + + + Object wl = new Object(); + ssn.attachMessageListener(new MyListener(ssn, wl), "myDest"); + + ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, + 0, null); + DateTime start = DateTime.Now; + + // 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 < 10000; 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)); + } + + lock(wl) + { + Monitor.Wait(wl); + } + DateTime now = DateTime.Now; + Console.WriteLine("Start time " + start + " now: " + now); + + Console.WriteLine("Done time: " + (now - start)); + lock (wl) + { + Monitor.Wait(wl, 30000); + } + client.close(); + } + } + + class MyListener : MessageListener + { + private readonly Object _wl; + private ClientSession _session; + private int _count; + + public MyListener(ClientSession session, object wl) + { + _wl = wl; + _session = session; + _count = 0; + } + + public void messageTransfer(MessageTransfer 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(); + // Console.WriteLine("Got a message: " + enc.GetString(body) + " count = " + _count); + _count++; + if (_count == 10000) + { + lock (_wl) + { + Monitor.PulseAll(_wl); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e677e91990 --- /dev/null +++ b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Demo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Demo")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("434bc34e-b59b-4800-87cf-c2d301cb5082")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..465e39cd65 --- /dev/null +++ b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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 new file mode 100644 index 0000000000..ffecec851a --- /dev/null +++ b/qpid/dotnet/client-010/demo/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ 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 new file mode 100644 index 0000000000..7dcd2aa03b --- /dev/null +++ b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.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 new file mode 100644 index 0000000000..abf36c5d3d --- /dev/null +++ b/qpid/dotnet/client-010/demo/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl b/qpid/dotnet/client-010/gentool/Composite.tpl new file mode 100644 index 0000000000..3b8bb00850 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Composite.tpl @@ -0,0 +1,273 @@ +using System; +using org.apache.qpid.transport.codec; +using System.Collections.Generic; +using org.apache.qpid.transport.util; +using org.apache.qpid.transport.network; +using System.IO; + +namespace org.apache.qpid.transport +{ + +${ +from genutil import * + +cls = klass(type)["@name"] + +segments = type["segments"] + +if type.name in ("control", "command"): + override = "override" + base = "Method" + size = 0 + pack = 2 + if segments: + payload = "true" + else: + payload = "false" + if type.name == "control" and cls == "connection": + track = "Frame.L1" + elif cls == "session" and type["@name"] in ("attach", "attached", "detach", "detached"): + track = "Frame.L2" + elif type.name == "command": + track = "Frame.L4" + else: + track = "Frame.L3" +else: + override = "" + base = "Struct" + size = type["@size"] + pack = num(type["@pack"]) + payload = "false" + track = "4" + +PACK_TYPES = { + 1: "byte", + 2: "int", + 4: "int" +} + +typecode = code(type) +} + +public sealed class $name : $base { + + public const int TYPE = $typecode; + + public override int getStructType() { + return TYPE; + } + + public override int getSizeWidth() { + return $size; + } + + public override int getPackWidth() { + return $pack; + } + + public $override bool hasPayload() { + return $payload; + } + + public $override byte EncodedTrack + { + get{ return $track; } + set { throw new NotImplementedException(); } + } + +${ +from dotnetgenutil import * +if pack > 0: + out(" private $(PACK_TYPES[pack]) packing_flags = 0;\n"); + +fields = get_fields(type) +params = get_dotnetparameters(type, fields) +options = get_options(fields) + +for f in fields: + if not f.empty: + out(" private $(f.type) _$(f.name);\n") + +if segments: + out(" private Header _header;\n") + out(" private MemoryStream _body;\n") +} + +${ +if fields: + out(" public $name() {}\n") +} + + public $name($(", ".join(params))) { +${ +for f in fields: + if f.option: continue + out(" $(f.set)($(f.name));\n") + +if segments: + out(" Header = header;\n") + out(" Body = body;\n") + +if options or base == "Method": + out(""" + for (int i=0; i < _options.Length; i++) { + switch (_options[i]) { +""") + + for f in options: + out(" case Option.$(f.option): packing_flags |= $(f.flag_mask(pack)); break;\n") + + if base == "Method": + out(""" case Option.SYNC: Sync = true; break; + case Option.BATCH: Batch = true; break; +""") + out(""" case Option.NONE: break; + default: throw new Exception("invalid option: " + _options[i]); + } + } +""") +} + } + + public $override void dispatch(C context, MethodDelegate mdelegate) { + mdelegate.$(dromedary(name))(context, this); + } + +${ +for f in fields: + if pack > 0: + out(""" + public bool $(f.has)() { + return (packing_flags & $(f.flag_mask(pack))) != 0; + } + + public $name $(f.clear)() { + packing_flags = (byte) (packing_flags & ~$(f.flag_mask(pack))); +${ +if (not f.empty and not (f.default == "null")): + out(" _$(f.name) = $(f.default);") +} + Dirty = true; + return this; + } +""") + + out(""" + public $(f.type) $(f.get)() { +${ +if f.empty: + out(" return $(f.has)();") +else: + out(" return _$(f.name);") +} + } + + public $name $(f.set)($(f.type) value) { +${ +if not f.empty: + out(" _$(f.name) = value;") +} +${ +if pack > 0: + out(" packing_flags |= $(f.flag_mask(pack));") +} + Dirty = true; + return this; + } + + public $name $(f.name)($(f.type) value) { + return $(f.set)(value); + } +""") +} + +${ +if segments: + out(""" public Header Header { + get { return _header;} + set { _header = value;} + } + + public $name header(Header header) { + Header = header; + return this; + } + + public MemoryStream Body + { + get{ return _body;} + set{ _body = value;} + } + + public $name body(MemoryStream body) + { + Body = body; + return this; + } +""") +} + + public override void write(Encoder enc) + { +${ +if pack > 0: + out(" enc.writeUint%s(packing_flags);\n" % (pack*8)); + +for f in fields: + if f.empty: + continue + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + pre = "" + post = "" + if f.type_node.name == "struct": + pre = "%s.TYPE, " % cname(f.type_node) + elif f.type_node.name == "domain": + post = "" + pre = "(short)" + out(" enc.write$(f.coder)($(pre)_$(f.name)$(post));\n") +} + } + + public override void read(Decoder dec) + { +${ +if pack > 0: + out(" packing_flags = ($(PACK_TYPES[pack])) dec.readUint%s();\n" % (pack*8)); + +for f in fields: + if f.empty: + continue + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + pre = "" + post = "" + arg = "" + if f.type_node.name == "struct": + pre = "(%s)" % cname(f.type_node) + arg = "%s.TYPE" % cname(f.type_node) + elif f.type_node.name == "domain": + pre = "%sGetter.get(" % cname(f.type_node) + post = ")" + out(" _$(f.name) = $(pre)dec.read$(f.coder)($(arg))$(post);\n") +} + } + + public override Dictionary Fields + { + get{ + Dictionary result = new Dictionary(); + +${ +for f in fields: + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + out(' result.Add("_$(f.name)", $(f.get)());\n') +} + + return result; + } + } + +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl.bak b/qpid/dotnet/client-010/gentool/Composite.tpl.bak new file mode 100644 index 0000000000..660980c448 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Composite.tpl.bak @@ -0,0 +1,273 @@ +using System; +using org.apache.qpid.transport.codec; +using System.Collections.Generic; +using org.apache.qpid.transport.util; +using org.apache.qpid.transport.network; +using System.IO; + +namespace org.apache.qpid.transport +{ + +${ +from genutil import * + +cls = klass(type)["@name"] + +segments = type["segments"] + +if type.name in ("control", "command"): + override = "override" + base = "Method" + size = 0 + pack = 2 + if segments: + payload = "true" + else: + payload = "false" + if type.name == "control" and cls == "connection": + track = "Frame.L1" + elif cls == "session" and type["@name"] in ("attach", "attached", "detach", "detached"): + track = "Frame.L2" + elif type.name == "command": + track = "Frame.L4" + else: + track = "Frame.L3" +else: + override = "" + base = "Struct" + size = type["@size"] + pack = num(type["@pack"]) + payload = "false" + track = "4" + +PACK_TYPES = { + 1: "byte", + 2: "short", + 4: "int" +} + +typecode = code(type) +} + +public sealed class $name : $base { + + public const int TYPE = $typecode; + + public override int getStructType() { + return TYPE; + } + + public override int getSizeWidth() { + return $size; + } + + public override int getPackWidth() { + return $pack; + } + + public $override bool hasPayload() { + return $payload; + } + + public $override byte EncodedTrack + { + get{ return $track; } + set { throw new NotImplementedException(); } + } + +${ +from dotnetgenutil import * +if pack > 0: + out(" private $(PACK_TYPES[pack]) packing_flags = 0;\n"); + +fields = get_fields(type) +params = get_dotnetparameters(type, fields) +options = get_options(fields) + +for f in fields: + if not f.empty: + out(" private $(f.type) _$(f.name);\n") + +if segments: + out(" private Header _header;\n") + out(" private MemoryStream _body;\n") +} + +${ +if fields: + out(" public $name() {}\n") +} + + public $name($(", ".join(params))) { +${ +for f in fields: + if f.option: continue + out(" $(f.set)($(f.name));\n") + +if segments: + out(" Header = header;\n") + out(" Body = body;\n") + +if options or base == "Method": + out(""" + for (int i=0; i < _options.Length; i++) { + switch (_options[i]) { +""") + + for f in options: + out(" case Option.$(f.option): packing_flags |= $(f.flag_mask(pack)); break;\n") + + if base == "Method": + out(""" case Option.SYNC: Sync = true; break; + case Option.BATCH: Batch = true; break; +""") + out(""" case Option.NONE: break; + default: throw new Exception("invalid option: " + _options[i]); + } + } +""") +} + } + + public $override void dispatch(C context, MethodDelegate mdelegate) { + mdelegate.$(dromedary(name))(context, this); + } + +${ +for f in fields: + if pack > 0: + out(""" + public bool $(f.has)() { + return (packing_flags & $(f.flag_mask(pack))) != 0; + } + + public $name $(f.clear)() { + packing_flags = (byte) (packing_flags & ~$(f.flag_mask(pack))); +${ +if (not f.empty and not (f.default == "null")): + out(" _$(f.name) = $(f.default);") +} + Dirty = true; + return this; + } +""") + + out(""" + public $(f.type) $(f.get)() { +${ +if f.empty: + out(" return $(f.has)();") +else: + out(" return _$(f.name);") +} + } + + public $name $(f.set)($(f.type) value) { +${ +if not f.empty: + out(" _$(f.name) = value;") +} +${ +if pack > 0: + out(" packing_flags |= $(f.flag_mask(pack));") +} + Dirty = true; + return this; + } + + public $name $(f.name)($(f.type) value) { + return $(f.set)(value); + } +""") +} + +${ +if segments: + out(""" public Header Header { + get { return _header;} + set { _header = value;} + } + + public $name header(Header header) { + Header = header; + return this; + } + + public MemoryStream Body + { + get{ return _body;} + set{ _body = value;} + } + + public $name body(MemoryStream body) + { + Body = body; + return this; + } +""") +} + + public override void write(Encoder enc) + { +${ +if pack > 0: + out(" enc.writeUint%s(packing_flags);\n" % (pack*8)); + +for f in fields: + if f.empty: + continue + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + pre = "" + post = "" + if f.type_node.name == "struct": + pre = "%s.TYPE, " % cname(f.type_node) + elif f.type_node.name == "domain": + post = "" + pre = "(short)" + out(" enc.write$(f.coder)($(pre)_$(f.name)$(post));\n") +} + } + + public override void read(Decoder dec) + { +${ +if pack > 0: + out(" packing_flags = ($(PACK_TYPES[pack])) dec.readUint%s();\n" % (pack*8)); + +for f in fields: + if f.empty: + continue + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + pre = "" + post = "" + arg = "" + if f.type_node.name == "struct": + pre = "(%s)" % cname(f.type_node) + arg = "%s.TYPE" % cname(f.type_node) + elif f.type_node.name == "domain": + pre = "%sGetter.get(" % cname(f.type_node) + post = ")" + out(" _$(f.name) = $(pre)dec.read$(f.coder)($(arg))$(post);\n") +} + } + + public override Dictionary Fields + { + get{ + Dictionary result = new Dictionary(); + +${ +for f in fields: + if pack > 0: + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + out(' result.Add("_$(f.name)", $(f.get)());\n') +} + + return result; + } + } + +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/Constant.tpl b/qpid/dotnet/client-010/gentool/Constant.tpl new file mode 100644 index 0000000000..87652b6f7d --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Constant.tpl @@ -0,0 +1,16 @@ +namespace org.apache.qpid.transport +{ + +${from genutil import *} + +public class Constant +{ +${ +constants = spec.query["amqp/constant"] + +for c in constants: + name = scream(c["@name"]) + value = c["@value"] + out(" public const int $name = $value;\n") +}} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/Enum.tpl b/qpid/dotnet/client-010/gentool/Enum.tpl new file mode 100644 index 0000000000..b3b6d93f8a --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Enum.tpl @@ -0,0 +1,38 @@ +using System; +namespace org.apache.qpid.transport +{ +${ +from genutil import * + +vtype = jtype(resolve_type(type)) + +out(" public enum $name : $vtype") + +choices = [(scream(ch["@name"]), "= %s" % (ch["@value"])) + for ch in type.query["enum/choice"]] +} + { + $(",\n ".join(["%s%s" % ch for ch in choices])) + } + +${ + +out(" public struct $name") +out("Getter") +} + { + public static $name get($vtype value) + { + switch (value) + { +${ +choices = [(scream(ch["@name"]), "%s" % (ch["@value"])) + for ch in type.query["enum/choice"]] + +for ch, value in choices: + out(' case $value: return $name.$ch;\n') +} default: throw new Exception("no such value: " + value); + } + } + } +} diff --git a/qpid/dotnet/client-010/gentool/Invoker.tpl b/qpid/dotnet/client-010/gentool/Invoker.tpl new file mode 100644 index 0000000000..f1909d2e29 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Invoker.tpl @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.IO; +using common.org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport +{ + +public abstract class Invoker { + + protected abstract void invoke(Method method); + public abstract Future invoke(Method method, Future resultClass); + +${ +from dotnetgenutil import * + +for c in composites: + name = cname(c) + fields = get_fields(c) + params = get_dotnetparameters(c, fields) + args = get_arguments(c, fields) + result = c["result"] + if result: + if not result["@type"]: + rname = cname(result["struct"]) + else: + rname = cname(result, "@type") + jresult = "Future<%s>" % rname + jreturn = "return " + jclass = ", new ResultFuture<%s>()" % rname + jinvoke = "invoke" + else: + jinvoke = "invoke" + jresult = "void" + jreturn = "" + jclass = "" + + out(""" + public $jresult $(dromedary(name))($(", ".join(params))) { + $(jreturn)$jinvoke(new $name($(", ".join(args)))$jclass); + } +""") +} + +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl new file mode 100644 index 0000000000..4c7010d5bb --- /dev/null +++ b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl @@ -0,0 +1,14 @@ +namespace org.apache.qpid.transport +{ + +public abstract class MethodDelegate { + +${ +from genutil import * + +for c in composites: + name = cname(c) + out(" public virtual void $(dromedary(name))(C context, $name mystruct) {}\n") +} +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak new file mode 100644 index 0000000000..58a578b556 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak @@ -0,0 +1,14 @@ +namespace org.apache.qpid.transport +{ + +public abstract class MethodDelegate { + +${ +from genutil import * + +for c in composites: + name = cname(c) + out(" public void $(dromedary(name))(C context, $name mystruct) {}\n") +} +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/Option.tpl b/qpid/dotnet/client-010/gentool/Option.tpl new file mode 100644 index 0000000000..ce4c0a3da1 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Option.tpl @@ -0,0 +1,21 @@ +namespace org.apache.qpid.transport +{ +public enum Option { + +${ +from genutil import * + +options = {} + +for c in composites: + for f in c.query["field"]: + t = resolve_type(f) + if t["@name"] == "bit": + option = scream(f["@name"]) + if not options.has_key(option): + options[option] = None + out(" $option,\n")} + BATCH, + NONE +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/StructFactory.tpl b/qpid/dotnet/client-010/gentool/StructFactory.tpl new file mode 100644 index 0000000000..2efa749bbf --- /dev/null +++ b/qpid/dotnet/client-010/gentool/StructFactory.tpl @@ -0,0 +1,43 @@ +using System; + +namespace org.apache.qpid.transport +{ + +class StructFactory { + + public static Struct create(int type) + { + switch (type) + { +${ +from genutil import * + +fragment = """ case $name.TYPE: + return new $name(); +""" + +for c in composites: + name = cname(c) + if c.name == "struct": + out(fragment) +} default: + throw new Exception("type: " + type); + } + } + + public static Struct createInstruction(int type) + { + switch (type) + { +${ +for c in composites: + name = cname(c) + if c.name in ("command", "control"): + out(fragment) +} default: + throw new Exception("type: " + type); + } + } + +} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/Type.tpl b/qpid/dotnet/client-010/gentool/Type.tpl new file mode 100644 index 0000000000..914f320519 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/Type.tpl @@ -0,0 +1,82 @@ +using System; + +namespace org.apache.qpid.transport +{ + +${from genutil import *} + +public struct QpidType +{ + public Code code; + public int width; + public bool isfixed; + + public Code Code + { + get { return code; } + set { code = value; } + } + + public int Width + { + get { return width; } + set { width = value; } + } + + public bool Fixed + { + get { return isfixed; } + set { isfixed = value; } + } + + QpidType(Code code, int width, bool isfixed) + { + this.code = code; + this.width = width; + this.isfixed = isfixed; + } + + public static QpidType get(byte code) + { + switch (code) + { +${ +types = spec.query["amqp/type"] + spec.query["amqp/class/type"] +codes = {} +first = True +for t in types: + code = t["@code"] + fix_width = t["@fixed-width"] + var_width = t["@variable-width"] + + if code is None: + continue + + if fix_width is None: + width = var_width + fixed = "false" + else: + width = fix_width + fixed = "true" + + name = scream(t["@name"]) + codes[code] = name + + out(" case $code : return new QpidType(Code.$name, $width, $fixed);\n") +} + default: throw new Exception("unknown code: " + code); + } + } +} + +public enum Code : byte + { +${ +keys = list(codes.keys()) +keys.sort() + +for code in keys: + out(" $(codes[code]) = $code,\n") +} + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/build.xml b/qpid/dotnet/client-010/gentool/build.xml new file mode 100644 index 0000000000..8d9622dcda --- /dev/null +++ b/qpid/dotnet/client-010/gentool/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/gentool/build.xml.bak b/qpid/dotnet/client-010/gentool/build.xml.bak new file mode 100644 index 0000000000..d0d8d9297f --- /dev/null +++ b/qpid/dotnet/client-010/gentool/build.xml.bak @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/gentool/codegen b/qpid/dotnet/client-010/gentool/codegen new file mode 100644 index 0000000000..7a1476b75e --- /dev/null +++ b/qpid/dotnet/client-010/gentool/codegen @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import os, sys, mllib +from templating import Parser +from dotnetgenutil import * + +out_dir = sys.argv[1] +spec_file = sys.argv[2] +tpl_dir = sys.argv[3] +pkg_dir = os.path.join(out_dir, "generated") + +if not os.path.exists(pkg_dir): + os.makedirs(pkg_dir) + +spec = mllib.xml_parse(spec_file) + +def excludes(nd): + if (nd.parent is not None and + nd.parent.name == "class" and + nd.parent["@name"] in ("file", "stream")): + return False + else: + return True + +def execute(output, template, **kwargs): + f = open(os.path.join(tpl_dir, template)) + input = f.read() + f.close() + p = Parser(**kwargs) + p.parse(input) + fname = os.path.join(pkg_dir, output) + f = open(fname, "w") + f.write(p.output) + f.close() + +execute("Type.cs", "Type.tpl", spec = spec) +execute("Constant.cs", "Constant.tpl", spec = spec) + +structs = spec.query["amqp/struct"] + \ + spec.query["amqp/class/struct", excludes] + \ + spec.query["amqp/class/command/result/struct", excludes] +controls = spec.query["amqp/class/control", excludes] +commands = spec.query["amqp/class/command", excludes] + +composites = structs + controls + commands + +for c in composites: + name = cname(c) + execute("%s.cs" % name, "Composite.tpl", type = c, name = name) + +execute("MethodDelegate.cs", "MethodDelegate.tpl", composites = composites) +execute("Option.cs", "Option.tpl", composites = composites) +execute("Invoker.cs", "Invoker.tpl", composites = controls + commands) +execute("StructFactory.cs", "StructFactory.tpl", composites = composites) + +def is_enum(nd): + return nd["enum"] is not None + +enums = spec.query["amqp/domain", is_enum] + \ + spec.query["amqp/class/domain", is_enum] + +for e in enums: + name = cname(e) + execute("%s.cs" % name, "Enum.tpl", name = name, type = e) \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class b/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class new file mode 100644 index 0000000000..ddb8855f7c Binary files /dev/null and b/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class differ diff --git a/qpid/dotnet/client-010/gentool/dotnetgenutil.py b/qpid/dotnet/client-010/gentool/dotnetgenutil.py new file mode 100644 index 0000000000..0bfea4a0ba --- /dev/null +++ b/qpid/dotnet/client-010/gentool/dotnetgenutil.py @@ -0,0 +1,252 @@ + +def camel(offset, *args): + parts = [] + for a in args: + parts.extend(a.split("-")) + return "".join(parts[:offset] + [p[0].upper() + p[1:] for p in parts[offset:]]) + +def dromedary(s): + return s[0].lower() + s[1:] + +def scream(*args): + return "_".join([a.replace("-", "_").upper() for a in args]) + +def num(x, default=None): + if x is not None and x != "": + return int(x, 0) + else: + return default + +def klass(nd): + parent = nd.parent + while parent is not None: + if hasattr(parent, "name") and parent.name == "class": + return parent + parent = parent.parent + +untyped = -1 + +def code(nd): + global untyped + cd = num(nd["@code"]) + if cd is None: + cd = untyped + untyped -= 1 + return cd + + cls = klass(nd) + if cls: + cd |= (num(cls["@code"]) << 8) + return cd + +def root(nd): + if nd.parent is None: + return nd + else: + return root(nd.parent) + +def qname(nd): + name = nd["@name"] + cls = klass(nd) + if cls != None: + return "%s.%s" % (cls["@name"], name) + else: + return name + +RESOLVED = {} + +def resolve(node, name): + key = (node, name) + if RESOLVED.has_key(key): + return RESOLVED[key] + else: + spec = root(node) + cls = klass(node) + if cls: + for nd in cls.query["#tag"]: + if nd["@name"] == name: + RESOLVED[key] = nd + return nd + for nd in spec.query["amqp/#tag"] + spec.query["amqp/class/#tag"]: + if name == qname(nd): + RESOLVED[key] = nd + return nd + raise Exception("unresolved name: %s" % name) + +def resolve_type(nd): + if hasattr(nd, "_resolved_type"): + return nd._resolved_type + else: + name = nd["@type"] + type = resolve(nd, name) + if type.name == "domain" and not type["enum"]: + type = resolve_type(type) + nd._resolved_type = type + return type + +TYPES = { + "bit": "bool", + "uint8": "short", + "uint16": "int", + "uint32": "long", + "uint64": "long", + "datetime": "long", + "uuid": "UUID", + "sequence-no": "int", + "sequence-set": "RangeSet", # XXX + "byte-ranges": "RangeSet", # XXX + "str8": "String", + "str16": "String", + "vbin8": "byte[]", + "vbin16": "byte[]", + "vbin32": "byte[]", + "struct32": "Struct", + "map": "Dictionary", + "array": "List" + } + +def cname(nd, field="@name"): + cls = klass(nd) + if cls: + if (nd.name in ("struct", "result") and + cls["@name"] != "session" and + nd[field] != "header"): + return camel(0, nd[field]) + else: + return camel(0, cls["@name"], nd[field]) + else: + return camel(0, nd[field]) + +def jtype(nd): + if nd.name == "struct" or nd["enum"]: + return cname(nd) + else: + return TYPES[nd["@name"]] + +REFS = { + "bool": "Boolean", + "byte": "Byte", + "short": "Short", + "int": "Integer", + "long": "Long", + "float": "Float", + "double": "Double", + "char": "Character" +} + +def jref(jt): + return REFS.get(jt, jt) + +def jclass(jt): + idx = jt.find('<') + if idx > 0: + return jt[:idx] + else: + return jt + +DEFAULTS = { + "long": 0, + "int": 0, + "short": 0, + "byte": 0, + "char": 0, + "bool": "false" + } + +class Field: + + def __init__(self, index, nd): + self.index = index + self.name = camel(1, nd["@name"]) + self.type_node = resolve_type(nd) + if self.type_node.name == "domain": + self.prim_type = resolve_type(self.type_node) + else: + self.prim_type = self.type_node + self.variable_width = num(self.prim_type["@variable-width"], 0) + self.fixed_width = num(self.prim_type["@fixed-width"], 0) + self.empty = self.variable_width == 0 and self.fixed_width == 0 and self.prim_type.name != "struct" + tname = cname(self.type_node) + if self.type_node.name == "struct": + self.read = "(%s) dec.readStruct(%s.TYPE)" % (tname, tname) + self.write = "enc.writeStruct(%s.TYPE, check(struct).%s)" % (tname, self.name) + self.coder = "Struct" + elif self.type_node.name == "domain": + self.coder = camel(0, self.prim_type["@name"]) + self.read = "%s.get(dec.read%s())" % (tname, self.coder) + self.write = "enc.write%s(check(struct).%s.getValue())" % (self.coder, self.name) + else: + self.coder = camel(0, self.type_node["@name"]) + self.read = "dec.read%s()" % self.coder + self.write = "enc.write%s(check(struct).%s)" % (self.coder, self.name) + self.type = jtype(self.type_node) + self.default = DEFAULTS.get(self.type, "null") + self.has = camel(1, "has", self.name) + self.get = camel(1, "get", self.name) + self.set = camel(1, "set", self.name) + self.clear = camel(1, "clear", self.name) + if self.type == "bool": + self.option = scream(nd["@name"]) + else: + self.option = None + + def flag_mask(self, pack): + flag = pack * 8 - 8 - (self.index/8)*8 + (self.index % 8) + return 1 << flag + + +def get_fields(nd): + fields = [] + index = 0 + for f in nd.query["field"]: + fields.append(Field(index, f)) + index += 1 + return fields + +def get_parameters(type, fields): + params = [] + options = False + for f in fields: + if f.option: + options = True + else: + params.append("%s %s" % (f.type, f.name)) + if type["segments"]: + params.append("Header header") + params.append("MemoryStream body") + if options or type.name in ("control", "command"): + params.append("Option ... _options") + return params + +def get_arguments(type, fields): + args = [] + options = False + for f in fields: + if f.option: + options = True + else: + args.append(f.name) + if type["segments"]: + args.append("header") + args.append("body") + if options or type.name in ("control", "command"): + args.append("_options") + return args + +def get_options(fields): + return [f for f in fields if f.option] + +def get_dotnetparameters(type, fields): + params = [] + options = False + for f in fields: + if f.option: + options = True + else: + params.append("%s %s" % (f.type, f.name)) + if type["segments"]: + params.append("Header header") + params.append("MemoryStream body") + if options or type.name in ("control", "command"): + params.append("params Option[] _options") + return params \ No newline at end of file diff --git a/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt b/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt new file mode 100644 index 0000000000..29f81d812f --- /dev/null +++ b/qpid/dotnet/client-010/lib/log4net/log4net-licence.txt @@ -0,0 +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. diff --git a/qpid/dotnet/client-010/lib/log4net/log4net.dll b/qpid/dotnet/client-010/lib/log4net/log4net.dll new file mode 100644 index 0000000000..995816f27b Binary files /dev/null and b/qpid/dotnet/client-010/lib/log4net/log4net.dll differ diff --git a/qpid/dotnet/client-010/lib/log4net/log4net.xml b/qpid/dotnet/client-010/lib/log4net/log4net.xml new file mode 100644 index 0000000000..f20322f340 --- /dev/null +++ b/qpid/dotnet/client-010/lib/log4net/log4net.xml @@ -0,0 +1,28655 @@ + + + + log4net + + + + + Appender that logs to a database. + + + + appends logging events to a table within a + database. The appender can be configured to specify the connection + string by setting the property. + The connection type (provider) can be specified by setting the + property. For more information on database connection strings for + your specific database see http://www.connectionstrings.com/. + + + Records are written into the database either using a prepared + statement or a stored procedure. The property + is set to (System.Data.CommandType.Text) to specify a prepared statement + or to (System.Data.CommandType.StoredProcedure) to specify a stored + procedure. + + + The prepared statement text or the name of the stored procedure + must be set in the property. + + + The prepared statement or stored procedure can take a number + of parameters. Parameters are added using the + method. This adds a single to the + ordered list of parameters. The + type may be subclassed if required to provide database specific + functionality. The specifies + the parameter name, database type, size, and how the value should + be generated using a . + + + + An example of a SQL Server table that could be logged to: + + CREATE TABLE [dbo].[Log] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [Date] [datetime] NOT NULL , + [Thread] [varchar] (255) NOT NULL , + [Level] [varchar] (20) NOT NULL , + [Logger] [varchar] (255) NOT NULL , + [Message] [varchar] (4000) NOT NULL + ) ON [PRIMARY] + + + + An example configuration to log to the above table: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Julian Biddle + Nicko Cadell + Gert Driesen + Lance Nehring + + + + Abstract base class implementation of that + buffers events in a fixed size buffer. + + + + This base class should be used by appenders that need to buffer a + number of events before logging them. For example the + buffers events and then submits the entire contents of the buffer to + the underlying database in one go. + + + Subclasses should override the + method to deliver the buffered events. + + The BufferingAppenderSkeleton maintains a fixed size cyclic + buffer of events. The size of the buffer is set using + the property. + + A is used to inspect + each event as it arrives in the appender. If the + triggers, then the current buffer is sent immediately + (see ). Otherwise the event + is stored in the buffer. For example, an evaluator can be used to + deliver the events immediately when an ERROR event arrives. + + + The buffering appender can be configured in a mode. + By default the appender is NOT lossy. When the buffer is full all + the buffered events are sent with . + If the property is set to true then the + buffer will not be sent when it is full, and new events arriving + in the appender will overwrite the oldest event in the buffer. + In lossy mode the buffer will only be sent when the + triggers. This can be useful behavior when you need to know about + ERROR events but not about events with a lower level, configure an + evaluator that will trigger when an ERROR event arrives, the whole + buffer will be sent which gives a history of events leading up to + the ERROR event. + + + Nicko Cadell + Gert Driesen + + + + Abstract base class implementation of . + + + + This class provides the code for common functionality, such + as support for threshold filtering and support for general filters. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface for your own strategies for printing log statements. + + + + Implementors should consider extending the + class which provides a default implementation of this interface. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Log the logging event in Appender specific way. + + The event to log + + + This method is called to log a message into this appender. + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + The name uniquely identifies the appender. + + + + + Interface for appenders that support bulk logging. + + + + This interface extends the interface to + support bulk logging of objects. Appenders + should only implement this interface if they can bulk log efficiently. + + + Nicko Cadell + + + + Log the array of logging events in Appender specific way. + + The events to log + + + This method is called to log an array of events into this appender. + + + + + + Interface used to delay activate a configured object. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then the method + must be called by the container after its all the configured properties have been set + and before the component can be used. + + + Nicko Cadell + + + + Activate the options that were previously set with calls to properties. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then this method must be called + after its properties have been set before the component can be used. + + + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Default constructor + + + Empty default constructor + + + + + Finalizes this appender by calling the implementation's + method. + + + + If this appender has not been closed then the Finalize method + will call . + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Closes the appender and release resources. + + + + Release any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + This method cannot be overridden by subclasses. This method + delegates the closing of the appender to the + method which must be overridden in the subclass. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The event to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the abstract method. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The array of events to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the method. + + + + + + Test if the logging event should we output by this appender + + the event to test + true if the event should be output, false if the event should be ignored + + + This method checks the logging event against the threshold level set + on this appender and also against the filters specified on this + appender. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + + + + + Adds a filter to the end of the filter chain. + + the filter to add to this appender + + + The Filters are organized in a linked list. + + + Setting this property causes the new filter to be pushed onto the + back of the filter chain. + + + + + + Clears the filter list for this appender. + + + + Clears the filter list for this appender. + + + + + + Checks if the message level is below this appender's threshold. + + to test against. + + + If there is no threshold set, then the return value is always true. + + + + true if the meets the + requirements of this appender. + + + + + Is called when the appender is closed. Derived classes should override + this method if resources need to be released. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Subclasses of should implement this method + to perform actual logging. + + The event to append. + + + A subclass must implement this method to perform + logging of the . + + This method will be called by + if all the conditions listed for that method are met. + + + To restrict the logging of events in the appender + override the method. + + + + + + Append a bulk array of logging events. + + the array of logging events + + + This base class implementation calls the + method for each element in the bulk array. + + + A sub class that can better process a bulk array of events should + override this method in addition to . + + + + + + Called before as a precondition. + + + + This method is called by + before the call to the abstract method. + + + This method can be overridden in a subclass to extend the checks + made before the event is passed to the method. + + + A subclass should ensure that they delegate this call to + this base class if it is overridden. + + + true if the call to should proceed. + + + + Renders the to a string. + + The event to render. + The event rendered as a string. + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Where possible use the alternative version of this method + . + That method streams the rendering onto an existing Writer + which can give better performance if the caller already has + a open and ready for writing. + + + + + + Renders the to a string. + + The event to render. + The TextWriter to write the formatted event to + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Use this method in preference to + where possible. If, however, the caller needs to render the event + to a string then does + provide an efficient mechanism for doing so. + + + + + + The layout of this appender. + + + See for more information. + + + + + The name of this appender. + + + See for more information. + + + + + The level threshold of this appender. + + + + There is no level threshold filtering by default. + + + See for more information. + + + + + + It is assumed and enforced that errorHandler is never null. + + + + It is assumed and enforced that errorHandler is never null. + + + See for more information. + + + + + + The first filter in the filter chain. + + + + Set to null initially. + + + See for more information. + + + + + + The last filter in the filter chain. + + + See for more information. + + + + + Flag indicating if this appender is closed. + + + See for more information. + + + + + The guard prevents an appender from repeatedly calling its own DoAppend method + + + + + StringWriter used to render events + + + + + Gets or sets the threshold of this appender. + + + The threshold of the appender. + + + + All log events with lower level than the threshold level are ignored + by the appender. + + + In configuration files this option is specified by setting the + value of the option to a level + string, such as "DEBUG", "INFO" and so on. + + + + + + Gets or sets the for this appender. + + The of the appender + + + The provides a default + implementation for the property. + + + + + + The filter chain. + + The head of the filter chain filter chain. + + + Returns the head Filter. The Filters are organized in a linked list + and so all Filters on this Appender are available through the result. + + + + + + Gets or sets the for this appender. + + The layout of the appender. + + + See for more information. + + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + + The name uniquely identifies the appender. + + + + + + Tests if this appender requires a to be set. + + + + In the rather exceptional case, where the appender + implementation admits a layout but can also work without it, + then the appender should return true. + + + This default implementation always returns true. + + + + true if the appender requires a layout object, otherwise false. + + + + + The default buffer size. + + + The default size of the cyclic buffer used to store events. + This is set to 512 by default. + + + + + Initializes a new instance of the class. + + + + Protected default constructor to allow subclassing. + + + + + + Initializes a new instance of the class. + + the events passed through this appender must be + fixed by the time that they arrive in the derived class' SendBuffer method. + + + Protected constructor to allow subclassing. + + + The should be set if the subclass + expects the events delivered to be fixed even if the + is set to zero, i.e. when no buffering occurs. + + + + + + Flush the currently buffered events + + + + Flushes any events that have been buffered. + + + If the appender is buffering in mode then the contents + of the buffer will NOT be flushed to the appender. + + + + + + Flush the currently buffered events + + set to true to flush the buffer of lossy events + + + Flushes events that have been buffered. If is + false then events will only be flushed if this buffer is non-lossy mode. + + + If the appender is buffering in mode then the contents + of the buffer will only be flushed if is true. + In this case the contents of the buffer will be tested against the + and if triggering will be output. All other buffered + events will be discarded. + + + If is true then the buffer will always + be emptied by calling this method. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Close this appender instance. + + + + Close this appender instance. If this appender is marked + as not then the remaining events in + the buffer must be sent when the appender is closed. + + + + + + This method is called by the method. + + the event to log + + + Stores the in the cyclic buffer. + + + The buffer will be sent (i.e. passed to the + method) if one of the following conditions is met: + + + + The cyclic buffer is full and this appender is + marked as not lossy (see ) + + + An is set and + it is triggered for the + specified. + + + + Before the event is stored in the buffer it is fixed + (see ) to ensure that + any data referenced by the event will be valid when the buffer + is processed. + + + + + + Sends the contents of the buffer. + + The first logging event. + The buffer containing the events that need to be send. + + + The subclass must override . + + + + + + Sends the events. + + The events that need to be send. + + + The subclass must override this method to process the buffered events. + + + + + + The size of the cyclic buffer used to hold the logging events. + + + Set to by default. + + + + + The cyclic buffer used to store the logging events. + + + + + The triggering event evaluator that causes the buffer to be sent immediately. + + + The object that is used to determine if an event causes the entire + buffer to be sent immediately. This field can be null, which + indicates that event triggering is not to be done. The evaluator + can be set using the property. If this appender + has the ( property) set to + true then an must be set. + + + + + Indicates if the appender should overwrite events in the cyclic buffer + when it becomes full, or if the buffer should be flushed when the + buffer is full. + + + If this field is set to true then an must + be set. + + + + + The triggering event evaluator filters discarded events. + + + The object that is used to determine if an event that is discarded should + really be discarded or if it should be sent to the appenders. + This field can be null, which indicates that all discarded events will + be discarded. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + The events delivered to the subclass must be fixed. + + + + + Gets or sets a value that indicates whether the appender is lossy. + + + true if the appender is lossy, otherwise false. The default is false. + + + + This appender uses a buffer to store logging events before + delivering them. A triggering event causes the whole buffer + to be send to the remote sink. If the buffer overruns before + a triggering event then logging events could be lost. Set + to false to prevent logging events + from being lost. + + If is set to true then an + must be specified. + + + + + Gets or sets the size of the cyclic buffer used to hold the + logging events. + + + The size of the cyclic buffer used to hold the logging events. + + + + The option takes a positive integer + representing the maximum number of logging events to collect in + a cyclic buffer. When the is reached, + oldest events are deleted as new events are added to the + buffer. By default the size of the cyclic buffer is 512 events. + + + If the is set to a value less than + or equal to 1 then no buffering will occur. The logging event + will be delivered synchronously (depending on the + and properties). Otherwise the event will + be buffered. + + + + + + Gets or sets the that causes the + buffer to be sent immediately. + + + The that causes the buffer to be + sent immediately. + + + + The evaluator will be called for each event that is appended to this + appender. If the evaluator triggers then the current buffer will + immediately be sent (see ). + + If is set to true then an + must be specified. + + + + + Gets or sets the value of the to use. + + + The value of the to use. + + + + The evaluator will be called for each event that is discarded from this + appender. If the evaluator triggers then the current buffer will immediately + be sent (see ). + + + + + + Gets or sets a value indicating if only part of the logging event data + should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the + event data to be fixed and serialized. This will improve performance. + + + See for more information. + + + + + + Gets or sets a the fields that will be fixed in the event + + + The event fields that will be fixed before the event is buffered + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + + Initializes a new instance of the class. + + + Public default constructor to initialize a new instance of this class. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Override the parent method to close the database + + + + Closes the database command and database connection. + + + + + + Inserts the events into the database. + + The events to insert into the database. + + + Insert all the events specified in the + array into the database. + + + + + + Adds a parameter to the command. + + The parameter to add to the command. + + + Adds a parameter to the ordered list of command parameters. + + + + + + Writes the events to the database using the transaction specified. + + The transaction that the events will be executed under. + The array of events to insert into the database. + + + The transaction argument can be null if the appender has been + configured not to use transactions. See + property for more information. + + + + + + Formats the log message into database statement text. + + The event being logged. + + This method can be overridden by subclasses to provide + more control over the format of the database statement. + + + Text that can be passed to a . + + + + + Connects to the database. + + + + + Retrieves the class type of the ADO.NET provider. + + + + Gets the Type of the ADO.NET provider to use to connect to the + database. This method resolves the type specified in the + property. + + + Subclasses can override this method to return a different type + if necessary. + + + The of the ADO.NET provider + + + + Prepares the database command and initialize the parameters. + + + + + Flag to indicate if we are using a command object + + + + Set to true when the appender is to use a prepared + statement or stored procedure to insert into the database. + + + + + + The list of objects. + + + + The list of objects. + + + + + + The security context to use for privileged calls + + + + + The that will be used + to insert logging events into a database. + + + + + The database command. + + + + + Database connection string. + + + + + String type name of the type name. + + + + + The text of the command. + + + + + The command type. + + + + + Indicates whether to use transactions when writing to the database. + + + + + Indicates whether to use transactions when writing to the database. + + + + + Gets or sets the database connection string that is used to connect to + the database. + + + The database connection string used to connect to the database. + + + + The connections string is specific to the connection type. + See for more information. + + + Connection string for MS Access via ODBC: + "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb" + + Another connection string for MS Access via ODBC: + "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" + + Connection string for MS Access via OLE DB: + "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" + + + + + Gets or sets the type name of the connection + that should be created. + + + The type name of the connection. + + + + The type name of the ADO.NET provider to use. + + + The default is to use the OLE DB provider. + + + Use the OLE DB Provider. This is the default value. + System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the MS SQL Server Provider. + System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the ODBC Provider. + Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for ODBC .NET Data Provider. + + Use the Oracle Provider. + System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for .NET Managed Provider for Oracle. + + + + + Gets or sets the command text that is used to insert logging events + into the database. + + + The command text used to insert logging events into the database. + + + + Either the text of the prepared statement or the + name of the stored procedure to execute to write into + the database. + + + The property determines if + this text is a prepared statement or a stored procedure. + + + + + + Gets or sets the command type to execute. + + + The command type to execute. + + + + This value may be either (System.Data.CommandType.Text) to specify + that the is a prepared statement to execute, + or (System.Data.CommandType.StoredProcedure) to specify that the + property is the name of a stored procedure + to execute. + + + The default value is (System.Data.CommandType.Text). + + + + + + Should transactions be used to insert logging events in the database. + + + true if transactions should be used to insert logging events in + the database, otherwise false. The default value is true. + + + + Gets or sets a value that indicates whether transactions should be used + to insert logging events in the database. + + + When set a single transaction will be used to insert the buffered events + into the database. Otherwise each event will be inserted without using + an explicit transaction. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Should this appender try to reconnect to the database on error. + + + true if the appender should try to reconnect to the database after an + error has occurred, otherwise false. The default value is false, + i.e. not to try to reconnect. + + + + The default behaviour is for the appender not to try to reconnect to the + database if an error occurs. Subsequent logging events are discarded. + + + To force the appender to attempt to reconnect to the database set this + property to true. + + + When the appender attempts to connect to the database there may be a + delay of up to the connection timeout specified in the connection string. + This delay will block the calling application's thread. + Until the connection can be reestablished this potential delay may occur multiple times. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to insert + logging events into a database. Classes deriving from + can use this property to get or set this . Use the + underlying returned from if + you require access beyond that which provides. + + + + + Parameter type used by the . + + + + This class provides the basic database parameter properties + as defined by the interface. + + This type can be subclassed to provide database specific + functionality. The two methods that are called externally are + and . + + + + + + Initializes a new instance of the class. + + + Default constructor for the AdoNetAppenderParameter class. + + + + + Prepare the specified database command object. + + The command to prepare. + + + Prepares the database command object by adding + this parameter to its collection of parameters. + + + + + + Renders the logging event and set the parameter value in the command. + + The command containing the parameter. + The event to be rendered. + + + Renders the logging event using this parameters layout + object. Sets the value of the parameter on the command object. + + + + + + The name of this parameter. + + + + + The database type for this parameter. + + + + + Flag to infer type rather than use the DbType + + + + + The precision for this parameter. + + + + + The scale for this parameter. + + + + + The size for this parameter. + + + + + The to use to render the + logging event into an object for this parameter. + + + + + Gets or sets the name of this parameter. + + + The name of this parameter. + + + + The name of this parameter. The parameter name + must match up to a named parameter to the SQL stored procedure + or prepared statement. + + + + + + Gets or sets the database type for this parameter. + + + The database type for this parameter. + + + + The database type for this parameter. This property should + be set to the database type from the + enumeration. See . + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the type from the value. + + + + + + + Gets or sets the precision for this parameter. + + + The precision for this parameter. + + + + The maximum number of digits used to represent the Value. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the precision from the value. + + + + + + + Gets or sets the scale for this parameter. + + + The scale for this parameter. + + + + The number of decimal places to which Value is resolved. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the scale from the value. + + + + + + + Gets or sets the size for this parameter. + + + The size for this parameter. + + + + The maximum size, in bytes, of the data within the column. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the size from the value. + + + + + + + Gets or sets the to use to + render the logging event into an object for this + parameter. + + + The used to render the + logging event into an object for this parameter. + + + + The that renders the value for this + parameter. + + + The can be used to adapt + any into a + for use in the property. + + + + + + Appends logging events to the terminal using ANSI color escape sequences. + + + + AnsiColorTerminalAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific level of message to be set. + + + This appender expects the terminal to understand the VT100 control set + in order to interpret the color codes. If the terminal or console does not + understand the control codes the behavior is not defined. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + When configuring the ANSI colored terminal appender, a mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + + These color values cannot be combined together to make new colors. + + + The attributes can be any combination of the following: + + Brightforeground is brighter + Dimforeground is dimmer + Underscoremessage is underlined + Blinkforeground is blinking (does not work on all terminals) + Reverseforeground and background are reversed + Hiddenoutput is hidden + Strikethroughmessage has a line through it + + While any of these attributes may be combined together not all combinations + work well together, for example setting both Bright and Dim attributes makes + no sense. + + + Patrick Wagstrom + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Ansi code to reset terminal + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Add a mapping of level to color + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colours + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + Target is the value of the console output stream. + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible display attributes + + + + The following flags can be combined together to + form the ANSI color attributes. + + + + + + + text is bright + + + + + text is dim + + + + + text is underlined + + + + + text is blinking + + + Not all terminals support this attribute + + + + + text and background colors are reversed + + + + + text is hidden + + + + + text is displayed with a strikethrough + + + + + The enum of possible foreground or background color values for + use with the color mapping method + + + + The output can be in one for the following ANSI colors. + + + + + + + color is black + + + + + color is red + + + + + color is green + + + + + color is yellow + + + + + color is blue + + + + + color is magenta + + + + + color is cyan + + + + + color is white + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + An entry in the + + + + This is an abstract base class for types that are stored in the + object. + + + Nicko Cadell + + + + Default protected constructor + + + + Default protected constructor + + + + + + Initialize any options defined on this entry + + + + Should be overridden by any classes that need to initialise based on their options + + + + + + The level that is the key for this mapping + + + The that is the key for this mapping + + + + Get or set the that is the key for this + mapping subclass. + + + + + + Initialize the options for the object + + + + Combine the and together + and append the attributes. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level + + + + + + The color attributes for the specified level + + + + Required property. + The color attributes for the specified level + + + + + + The combined , and + suitable for setting the ansi terminal color. + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a AppenderCollection instance. + + list to create a readonly wrapper arround + + An AppenderCollection wrapper that is read-only. + + + + + An empty readonly static AppenderCollection + + + + + Initializes a new instance of the AppenderCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the AppenderCollection class + that has the specified initial capacity. + + + The number of elements that the new AppenderCollection is initially capable of storing. + + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified AppenderCollection. + + The AppenderCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire AppenderCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire AppenderCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the AppenderCollection. + + The to be added to the end of the AppenderCollection. + The index at which the value has been added. + + + + Removes all elements from the AppenderCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the AppenderCollection. + + The to check for. + true if is found in the AppenderCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the AppenderCollection. + + The to locate in the AppenderCollection. + + The zero-based index of the first occurrence of + in the entire AppenderCollection, if found; otherwise, -1. + + + + + Inserts an element into the AppenderCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the AppenderCollection. + + The to remove from the AppenderCollection. + + The specified was not found in the AppenderCollection. + + + + + Removes the element at the specified index of the AppenderCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the AppenderCollection. + + An for the entire AppenderCollection. + + + + Adds the elements of another AppenderCollection to the current AppenderCollection. + + The AppenderCollection whose elements should be added to the end of the current AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a array to the current AppenderCollection. + + The array whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a collection to the current AppenderCollection. + + The collection whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Sets the capacity to the actual number of elements. + + + + + Return the collection elements as an array + + the array + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the AppenderCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the AppenderCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + + + + + Appends log events to the ASP.NET system. + + + + + Diagnostic information and tracing messages that you specify are appended to the output + of the page that is sent to the requesting browser. Optionally, you can view this information + from a separate trace viewer (Trace.axd) that displays trace information for every page in a + given application. + + + Trace statements are processed and displayed only when tracing is enabled. You can control + whether tracing is displayed to a page, to the trace viewer, or both. + + + The logging event is passed to the or + method depending on the level of the logging event. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the ASP.NET trace + + the event to log + + + Write the logging event to the ASP.NET trace + HttpContext.Current.Trace + (). + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Buffers events and then forwards them to attached appenders. + + + + The events are buffered in this appender until conditions are + met to allow the appender to deliver the events to the attached + appenders. See for the + conditions that cause the buffer to be sent. + + The forwarding appender can be used to specify different + thresholds and filters for the same appender at different locations + within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Interface for attaching appenders to objects. + + + + Interface for attaching, removing and retrieving appenders. + + + Nicko Cadell + Gert Driesen + + + + Attaches an appender. + + The appender to add. + + + Add the specified appender. The implementation may + choose to allow or deny duplicate appenders. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Returns an attached appender with the specified. + If no appender with the specified name is found null will be + returned. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Gets all attached appenders. + + + A collection of attached appenders. + + + + Gets a collection of attached appenders. + If there are no attached appenders the + implementation should return an empty + collection rather than null. + + + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Send the events. + + The events that need to be send. + + + Forwards the events to the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this buffering appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Appends logging events to the console. + + + + ColoredConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific type of message to be set. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes directly to the application's attached console + not to the System.Console.Out or System.Console.Error TextWriter. + The System.Console.Out and System.Console.Error streams can be + programmatically redirected (for example NUnit does this to capture program output). + This appender will ignore these redirections because it needs to use Win32 + API calls to colorize the output. To respect these redirections the + must be used. + + + When configuring the colored console appender, mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + combination of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + HighIntensity + + + + Rick Hobbs + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + Add a mapping of level to color - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colors + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + The console output stream writer to write to + + + + This writer is not thread safe. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible color values for use with the color mapping method + + + + The following flags can be combined together to + form the colors. + + + + + + + color is blue + + + + + color is green + + + + + color is red + + + + + color is white + + + + + color is yellow + + + + + color is purple + + + + + color is cyan + + + + + color is intensified + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + Initialize the options for the object + + + + Combine the and together. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level. + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level. + + + + + + The combined and suitable for + setting the console color. + + + + + Appends logging events to the console. + + + + ConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + Nicko Cadell + Gert Driesen + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + debug system. + + + Events are written using the + method. The event's logger name is passed as the value for the category name to the Write method. + + + Nicko Cadell + + + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + If is true then the + is called. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Writes events to the system event log. + + + + The EventID of the event log entry can be + set using the EventLogEventID property () + on the . + + + There is a limit of 32K characters for an event log message + + + When configuring the EventLogAppender a mapping can be + specified to map a logging level to an event log entry type. For example: + + + <mapping> + <level value="ERROR" /> + <eventLogEntryType value="Error" /> + </mapping> + <mapping> + <level value="DEBUG" /> + <eventLogEntryType value="Information" /> + </mapping> + + + The Level is the standard log4net logging level and eventLogEntryType can be any value + from the enum, i.e.: + + Erroran error event + Warninga warning event + Informationan informational event + + + + Aspi Havewala + Douglas de la Torre + Nicko Cadell + Gert Driesen + Thomas Voss + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class + with the specified . + + The to use with this appender. + + + Obsolete constructor. + + + + + + Add a mapping of level to - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the event log entry type for a level. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create an event log source + + + Uses different API calls under NET_2_0 + + + + + This method is called by the + method. + + the event to log + + Writes the event to the system event log using the + . + + If the event has an EventID property (see ) + set then this integer will be used as the event log event id. + + + There is a limit of 32K characters for an event log message + + + + + + Get the equivalent for a + + the Level to convert to an EventLogEntryType + The equivalent for a + + Because there are fewer applicable + values to use in logging levels than there are in the + this is a one way mapping. There is + a loss of information during the conversion. + + + + + The log name is the section in the event logs where the messages + are stored. + + + + + Name of the application to use when logging. This appears in the + application column of the event log named by . + + + + + The name of the machine which holds the event log. This is + currently only allowed to be '.' i.e. the current machine. + + + + + Mapping from level object to EventLogEntryType + + + + + The security context to use for privileged calls + + + + + The name of the log where messages will be stored. + + + The string name of the log where messages will be stored. + + + This is the name of the log as it appears in the Event Viewer + tree. The default value is to log into the Application + log, this is where most applications write their events. However + if you need a separate log for your application (or applications) + then you should set the appropriately. + This should not be used to distinguish your event log messages + from those of other applications, the + property should be used to distinguish events. This property should be + used to group together events into a single log. + + + + + + Property used to set the Application name. This appears in the + event logs when logging. + + + The string used to distinguish events from different sources. + + + Sets the event log source property. + + + + + This property is used to return the name of the computer to use + when accessing the event logs. Currently, this is the current + computer, denoted by a dot "." + + + The string name of the machine holding the event log that + will be logged into. + + + This property cannot be changed. It is currently set to '.' + i.e. the local machine. This may be changed in future. + + + + + Gets or sets the used to write to the EventLog. + + + The used to write to the EventLog. + + + + The system security context used to write to the EventLog. + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and its event log entry type. + + + + + + The for this entry + + + + Required property. + The for this entry + + + + + + Appends logging events to a file. + + + + Logging events are sent to the file specified by + the property. + + + The file can be opened in either append or overwrite mode + by specifying the property. + If the file path is relative it is taken as relative from + the application base directory. The file encoding can be + specified by setting the property. + + + The layout's and + values will be written each time the file is opened and closed + respectively. If the property is + then the file may contain multiple copies of the header and footer. + + + This appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + The supports pluggable file locking models via + the property. + The default behavior, implemented by + is to obtain an exclusive write lock on the file until this appender is closed. + The alternative model, , only holds a + write lock while the appender is writing a logging event. + + + Nicko Cadell + Gert Driesen + Rodrigo B. de Oliveira + Douglas de la Torre + Niall Daley + + + + Sends logging events to a . + + + + An Appender that writes to a . + + + This appender may be used stand alone if initialized with an appropriate + writer, however it is typically used as a base class for an appender that + can open a to write to. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class and + sets the output destination to a new initialized + with the specified . + + The layout to use with this appender. + The to output to. + + + Obsolete constructor. + + + + + + Initializes a new instance of the class and sets + the output destination to the specified . + + The layout to use with this appender + The to output to + + The must have been previously opened. + + + + Obsolete constructor. + + + + + + This method determines if there is a sense in attempting to append. + + + + This method checked if an output target has been set and if a + layout has been set. + + + false if any of the preconditions fail. + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + This method writes all the bulk logged events to the output writer + before flushing the stream. + + + + + + Close this appender instance. The underlying stream or writer is also closed. + + + Closed appenders cannot be reused. + + + + + Writes the footer and closes the underlying . + + + + Writes the footer and closes the underlying . + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Clears internal references to the underlying + and other variables. + + + + Subclasses can override this method for an alternate closing behavior. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Called to allow a subclass to lazily initialize the writer + + + + This method is called when an event is logged and the or + have not been set. This allows a subclass to + attempt to initialize the writer multiple times. + + + + + + This is the where logging events + will be written to. + + + + + Immediate flush means that the underlying + or output stream will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logging events are not actually persisted if and when the application + crashes. + + + The default value is true. + + + + + + Gets or set whether the appender will flush at the end + of each append operation. + + + + The default behavior is to flush at the end of each + append operation. + + + If this option is set to false, then the underlying + stream can defer persisting the logging event to a later + time. + + + + Avoiding the flush operation at the end of each append results in + a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + Sets the where the log output will go. + + + + The specified must be open and writable. + + + The will be closed when the appender + instance is closed. + + + Note: Logging to an unopened will fail. + + + + + + Gets or set the and the underlying + , if any, for this appender. + + + The for this appender. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Gets or sets the where logging events + will be written to. + + + The where logging events are written. + + + + This is the where logging events + will be written to. + + + + + + Default constructor + + + + Default constructor + + + + + + Construct a new appender using the layout, file and append mode. + + the layout to use with this appender + the full path to the file to write to + flag to indicate if the file should be appended to + + + Obsolete constructor. + + + + + + Construct a new appender using the layout and file specified. + The file will be appended to. + + the layout to use with this appender + the full path to the file to write to + + + Obsolete constructor. + + + + + + Activate the options on the file appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This will cause the file to be opened. + + + + + + Closes any previously opened file and calls the parent's . + + + + Resets the filename and the file stream. + + + + + + Called to initialize the file writer + + + + Will be called for each logged message until the file is + successfully opened. + + + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + Acquires the output file locks once before writing all the events to + the stream. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Closes the previously opened file. + + + + Writes the to the file and then + closes the file. + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + Calls but guarantees not to throw an exception. + Errors are passed to the . + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + If there was already an opened file, then the previous file + is closed first. + + + This method will ensure that the directory structure + for the specified exists. + + + + + + Sets the quiet writer used for file output + + the file stream that has been opened for writing + + + This implementation of creates a + over the and passes it to the + method. + + + This method can be overridden by sub classes that want to wrap the + in some way, for example to encrypt the output + data using a System.Security.Cryptography.CryptoStream. + + + + + + Sets the quiet writer being used. + + the writer over the file stream that has been opened for writing + + + This method can be overridden by sub classes that want to + wrap the in some way. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + Flag to indicate if we should append to the file + or overwrite the file. The default is to append. + + + + + The name of the log file. + + + + + The encoding to use for the file stream. + + + + + The security context to use for privileged calls + + + + + The stream to log to. Has added locking semantics + + + + + The locking model to use + + + + + Gets or sets the path to the file that logging will be written to. + + + The path to the file that logging will be written to. + + + + If the path is relative it is taken as relative from + the application base directory. + + + + + + Gets or sets a flag that indicates whether the file should be + appended to or overwritten. + + + Indicates whether the file should be appended to or overwritten. + + + + If the value is set to false then the file will be overwritten, if + it is set to true then the file will be appended to. + + The default value is true. + + + + + Gets or sets used to write to the file. + + + The used to write to the file. + + + + The default encoding set is + which is the encoding for the system's current ANSI code page. + + + + + + Gets or sets the used to write to the file. + + + The used to write to the file. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Gets or sets the used to handle locking of the file. + + + The used to lock the file. + + + + Gets or sets the used to handle locking of the file. + + + There are two built in locking models, and . + The former locks the file from the start of logging to the end and the + later lock only for the minimal amount of time when logging each message. + + + The default locking model is the . + + + + + + Write only that uses the + to manage access to an underlying resource. + + + + + True asynchronous writes are not supported, the implementation forces a synchronous write. + + + + + Exception base type for log4net. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class with + the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Locking model base class + + + + Base class for the locking models available to the derived loggers. + + + + + + Open the output file + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + Gets or sets the for this LockingModel + + + The for this LockingModel + + + + The file appender this locking model is attached to and working on + behalf of. + + + The file appender is used to locate the security context and the error handler to use. + + + The value of this property will be set before is + called. + + + + + + Hold an exclusive lock on the output file + + + + Open the file once for writing and hold it open until is called. + Maintains an exclusive lock on the file during this time. + + + + + + Open the file specified and prepare for logging. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Does nothing. The lock is already taken + + + + + + Release the lock on the file + + + + Does nothing. The lock will be released when the file is closed. + + + + + + Acquires the file lock for each write + + + + Opens the file once for each / cycle, + thus holding the lock for the minimal amount of time. This method of locking + is considerably slower than but allows + other processes to move/delete the log file whilst logging continues. + + + + + + Prepares to open the file when the first message is logged. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + This appender forwards logging events to attached appenders. + + + + The forwarding appender can be used to specify different thresholds + and filters for the same appender at different locations within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Forward the logging event to the attached appenders + + The event to log. + + + Delivers the logging event to all the attached appenders. + + + + + + Forward the logging events to the attached appenders + + The array of events to log. + + + Delivers the logging events to all the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Logs events to a local syslog service. + + + + This appender uses the POSIX libc library functions openlog, syslog, and closelog. + If these functions are not available on the local system then this appender will not work! + + + The functions openlog, syslog, and closelog are specified in SUSv2 and + POSIX 1003.1-2001 standards. These are used to log messages to the local syslog service. + + + This appender talks to a local syslog service. If you need to log to a remote syslog + daemon and you cannot configure your local syslog service to do this you may be + able to use the to log via UDP. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a local syslog service. + + + + + Add a mapping of level to severity + + The mapping to add + + + Adds a to this appender. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Close the syslog when the appender is closed + + + + Close the syslog when the appender is closed + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + + The facility. The default facility is . + + + + + The message identity + + + + + Marshaled handle to the identity string. We have to hold on to the + string as the openlog and syslog APIs just hold the + pointer to the ident and dereference it for each log message. + + + + + Mapping from level object to syslog severity + + + + + Open connection to system logger. + + + + + Generate a log message. + + + + The libc syslog method takes a format string and a variable argument list similar + to the classic printf function. As this type of vararg list is not supported + by C# we need to specify the arguments explicitly. Here we have specified the + format string with a single message argument. The caller must set the format + string to "%s". + + + + + + Close descriptor used to write to system logger. + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + syslog severities + + + + The log4net Level maps to a syslog severity using the + method and the + class. The severity is set on . + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facility defines which subsystem the logging comes from. + This is set on the property. + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Stores logging events in an array. + + + + The memory appender stores all the logging events + that are appended in an in-memory array. + + + Use the method to get + the current list of events that have been appended. + + + Use the method to clear the + current list of events. + + + Julian Biddle + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Gets the events that have been logged. + + The events that have been logged + + + Gets the events that have been logged. + + + + + + This method is called by the method. + + the event to log + + Stores the in the events list. + + + + + Clear the list of events + + + Clear the list of events + + + + + The list of events that have been appended. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + Gets or sets a value indicating whether only part of the logging event + data should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the event + data to be fixed and stored in the appender, hereby improving performance. + + + See for more information. + + + + + + Gets or sets the fields that will be fixed in the event + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + Logs entries by sending network messages using the + native function. + + + + You can send messages only to names that are active + on the network. If you send the message to a user name, + that user must be logged on and running the Messenger + service to receive the message. + + + The receiver will get a top most window displaying the + messages one at a time, therefore this appender should + not be used to deliver a high volume of messages. + + + The following table lists some possible uses for this appender : + + + + + Action + Property Value(s) + + + Send a message to a user account on the local machine + + + = <name of the local machine> + + + = <user name> + + + + + Send a message to a user account on a remote machine + + + = <name of the remote machine> + + + = <user name> + + + + + Send a message to a domain user account + + + = <name of a domain controller | uninitialized> + + + = <user name> + + + + + Send a message to all the names in a workgroup or domain + + + = <workgroup name | domain name>* + + + + + Send a message from the local machine to a remote machine + + + = <name of the local machine | uninitialized> + + + = <name of the remote machine> + + + + + + + Note : security restrictions apply for sending + network messages, see + for more information. + + + + + An example configuration section to log information + using this appender from the local machine, named + LOCAL_PC, to machine OPERATOR_PC : + + + + + + + + + + Nicko Cadell + Gert Driesen + + + + The DNS or NetBIOS name of the server on which the function is to execute. + + + + + The sender of the network message. + + + + + The message alias to which the message should be sent. + + + + + The security context to use for privileged calls + + + + + Initializes the appender. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified. + + + The required property was not specified. + + + + This method is called by the method. + + The event to log. + + + Sends the event using a network message. + + + + + + Sends a buffer of information to a registered message alias. + + The DNS or NetBIOS name of the server on which the function is to execute. + The message alias to which the message buffer should be sent + The originator of the message. + The message text. + The length, in bytes, of the message text. + + + The following restrictions apply for sending network messages: + + + + + Platform + Requirements + + + Windows NT + + + No special group membership is required to send a network message. + + + Admin, Accounts, Print, or Server Operator group membership is required to + successfully send a network message on a remote server. + + + + + Windows 2000 or later + + + If you send a message on a domain controller that is running Active Directory, + access is allowed or denied based on the access control list (ACL) for the securable + object. The default ACL permits only Domain Admins and Account Operators to send a network message. + + + On a member server or workstation, only Administrators and Server Operators can send a network message. + + + + + + + For more information see Security Requirements for the Network Management Functions. + + + + + If the function succeeds, the return value is zero. + + + + + + Gets or sets the sender of the message. + + + The sender of the message. + + + If this property is not specified, the message is sent from the local computer. + + + + + Gets or sets the message alias to which the message should be sent. + + + The recipient of the message. + + + This property should always be specified in order to send a message. + + + + + Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute. + + + DNS or NetBIOS name of the remote server on which the function is to execute. + + + + For Windows NT 4.0 and earlier, the string should begin with \\. + + + If this property is not specified, the local computer is used. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the OutputDebugString system. + + + + OutputDebugStringAppender appends log events to the + OutputDebugString system. + + + The string is passed to the native OutputDebugString + function. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the output debug string API + + the event to log + + + Write the logging event to the output debug string API + + + + + + Stub for OutputDebugString native method + + the string to output + + + Stub for OutputDebugString native method + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Logs events to a remote syslog daemon. + + + + The BSD syslog protocol is used to remotely log to + a syslog daemon. The syslogd listens for for messages + on UDP port 514. + + + The syslog UDP protocol is not authenticated. Most syslog daemons + do not accept remote log messages because of the security implications. + You may be able to use the LocalSyslogAppender to talk to a local + syslog service. + + + There is an RFC 3164 that claims to document the BSD Syslog Protocol. + This RFC can be seen here: http://www.faqs.org/rfcs/rfc3164.html. + This appender generates what the RFC calls an "Original Device Message", + i.e. does not include the TIMESTAMP or HOSTNAME fields. By observation + this format of message will be accepted by all current syslog daemon + implementations. The daemon will attach the current time and the source + hostname or IP address to any messages received. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Sends logging events as connectionless UDP datagrams to a remote host or a + multicast group using an . + + + + UDP guarantees neither that messages arrive, nor that they arrive in the correct order. + + + To view the logging results, a custom application can be developed that listens for logging + events. + + + When decoding events send via this appender remember to use the same encoding + to decode the events as was used to send the events. See the + property to specify the encoding to use. + + + + This example shows how to log receive logging events that are sent + on IP address 244.0.0.1 and port 8080 to the console. The event is + encoded in the packet as a unicode string and it is decoded as such. + + IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); + UdpClient udpClient; + byte[] buffer; + string loggingEvent; + + try + { + udpClient = new UdpClient(8080); + + while(true) + { + buffer = udpClient.Receive(ref remoteEndPoint); + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer); + Console.WriteLine(loggingEvent); + } + } + catch(Exception e) + { + Console.WriteLine(e.ToString()); + } + + + Dim remoteEndPoint as IPEndPoint + Dim udpClient as UdpClient + Dim buffer as Byte() + Dim loggingEvent as String + + Try + remoteEndPoint = new IPEndPoint(IPAddress.Any, 0) + udpClient = new UdpClient(8080) + + While True + buffer = udpClient.Receive(ByRef remoteEndPoint) + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer) + Console.WriteLine(loggingEvent) + Wend + Catch e As Exception + Console.WriteLine(e.ToString()) + End Try + + + An example configuration section to log information using this appender to the + IP 224.0.0.1 on port 8080: + + + + + + + + + + Gert Driesen + Nicko Cadell + + + + Initializes a new instance of the class. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified or + an invalid remote or local TCP port number was specified. + + + The required property was not specified. + The TCP port number assigned to or is less than or greater than . + + + + This method is called by the method. + + The event to log. + + + Sends the event using an UDP datagram. + + + Exceptions are passed to the . + + + + + + Closes the UDP connection and releases all resources associated with + this instance. + + + + Disables the underlying and releases all managed + and unmanaged resources associated with the . + + + + + + Initializes the underlying connection. + + + + The underlying is initialized and binds to the + port number from which you intend to communicate. + + + Exceptions are passed to the . + + + + + + The IP address of the remote host or multicast group to which + the logging event will be sent. + + + + + The TCP port number of the remote host or multicast group to + which the logging event will be sent. + + + + + The cached remote endpoint to which the logging events will be sent. + + + + + The TCP port number from which the will communicate. + + + + + The instance that will be used for sending the + logging events. + + + + + The encoding to use for the packet. + + + + + Gets or sets the IP address of the remote host or multicast group to which + the underlying should sent the logging event. + + + The IP address of the remote host or multicast group to which the logging event + will be sent. + + + + Multicast addresses are identified by IP class D addresses (in the range 224.0.0.0 to + 239.255.255.255). Multicast packets can pass across different networks through routers, so + it is possible to use multicasts in an Internet scenario as long as your network provider + supports multicasting. + + + Hosts that want to receive particular multicast messages must register their interest by joining + the multicast group. Multicast messages are not sent to networks where no host has joined + the multicast group. Class D IP addresses are used for multicast groups, to differentiate + them from normal host addresses, allowing nodes to easily detect if a message is of interest. + + + Static multicast addresses that are needed globally are assigned by IANA. A few examples are listed in the table below: + + + + + IP Address + Description + + + 224.0.0.1 + + + Sends a message to all system on the subnet. + + + + + 224.0.0.2 + + + Sends a message to all routers on the subnet. + + + + + 224.0.0.12 + + + The DHCP server answers messages on the IP address 224.0.0.12, but only on a subnet. + + + + + + + A complete list of actually reserved multicast addresses and their owners in the ranges + defined by RFC 3171 can be found at the IANA web site. + + + The address range 239.0.0.0 to 239.255.255.255 is reserved for administrative scope-relative + addresses. These addresses can be reused with other local groups. Routers are typically + configured with filters to prevent multicast traffic in this range from flowing outside + of the local network. + + + + + + Gets or sets the TCP port number of the remote host or multicast group to which + the underlying should sent the logging event. + + + An integer value in the range to + indicating the TCP port number of the remote host or multicast group to which the logging event + will be sent. + + + The underlying will send messages to this TCP port number + on the remote host or multicast group. + + The value specified is less than or greater than . + + + + Gets or sets the TCP port number from which the underlying will communicate. + + + An integer value in the range to + indicating the TCP port number from which the underlying will communicate. + + + + The underlying will bind to this port for sending messages. + + + Setting the value to 0 (the default) will cause the udp client not to bind to + a local port. + + + The value specified is less than or greater than . + + + + Gets or sets used to write the packets. + + + The used to write the packets. + + + + The used to write the packets. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to send logging events + over a network. Classes deriving from can use this + property to get or set this . Use the underlying + returned from if you require access beyond that which + provides. + + + + + Gets or sets the cached remote endpoint to which the logging events should be sent. + + + The cached remote endpoint to which the logging events will be sent. + + + The method will initialize the remote endpoint + with the values of the and + properties. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Syslog port 514 + + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a remote syslog daemon. + + + + + Add a mapping of level to severity + + The mapping to add + + + Add a mapping to this appender. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to syslog severity mappings set on this appender. + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + Generate a syslog priority. + + + + + + The facility. The default facility is . + + + + + The message identity + + + + + Mapping from level object to syslog severity + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + syslog severities + + + + The syslog severities. + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facilities + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Delivers logging events to a remote logging sink. + + + + This Appender is designed to deliver events to a remote sink. + That is any object that implements the + interface. It delivers the events using .NET remoting. The + object to deliver events to is specified by setting the + appenders property. + + The RemotingAppender buffers events before sending them. This allows it to + make more efficient use of the remoting infrastructure. + + Once the buffer is full the events are still not sent immediately. + They are scheduled to be sent using a pool thread. The effect is that + the send occurs asynchronously. This is very important for a + number of non obvious reasons. The remoting infrastructure will + flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + Because the events are sent asynchronously using pool threads it is possible to close + this appender before all the queued events have been sent. + When closing the appender attempts to wait until all the queued events have been sent, but + this will timeout after 30 seconds regardless. + + If this appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. If the runtime terminates the threads before + the queued events have been sent then they will be lost. To ensure that all events + are sent the appender must be closed before the application exits. See + for details on how to shutdown + log4net programmatically. + + + Nicko Cadell + Gert Driesen + Daniel Cazzulino + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Send the contents of the buffer to the remote sink. + + + The events are not sent immediately. They are scheduled to be sent + using a pool thread. The effect is that the send occurs asynchronously. + This is very important for a number of non obvious reasons. The remoting + infrastructure will flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + The events to send. + + + + Override base class close. + + + + This method waits while there are queued work items. The events are + sent asynchronously using work items. These items + will be sent once a thread pool thread is available to send them, therefore + it is possible to close the appender before all the queued events have been + sent. + + This method attempts to wait until all the queued events have been sent, but this + method will timeout after 30 seconds regardless. + + If the appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. + + + + + A work item is being queued into the thread pool + + + + + A work item from the thread pool has completed + + + + + Send the contents of the buffer to the remote sink. + + + This method is designed to be used with the . + This method expects to be passed an array of + objects in the state param. + + the logging events to send + + + + The URL of the remote sink. + + + + + The local proxy (.NET remoting) for the remote logging sink. + + + + + The number of queued callbacks currently waiting or executing + + + + + Event used to signal when there are no queued work items + + + This event is set when there are no queued work items. In this + state it is safe to close the appender. + + + + + Gets or sets the URL of the well-known object that will accept + the logging events. + + + The well-known URL of the remote sink. + + + + The URL of the remoting sink that will accept logging events. + The sink must implement the + interface. + + + + + + Interface used to deliver objects to a remote sink. + + + This interface must be implemented by a remoting sink + if the is to be used + to deliver logging events to the sink. + + + + + Delivers logging events to the remote sink + + Array of events to log. + + + Delivers logging events to the remote sink + + + + + + Appender that rolls log files based on size or date or both. + + + + RollingFileAppender can roll log files based on size or date or both + depending on the setting of the property. + When set to the log file will be rolled + once its size exceeds the . + When set to the log file will be rolled + once the date boundary specified in the property + is crossed. + When set to the log file will be + rolled once the date boundary specified in the property + is crossed, but within a date boundary the file will also be rolled + once its size exceeds the . + When set to the log file will be rolled when + the appender is configured. This effectively means that the log file can be + rolled once per program execution. + + + A of few additional optional features have been added: + + Attach date pattern for current log file + Backup number increments for newer files + Infinite number of backups by file size + + + + + + For large or infinite numbers of backup files a + greater than zero is highly recommended, otherwise all the backup files need + to be renamed each time a new backup is created. + + + When Date/Time based rolling is used setting + to will reduce the number of file renamings to few or none. + + + + + + Changing or without clearing + the log file directory of backup files will cause unexpected and unwanted side effects. + + + + + If Date/Time based rolling is enabled this appender will attempt to roll existing files + in the directory without a Date/Time tag based on the last write date of the base log file. + The appender only rolls the log file when a message is logged. If Date/Time based rolling + is enabled then the appender will not roll the log file at the Date/Time boundary but + at the point when the next message is logged after the boundary has been crossed. + + + + The extends the and + has the same behavior when opening the log file. + The appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + When rolling a backup file necessitates deleting an older backup file the + file to be deleted is moved to a temporary name before being deleted. + + + + + A maximum number of backup files when rolling on date/time boundaries is not supported. + + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + Edward Smit + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Sets the quiet writer being used. + + + This method can be overridden by sub classes. + + the writer to set + + + + Write out a logging event. + + the event to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Write out an array of logging events. + + the events to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Performs any required rolling before outputting the next event + + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Creates and opens the file for logging. If + is false then the fully qualified name is determined and used. + + the name of the file to open + true to append to existing file + + This method will ensure that the directory structure + for the specified exists. + + + + + Get the current output file name + + the base file name + the output file name + + The output file name is based on the base fileName specified. + If is set then the output + file name is the same as the base file passed in. Otherwise + the output file depends on the date pattern, on the count + direction or both. + + + + + Determines curSizeRollBackups (only within the current roll point) + + + + + Generates a wildcard pattern that can be used to find all files + that are similar to the base file name. + + + + + + + Builds a list of filenames for all files matching the base filename plus a file + pattern. + + + + + + + Initiates a roll over if needed for crossing a date boundary since the last run. + + + + + Initializes based on existing conditions at time of . + + + + Initializes based on existing conditions at time of . + The following is done + + determine curSizeRollBackups (only within the current roll point) + initiates a roll over if needed for crossing a date boundary since the last run. + + + + + + + Does the work of bumping the 'current' file counter higher + to the highest count when an incremental file name is seen. + The highest count is either the first file (when count direction + is greater than 0) or the last file (when count direction less than 0). + In either case, we want to know the highest count that is present. + + + + + + + Takes a list of files and a base file name, and looks for + 'incremented' versions of the base file. Bumps the max + count up to the highest count seen. + + + + + + + Calculates the RollPoint for the datePattern supplied. + + the date pattern to calculate the check period for + The RollPoint that is most accurate for the date pattern supplied + + Essentially the date pattern is examined to determine what the + most suitable roll point is. The roll point chosen is the roll point + with the smallest period that can be detected using the date pattern + supplied. i.e. if the date pattern only outputs the year, month, day + and hour then the smallest roll point that can be detected would be + and hourly roll point as minutes could not be detected. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Sets initial conditions including date/time roll over information, first check, + scheduledFilename, and calls to initialize + the current number of backups. + + + + + + Rollover the file(s) to date/time tagged file(s). + + set to true if the file to be rolled is currently open + + + Rollover the file(s) to date/time tagged file(s). + Resets curSizeRollBackups. + If fileIsOpen is set then the new file is opened (through SafeOpenFile). + + + + + + Renames file to file . + + Name of existing file to roll. + New name for file. + + + Renames file to file . It + also checks for existence of target file and deletes if it does. + + + + + + Test if a file exists at a specified path + + the path to the file + true if the file exists + + + Test if a file exists at a specified path + + + + + + Deletes the specified file if it exists. + + The file to delete. + + + Delete a file if is exists. + The file is first moved to a new filename then deleted. + This allows the file to be removed even when it cannot + be deleted, but it still can be moved. + + + + + + Implements file roll base on file size. + + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. Moreover, File is + renamed File.1 and closed. + + + A new file is created to receive further log output. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + + + + Implements file roll. + + the base name to rename + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + This is called by to rename the files. + + + + + + Get the start time of the next window for the current rollpoint + + the current date + the type of roll point we are working with + the start time for the next roll point an interval after the currentDateTime date + + + Returns the date of the next roll point after the currentDateTime date passed to the method. + + + The basic strategy is to subtract the time parts that are less significant + than the rollpoint from the current time. This should roll the time back to + the start of the time window for the current rollpoint. Then we add 1 window + worth of time and get the start time of the next window for the rollpoint. + + + + + + This object supplies the current date/time. Allows test code to plug in + a method to control this class when testing date/time based rolling. + + + + + The date pattern. By default, the pattern is set to ".yyyy-MM-dd" + meaning daily rollover. + + + + + The actual formatted filename that is currently being written to + or will be the file transferred to on roll over + (based on staticLogFileName). + + + + + The timestamp when we shall next recompute the filename. + + + + + Holds date of last roll over + + + + + The type of rolling done + + + + + The default maximum file size is 10MB + + + + + There is zero backup files by default + + + + + How many sized based backups have been made so far + + + + + The rolling file count direction. + + + + + The rolling mode used in this appender. + + + + + Cache flag set if we are rolling by date. + + + + + Cache flag set if we are rolling by size. + + + + + Value indicating whether to always log to the same file. + + + + + FileName provided in configuration. Used for rolling properly + + + + + The 1st of January 1970 in UTC + + + + + Gets or sets the date pattern to be used for generating file names + when rolling over on date. + + + The date pattern to be used for generating file names when rolling + over on date. + + + + Takes a string in the same format as expected by + . + + + This property determines the rollover schedule when rolling over + on date. + + + + + + Gets or sets the maximum number of backup files that are kept before + the oldest is erased. + + + The maximum number of backup files that are kept before the oldest is + erased. + + + + If set to zero, then there will be no backup files and the log file + will be truncated when it reaches . + + + If a negative number is supplied then no deletions will be made. Note + that this could result in very slow performance as a large number of + files are rolled over unless is used. + + + The maximum applies to each time based group of files and + not the total. + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size in bytes that the output file is allowed to reach before being + rolled over to backup files. + + + + This property is equivalent to except + that it is required for differentiating the setter taking a + argument from the setter taking a + argument. + + + The default maximum file size is 10MB (10*1024*1024). + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size that the output file is allowed to reach before being + rolled over to backup files. + + + + This property allows you to specify the maximum size with the + suffixes "KB", "MB" or "GB" so that the size is interpreted being + expressed respectively in kilobytes, megabytes or gigabytes. + + + For example, the value "10KB" will be interpreted as 10240 bytes. + + + The default maximum file size is 10MB. + + + If you have the option to set the maximum file size programmatically + consider using the property instead as this + allows you to set the size in bytes as a . + + + + + + Gets or sets the rolling file count direction. + + + The rolling file count direction. + + + + Indicates if the current file is the lowest numbered file or the + highest numbered file. + + + By default newer files have lower numbers ( < 0), + i.e. log.1 is most recent, log.5 is the 5th backup, etc... + + + >= 0 does the opposite i.e. + log.1 is the first backup made, log.5 is the 5th backup made, etc. + For infinite backups use >= 0 to reduce + rollover costs. + + The default file count direction is -1. + + + + + Gets or sets the rolling style. + + The rolling style. + + + The default rolling style is . + + + When set to this appender's + property is set to false, otherwise + the appender would append to a single file rather than rolling + the file each time it is opened. + + + + + + Gets or sets a value indicating whether to always log to + the same file. + + + true if always should be logged to the same file, otherwise false. + + + + By default file.log is always the current file. Optionally + file.log.yyyy-mm-dd for current formatted datePattern can by the currently + logging file (or file.log.curSizeRollBackup or even + file.log.yyyy-mm-dd.curSizeRollBackup). + + + This will make time based rollovers with a large number of backups + much faster as the appender it won't have to rename all the backups! + + + + + + Style of rolling to use + + + + Style of rolling to use + + + + + + Roll files once per program execution + + + + Roll files once per program execution. + Well really once each time this appender is + configured. + + + Setting this option also sets AppendToFile to + false on the RollingFileAppender, otherwise + this appender would just be a normal file appender. + + + + + + Roll files based only on the size of the file + + + + + Roll files based only on the date + + + + + Roll files based on both the size and date of the file + + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + + + Roll the log not based on the date + + + + + Roll the log for each minute + + + + + Roll the log for each hour + + + + + Roll the log twice a day (midday and midnight) + + + + + Roll the log each day (midnight) + + + + + Roll the log each week + + + + + Roll the log each month + + + + + This interface is used to supply Date/Time information to the . + + + This interface is used to supply Date/Time information to the . + Used primarily to allow test classes to plug themselves in so they can + supply test date/times. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Default implementation of that returns the current time. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Send an e-mail when a specific logging event occurs, typically on errors + or fatal errors. + + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Authentication and setting the server Port are only available on the MS .NET 1.1 runtime. + For these features to be enabled you need to ensure that you are using a version of + the log4net assembly that is built against the MS .NET 1.1 framework and that you are + running the your application on the MS .NET 1.1 runtime. On all other platforms only sending + unauthenticated messages to a server listening on port 25 (the default) is supported. + + + Authentication is supported by setting the property to + either or . + If using authentication then the + and properties must also be set. + + + To set the SMTP server port use the property. The default port is 25. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + + Send the email message + + the body text to include in the mail + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of recipient e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the name of the SMTP relay mail server to use to send + the e-mail messages. + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + + + Obsolete + + + Use the BufferingAppenderSkeleton Fix methods instead + + + + Obsolete property. + + + + + + The mode to use to authentication with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + Valid Authentication mode values are: , + , and . + The default value is . When using + you must specify the + and to use to authenticate. + When using the Windows credentials for the current + thread, if impersonating, or the process will be used to authenticate. + + + + + + The username to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the username will be ignored. + + + + + + The password to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the password will be ignored. + + + + + + The port on which the SMTP server is listening + + + Server Port is only available on the MS .NET 1.1 runtime. + + The port on which the SMTP server is listening. The default + port is 25. The Port can only be changed when running on + the MS .NET 1.1 runtime. + + + + + + Gets or sets the priority of the e-mail message + + + One of the values. + + + + Sets the priority of the e-mails generated by this + appender. The default priority is . + + + If you are using this appender to report errors then + you may want to set the priority to . + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Values for the property. + + + + SMTP authentication modes. + + + + + + No authentication + + + + + Basic authentication. + + + Requires a username and password to be supplied + + + + + Integrated authentication + + + Uses the Windows credentials from the current thread or process to authenticate. + + + + + Send an email when a specific logging event occurs, typically on errors + or fatal errors. Rather than sending via smtp it writes a file into the + directory specified by . This allows services such + as the IIS SMTP agent to manage sending the messages. + + + + The configuration for this appender is identical to that of the SMTPAppender, + except that instead of specifying the SMTPAppender.SMTPHost you specify + . + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Niall Daley + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + Sends the contents of the cyclic buffer as an e-mail message. + + + + + + Activate the options on this appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + The security context to use for privileged calls + + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the path to write the messages to. + + + + Gets or sets the path to write the messages to. This should be the same + as that used by the agent sending the messages. + + + + + + Gets or sets the used to write to the pickup directory. + + + The used to write to the pickup directory. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appender that allows clients to connect via Telnet to receive log messages + + + + The TelnetAppender accepts socket connections and streams logging messages + back to the client. + The output is provided in a telnet-friendly way so that a log can be monitored + over a TCP/IP socket. + This allows simple remote monitoring of application logging. + + + The default is 23 (the telnet port). + + + Keith Long + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + Overrides the parent method to close the socket handler + + + + Closes all the outstanding connections. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Create the socket handler and wait for connections + + + + + + Writes the logging event to each connected client. + + The event to log. + + + Writes the logging event to each connected client. + + + + + + Gets or sets the TCP port number on which this will listen for connections. + + + An integer value in the range to + indicating the TCP port number on which this will listen for connections. + + + + The default value is 23 (the telnet port). + + + The value specified is less than + or greater than . + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Helper class to manage connected clients + + + + The SocketHandler class is used to accept connections from + clients. It is threaded so that clients can connect/disconnect + asynchronously. + + + + + + Opens a new server port on + + the local port to listen on for connections + + + Creates a socket handler on the specified local server port. + + + + + + Sends a string message to each of the connected clients + + the text to send + + + Sends a string message to each of the connected clients + + + + + + Add a client to the internal clients list + + client to add + + + + Remove a client from the internal clients list + + client to remove + + + + Callback used to accept a connection on the server socket + + The result of the asynchronous operation + + + On connection adds to the list of connections + if there are two many open connections you will be disconnected + + + + + + Close all network connections + + + + Make sure we close all network connections + + + + + + Test if this handler has active connections + + + true if this handler has active connections + + + + This property will be true while this handler has + active connections, that is at least one connection that + the handler will attempt to send a message to. + + + + + + Class that represents a client connected to this handler + + + + Class that represents a client connected to this handler + + + + + + Create this for the specified + + the client's socket + + + Opens a stream writer on the socket. + + + + + + Write a string to the client + + string to send + + + Write a string to the client + + + + + + Cleanup the clients connection + + + + Close the socket connection. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + trace system. + + + Events are written using the System.Diagnostics.Trace.Write(string,string) + method. The event's logger name is passed as the value for the category name to the Write method. + + + Compact Framework
+ The Compact Framework does not support the + class for any operation except Assert. When using the Compact Framework this + appender will write to the system rather than + the Trace system. This appender will therefore behave like the . +
+
+ Douglas de la Torre + Nicko Cadell + Gert Driesen +
+ + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Assembly level attribute that specifies a domain to alias to this assembly's repository. + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's domain to its repository by + specifying this attribute with the name of the target domain. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required domains. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies a repository to alias to this assembly's repository. + + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's repository to its repository by + specifying this attribute with the name of the target repository. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required repositories. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + The repository to alias to this assemby's repository. + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + + + + + Gets or sets the repository to alias to this assemby's repository. + + + The repository to alias to this assemby's repository. + + + + The name of the repository to alias to this assemby's repository. + + + + + + Initializes a new instance of the class with + the specified domain to alias to this assembly's repository. + + The domain to alias to this assemby's repository. + + + Obsolete. Use instead of . + + + + + + Use this class to quickly configure a . + + + + Allows very simple programmatic configuration of log4net. + + + Only one appender can be configured using this configurator. + The appender is set at the root of the hierarchy and all logging + events will be delivered to that appender. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Initializes the log4net system with a default configuration. + + + + Initializes the log4net logging system using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the log4net system using the specified appender. + + The appender to use to log all logging events. + + + Initializes the log4net system using the specified appender. + + + + + + Initializes the with a default configuration. + + The repository to configure. + + + Initializes the specified repository using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the using the specified appender. + + The repository to configure. + The appender to use to log all logging events. + + + Initializes the using the specified appender. + + + + + + Base class for all log4net configuration attributes. + + + This is an abstract class that must be extended by + specific configurators. This attribute allows the + configurator to be parameterized by an assembly level + attribute. + + Nicko Cadell + Gert Driesen + + + + Constructor used by subclasses. + + the ordering priority for this configurator + + + The is used to order the configurator + attributes before they are invoked. Higher priority configurators are executed + before lower priority ones. + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Abstract method implemented by a subclass. When this method is called + the subclass should configure the . + + + + + + Compare this instance to another ConfiguratorAttribute + + the object to compare to + see + + + Compares the priorities of the two instances. + Sorts by priority in descending order. Objects with the same priority are + randomly ordered. + + + + + + Assembly level attribute that specifies the logging domain for the assembly. + + + + DomainAttribute is obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + Assemblies are mapped to logging domains. Each domain has its own + logging repository. This attribute specified on the assembly controls + the configuration of the domain. The property specifies the name + of the domain that this assembly is a part of. The + specifies the type of the repository objects to create for the domain. If + this attribute is not specified and a is not specified + then the assembly will be part of the default shared logging domain. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies the logging repository for the assembly. + + + + Assemblies are mapped to logging repository. This attribute specified + on the assembly controls + the configuration of the repository. The property specifies the name + of the repository that this assembly is a part of. The + specifies the type of the object + to create for the assembly. If this attribute is not specified or a + is not specified then the assembly will be part of the default shared logging repository. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize a new instance of the class + with the name of the repository. + + The name of the repository. + + + Initialize the attribute with the name for the assembly's repository. + + + + + + Gets or sets the name of the logging repository. + + + The string name to use as the name of the repository associated with this + assembly. + + + + This value does not have to be unique. Several assemblies can share the + same repository. They will share the logging configuration of the repository. + + + + + + Gets or sets the type of repository to create for this assembly. + + + The type of repository to create for this assembly. + + + + The type of the repository to create for the assembly. + The type must implement the + interface. + + + This will be the type of repository created when + the repository is created. If multiple assemblies reference the + same repository then the repository is only created once using the + of the first assembly to call into the + repository. + + + + + + Initializes a new instance of the class. + + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Initialize a new instance of the class + with the name of the domain. + + The name of the domain. + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + The repository to configure. + + + + Configures log4net using a log4net element + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The element to parse. + + + + Configures the using the specified XML + element. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration file. + + A stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Assembly level attribute to configure the . + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + If neither of the or + properties are set the configuration is loaded from the application's .config file. + If set the property takes priority over the + property. The property + specifies a path to a file to load the config from. The path is relative to the + application's base directory; . + The property is used as a postfix to the assembly file name. + The config file must be located in the application's base directory; . + For example in a console application setting the to + config has the same effect as not specifying the or + properties. + + + The property can be set to cause the + to watch the configuration file for changes. + + + + Log4net will only look for assembly level configuration attributes once. + When using the log4net assembly level attributes to control the configuration + of log4net you must ensure that the first call to any of the + methods is made from the assembly with the configuration + attributes. + + + If you cannot guarantee the order in which log4net calls will be made from + different assemblies you must use programmatic configuration instead, i.e. + call the method directly. + + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Configure the repository using the . + The specified must extend the + class otherwise the will not be able to + configure it. + + + The does not extend . + + + + Attempt to load configuration from the local file system + + The assembly that this attribute was defined on. + The repository to configure. + + + + Configure the specified repository using a + + The repository to configure. + the FileInfo pointing to the config file + + + + Attempt to load configuration from a URI + + The assembly that this attribute was defined on. + The repository to configure. + + + + Gets or sets the filename of the configuration file. + + + The filename of the configuration file. + + + + If specified, this is the name of the configuration file to use with + the . This file path is relative to the + application base directory (). + + + The takes priority over the . + + + + + + Gets or sets the extension of the configuration file. + + + The extension of the configuration file. + + + + If specified this is the extension for the configuration file. + The path to the config file is built by using the application + base directory (), + the assembly file name and the config file extension. + + + If the is set to MyExt then + possible config file names would be: MyConsoleApp.exe.MyExt or + MyClassLibrary.dll.MyExt. + + + The takes priority over the . + + + + + + Gets or sets a value indicating whether to watch the configuration file. + + + true if the configuration should be watched, false otherwise. + + + + If this flag is specified and set to true then the framework + will watch the configuration file and will reload the config each time + the file is modified. + + + The config file can only be watched if it is loaded from local disk. + In a No-Touch (Smart Client) deployment where the application is downloaded + from a web server the config file may not reside on the local disk + and therefore it may not be able to watch it. + + + Watching configuration is not supported on the SSCLI. + + + + + + Class to register for the log4net section of the configuration file + + + The log4net section of the configuration file needs to have a section + handler registered. This is the section handler used. It simply returns + the XML element that is the root of the section. + + + Example of registering the log4net section handler : + + + +
+ + + log4net configuration XML goes here + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Parses the configuration section. + + The configuration settings in a corresponding parent configuration section. + The configuration context when called from the ASP.NET configuration system. Otherwise, this parameter is reserved and is a null reference. + The for the log4net section. + The for the log4net section. + + + Returns the containing the configuration data, + + + + + + Assembly level attribute that specifies a plugin to attach to + the repository. + + + + Specifies the type of a plugin to create and attach to the + assembly's repository. The plugin type must implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Interface used to create plugins. + + + + Interface used to create a plugin. + + + Nicko Cadell + Gert Driesen + + + + Creates the plugin object. + + the new plugin instance + + + Create and return a new plugin instance. + + + + + + Initializes a new instance of the class + with the specified type. + + The type name of plugin to create. + + + Create the attribute with the plugin type specified. + + + Where possible use the constructor that takes a . + + + + + + Initializes a new instance of the class + with the specified type. + + The type of plugin to create. + + + Create the attribute with the plugin type specified. + + + + + + Creates the plugin object defined by this attribute. + + + + Creates the instance of the object as + specified by this attribute. + + + The plugin object. + + + + Returns a representation of the properties of this object. + + + + Overrides base class method to + return a representation of the properties of this object. + + + A representation of the properties of this object + + + + Gets or sets the type for the plugin. + + + The type for the plugin. + + + + The type for the plugin. + + + + + + Gets or sets the type name for the plugin. + + + The type name for the plugin. + + + + The type name for the plugin. + + + Where possible use the property instead. + + + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + + + + Construct provider attribute with type specified + + the type of the provider to use + + + The provider specified must subclass the + class. + + + + + + Configures the SecurityContextProvider + + The assembly that this attribute was defined on. + The repository to configure. + + + Creates a provider instance from the specified. + Sets this as the default security context provider . + + + + + + Gets or sets the type of the provider to use. + + + the type of the provider to use. + + + + The provider specified must subclass the + class. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + The repository to configure. + + + + Configures log4net using a log4net element + + + + Loads the log4net configuration from the XML element + supplied as . + + + The element to parse. + + + + Configures the using the specified XML + element. + + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration URI. + + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The must support the URI scheme specified. + + + + + + Configures log4net using the specified configuration data stream. + + A stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + URI. + + The repository to configure. + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The must support the URI scheme specified. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the specified repository using a log4net element. + + The hierarchy to configure. + The element to parse. + + + Loads the log4net configuration from the XML element + supplied as . + + + This method is ultimately called by one of the Configure methods + to load the configuration from an . + + + + + + Class used to watch config files. + + + + Uses the to monitor + changes to a specified file. Because multiple change notifications + may be raised when the file is modified, a timer is used to + compress the notifications into a single event. The timer + waits for time before delivering + the event notification. If any further + change notifications arrive while the timer is waiting it + is reset and waits again for to + elapse. + + + + + + The default amount of time to wait after receiving notification + before reloading the config file. + + + + + Watch a specified config file used to configure a repository + + The repository to configure. + The configuration file to watch. + + + Watch a specified config file used to configure a repository + + + + + + Holds the FileInfo used to configure the XmlConfigurator + + + + + Holds the repository being configured. + + + + + The timer used to compress the notification events. + + + + + Initializes a new instance of the class. + + The repository to configure. + The configuration file to watch. + + + Initializes a new instance of the class. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Called by the timer when the configuration has been updated. + + null + + + + The implementation of the interface suitable + for use with the compact framework + + + + This implementation is a simple + mapping between repository name and + object. + + + The .NET Compact Framework 1.0 does not support retrieving assembly + level attributes therefore unlike the DefaultRepositorySelector + this selector does not examine the calling assembly for attributes. + + + Nicko Cadell + + + + Interface used by the to select the . + + + + The uses a + to specify the policy for selecting the correct + to return to the caller. + + + Nicko Cadell + Gert Driesen + + + + Gets the for the specified assembly. + + The assembly to use to lookup to the + The for the assembly. + + + Gets the for the specified assembly. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. The results of this method must be repeatable, i.e. + when called again with the same arguments the result must be the + save value. + + + + + + Gets the named . + + The name to use to lookup to the . + The named + + Lookup a named . This is the repository created by + calling . + + + + + Creates a new repository for the assembly specified. + + The assembly to use to create the domain to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the domain + specified such that a call to with the + same assembly specified will return the same repository instance. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. + + + + + + Creates a new repository with the name specified. + + The name to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the name + specified such that a call to with the + same name will return the same repository instance. + + + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets an array of all currently defined repositories. + + + An array of the instances created by + this . + + + Gets an array of all of the repositories created by this selector. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Create a new repository selector + + the type of the repositories to create, must implement + + + Create an new compact repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + throw if is null + throw if does not implement + + + + Get the for the specified assembly + + not used + The default + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Get the named + + the name of the repository to lookup + The named + + + Get the named . The default + repository is log4net-default-repository. Other repositories + must be created using the . + If the named repository does not exist an exception is thrown. + + + throw if is null + throw if the does not exist + + + + Create a new repository for the assembly specified + + not used + the type of repository to create, must implement + the repository created + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + If the is null then the + default repository type specified to the constructor is used. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Create a new repository for the repository specified + + the repository to associate with the + the type of repository to create, must implement . + If this param is null then the default repository type is used. + the repository created + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + If the named repository already exists an exception will be thrown. + + + If is null then the default + repository type specified to the constructor is used. + + + throw if is null + throw if the already exists + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + Notify the registered listeners that the repository has been created + + The repository that has been created + + + Raises the LoggerRepositoryCreatedEvent + event. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + The default implementation of the interface. + + + + Uses attributes defined on the calling assembly to determine how to + configure the hierarchy for the repository. + + + Nicko Cadell + Gert Driesen + + + + Creates a new repository selector. + + The type of the repositories to create, must implement + + + Create an new repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + is . + does not implement . + + + + Gets the for the specified assembly. + + The assembly use to lookup the . + + + The type of the created and the repository + to create can be overridden by specifying the + attribute on the . + + + The default values are to use the + implementation of the interface and to use the + as the name of the repository. + + + The created will be automatically configured using + any attributes defined on + the . + + + The for the assembly + is . + + + + Gets the for the specified repository. + + The repository to use to lookup the . + The for the specified repository. + + + Returns the named repository. If is null + a is thrown. If the repository + does not exist a is thrown. + + + Use to create a repository. + + + is . + does not exist. + + + + Create a new repository for the assembly specified + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the assembly specified. + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The name to assign to the created repository + Set to true to read and apply the assembly attributes + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the specified repository. + + The repository to associate with the . + The type of repository to create, must implement . + If this param is then the default repository type is used. + The new repository. + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + is . + already exists. + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + Aliases a repository to an existing repository. + + The repository to alias. + The repository that the repository is aliased to. + + + The repository specified will be aliased to the repository when created. + The repository must not already exist. + + + When the repository is created it must utilize the same repository type as + the repository it is aliased to, otherwise the aliasing will fail. + + + + is . + -or- + is . + + + + + Notifies the registered listeners that the repository has been created. + + The repository that has been created. + + + Raises the event. + + + + + + Gets the repository name and repository type for the specified assembly. + + The assembly that has a . + in/out param to hold the repository name to use for the assembly, caller should set this to the default value before calling. + in/out param to hold the type of the repository to create for the assembly, caller should set this to the default value before calling. + is . + + + + Configures the repository using information from the assembly. + + The assembly containing + attributes which define the configuration for the repository. + The repository to configure. + + is . + -or- + is . + + + + + Loads the attribute defined plugins on the assembly. + + The assembly that contains the attributes. + The repository to add the plugins to. + + is . + -or- + is . + + + + + Loads the attribute defined aliases on the assembly. + + The assembly that contains the attributes. + The repository to alias to. + + is . + -or- + is . + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Defined error codes that can be passed to the method. + + + + Values passed to the method. + + + Nicko Cadell + + + + A general error + + + + + Error while writing output + + + + + Failed to flush file + + + + + Failed to close file + + + + + Unable to open output file + + + + + No layout specified + + + + + Failed to parse address + + + + + Appenders may delegate their error handling to an . + + + + Error handling is a particularly tedious to get right because by + definition errors are hard to predict and to reproduce. + + + Nicko Cadell + Gert Driesen + + + + Handles the error and information about the error condition is passed as + a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + The error code associated with the error. + + + Handles the error and information about the error condition is passed as + a parameter. + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + + + See . + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + + + See . + + + + + + Interface for objects that require fixing. + + + + Interface that indicates that the object requires fixing before it + can be taken outside the context of the appender's + method. + + + When objects that implement this interface are stored + in the context properties maps + and + are fixed + (see ) the + method will be called. + + + Nicko Cadell + + + + Get a portable version of this object + + the portable instance of this object + + + Get a portable instance object that represents the current + state of this object. The portable object can be stored + and logged from any thread with identical results. + + + + + + Interface that all loggers implement + + + + This interface supports logging events and testing if a level + is enabled for logging. + + + These methods will not throw exceptions. Note to implementor, ensure + that the implementation of these methods cannot allow an exception + to be thrown to the caller. + + + Nicko Cadell + Gert Driesen + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + the exception to log, including its stack trace. Pass null to not log an exception. + + + Generates a logging event for the specified using + the and . + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + + + + Gets the name of the logger. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Base interface for all wrappers + + + + Base interface for all wrappers. + + + All wrappers must implement this interface. + + + Nicko Cadell + + + + Get the implementation behind this wrapper object. + + + The object that in implementing this object. + + + + The object that in implementing this + object. The Logger object may not + be the same object as this object because of logger decorators. + This gets the actual underlying objects that is used to process + the log events. + + + + + + Delegate used to handle logger repository creation event notifications + + The which created the repository. + The event args + that holds the instance that has been created. + + + Delegate used to handle logger repository creation event notifications. + + + + + + Provides data for the event. + + + + A + event is raised every time a is created. + + + + + + The created + + + + + Construct instance using specified + + the that has been created + + + Construct instance using specified + + + + + + The that has been created + + + The that has been created + + + + The that has been created + + + + + + Test if an triggers an action + + + + Implementations of this interface allow certain appenders to decide + when to perform an appender specific action. + + + The action or behavior triggered is defined by the implementation. + + + Nicko Cadell + + + + Test if this event triggers the action + + The event to check + true if this event triggers the action, otherwise false + + + Return true if this event triggers the action + + + + + + Defines the default set of levels recognized by the system. + + + + Each has an associated . + + + Levels have a numeric that defines the relative + ordering between levels. Two Levels with the same + are deemed to be equivalent. + + + The levels that are recognized by log4net are set for each + and each repository can have different levels defined. The levels are stored + in the on the repository. Levels are + looked up by name from the . + + + When logging at level INFO the actual level used is not but + the value of LoggerRepository.LevelMap["INFO"]. The default value for this is + , but this can be changed by reconfiguring the level map. + + + Each level has a in addition to its . The + is the string that is written into the output log. By default + the display name is the same as the level name, but this can be used to alias levels + or to localize the log output. + + + Some of the predefined levels recognized by the system are: + + + + . + + + . + + + . + + + . + + + . + + + . + + + . + + + + Nicko Cadell + Gert Driesen + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + The display name for this level. This may be localized or otherwise different from the name + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Returns the representation of the current + . + + + A representation of the current . + + + + Returns the level . + + + + + + Compares levels. + + The object to compare against. + true if the objects are equal. + + + Compares the levels of instances, and + defers to base class if the target object is not a + instance. + + + + + + Returns a hash code + + A hash code for the current . + + + Returns a hash code suitable for use in hashing algorithms and data + structures like a hash table. + + + Returns the hash code of the level . + + + + + + Compares this instance to a specified object and returns an + indication of their relative values. + + A instance or to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the + values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + This instance is less than . + + + Zero + This instance is equal to . + + + Greater than zero + + This instance is greater than . + -or- + is . + + + + + + + must be an instance of + or ; otherwise, an exception is thrown. + + + is not a . + + + + Returns a value indicating whether a specified + is greater than another specified . + + A + A + + true if is greater than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than another specified . + + A + A + + true if is less than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is greater than or equal to another specified . + + A + A + + true if is greater than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than or equal to another specified . + + A + A + + true if is less than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have the same value. + + A or . + A or . + + true if the value of is the same as the + value of ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have different values. + + A or . + A or . + + true if the value of is different from + the value of ; otherwise, false. + + + + Compares two levels. + + + + + + Compares two specified instances. + + The first to compare. + The second to compare. + + A 32-bit signed integer that indicates the relative order of the + two values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + is less than . + + + Zero + is equal to . + + + Greater than zero + is greater than . + + + + + + Compares two levels. + + + + + + The level designates a higher level than all the rest. + + + + + The level designates very severe error events. + System unusable, emergencies. + + + + + The level designates very severe error events + that will presumably lead the application to abort. + + + + + The level designates very severe error events. + Take immediate action, alerts. + + + + + The level designates very severe error events. + Critical condition, critical. + + + + + The level designates very severe error events. + + + + + The level designates error events that might + still allow the application to continue running. + + + + + The level designates potentially harmful + situations. + + + + + The level designates informational messages + that highlight the progress of the application at the highest level. + + + + + The level designates informational messages that + highlight the progress of the application at coarse-grained level. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates the lowest level possible. + + + + + Gets the name of this level. + + + The name of this level. + + + + Gets the name of this level. + + + + + + Gets the value of this level. + + + The value of this level. + + + + Gets the value of this level. + + + + + + Gets the display name of this level. + + + The display name of this level. + + + + Gets the display name of this level. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a LevelCollection instance. + + list to create a readonly wrapper arround + + A LevelCollection wrapper that is read-only. + + + + + Initializes a new instance of the LevelCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the LevelCollection class + that has the specified initial capacity. + + + The number of elements that the new LevelCollection is initially capable of storing. + + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified LevelCollection. + + The LevelCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + Copies the entire LevelCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire LevelCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the LevelCollection. + + The to be added to the end of the LevelCollection. + The index at which the value has been added. + + + + Removes all elements from the LevelCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the LevelCollection. + + The to check for. + true if is found in the LevelCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the LevelCollection. + + The to locate in the LevelCollection. + + The zero-based index of the first occurrence of + in the entire LevelCollection, if found; otherwise, -1. + + + + + Inserts an element into the LevelCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the LevelCollection. + + The to remove from the LevelCollection. + + The specified was not found in the LevelCollection. + + + + + Removes the element at the specified index of the LevelCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the LevelCollection. + + An for the entire LevelCollection. + + + + Adds the elements of another LevelCollection to the current LevelCollection. + + The LevelCollection whose elements should be added to the end of the current LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a array to the current LevelCollection. + + The array whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a collection to the current LevelCollection. + + The collection whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the LevelCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the LevelCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + A value + + + + + Supports simple iteration over a . + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + An evaluator that triggers at a threshold level + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + Nicko Cadell + + + + The threshold for triggering + + + + + Create a new evaluator using the threshold. + + + + Create a new evaluator using the threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Create a new evaluator using the specified threshold. + + the threshold to trigger at + + + Create a new evaluator using the specified threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Is this the triggering event? + + The event to check + This method returns true, if the event level + is equal or higher than the . + Otherwise it returns false + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + the threshold to trigger at + + + The that will cause this evaluator to trigger + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Mapping between string name and Level object + + + + Mapping between string name and object. + This mapping is held separately for each . + The level name is case insensitive. + + + Nicko Cadell + + + + Mapping from level name to Level object. The + level name is case insensitive + + + + + Construct the level map + + + + Construct the level map. + + + + + + Clear the internal maps of all levels + + + + Clear the internal maps of all levels + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + + + Create a new Level and add it to the map + + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + the display name to give to the Level + + + Create a new Level and add it to the map + + + + + + Add a Level to the map + + the Level to add + + + Add a Level to the map + + + + + + Lookup a named level from the map + + the name of the level to lookup is taken from this level. + If the level is not set on the map then this level is added + the level in the map with the name specified + + + Lookup a named level from the map. The name of the level to lookup is taken + from the property of the + argument. + + + If no level with the specified name is found then the + argument is added to the level map + and returned. + + + + + + Lookup a by name + + The name of the Level to lookup + a Level from the map with the name specified + + + Returns the from the + map with the name specified. If the no level is + found then null is returned. + + + + + + Return all possible levels as a list of Level objects. + + all possible levels as a list of Level objects + + + Return all possible levels as a list of Level objects. + + + + + + The internal representation of caller location information. + + + + This class uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. + + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + Nicko Cadell + Gert Driesen + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + Constructor + + The declaring type of the method that is + the stack boundary into the logging system for this call. + + + Initializes a new instance of the + class based on the current thread. + + + + + + Constructor + + The fully qualified class name. + The method name. + The file name. + The line number of the method within the file. + + + Initializes a new instance of the + class with the specified data. + + + + + + Gets the fully qualified class name of the caller making the logging + request. + + + The fully qualified class name of the caller making the logging + request. + + + + Gets the fully qualified class name of the caller making the logging + request. + + + + + + Gets the file name of the caller. + + + The file name of the caller. + + + + Gets the file name of the caller. + + + + + + Gets the line number of the caller. + + + The line number of the caller. + + + + Gets the line number of the caller. + + + + + + Gets the method name of the caller. + + + The method name of the caller. + + + + Gets the method name of the caller. + + + + + + Gets all available caller information + + + All available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + Gets all available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + + + Static manager that controls the creation of repositories + + + + Static manager that controls the creation of repositories + + + This class is used by the wrapper managers (e.g. ) + to provide access to the objects. + + + This manager also holds the that is used to + lookup and create repositories. The selector can be set either programmatically using + the property, or by setting the log4net.RepositorySelector + AppSetting in the applications config file to the fully qualified type name of the + selector to use. + + + Nicko Cadell + Gert Driesen + + + + Private constructor to prevent instances. Only static methods should be used. + + + + Private constructor to prevent instances. Only static methods should be used. + + + + + + Hook the shutdown event + + + + On the full .NET runtime, the static constructor hooks up the + AppDomain.ProcessExit and AppDomain.DomainUnload> events. + These are used to shutdown the log4net system as the application exits. + + + + + + Register for ProcessExit and DomainUnload events on the AppDomain + + + + This needs to be in a separate method because the events make + a LinkDemand for the ControlAppDomain SecurityPermission. Because + this is a LinkDemand it is demanded at JIT time. Therefore we cannot + catch the exception in the method itself, we have to catch it in the + caller. + + + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + Returns the default instance. + + + + + + Returns the named logger if it exists. + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified repository. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns the named logger if it exists. + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified assembly's repository. + + + + If the named logger exists (in the specified assembly's repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Retrieves or creates a named logger. + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Retrieves or creates a named logger. + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Shorthand for . + + The repository to lookup in. + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shorthand for . + + the assembly to use to lookup the repository + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The repository to shutdown. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The assembly to use to lookup the repository. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Resets all values contained in this repository instance to their defaults. + + The repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + The assembly to use to lookup the repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Gets an array of all currently defined repositories. + + An array of all the known objects. + + + Gets an array of all currently defined repositories. + + + + + + Internal method to get pertinent version info. + + A string of version info. + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + Initialize the default repository selector + + + + + Gets or sets the repository selector used by the . + + + The repository selector used by the . + + + + The repository selector () is used by + the to create and select repositories + (). + + + The caller to supplies either a string name + or an assembly (if not supplied the assembly is inferred using + ). + + + This context is used by the selector to lookup a specific repository. + + + For the full .NET Framework, the default repository is DefaultRepositorySelector; + for the .NET Compact Framework CompactRepositorySelector is the default + repository. + + + + + + Implementation of the interface. + + + + This class should be used as the base for all wrapper implementations. + + + Nicko Cadell + Gert Driesen + + + + Constructs a new wrapper for the specified logger. + + The logger to wrap. + + + Constructs a new wrapper for the specified logger. + + + + + + The logger that this object is wrapping + + + + + Gets the implementation behind this wrapper object. + + + The object that this object is implementing. + + + + The Logger object may not be the same object as this object + because of logger decorators. + + + This gets the actual underlying objects that is used to process + the log events. + + + + + + Portable data structure used by + + + + Portable data structure used by + + + Nicko Cadell + + + + The logger name. + + + + The logger name. + + + + + + Level of logging event. + + + + Level of logging event. Level cannot be Serializable + because it is a flyweight. Due to its special serialization it + cannot be declared final either. + + + + + + The application supplied message. + + + + The application supplied message of logging event. + + + + + + The name of thread + + + + The name of thread in which this logging event was generated + + + + + + The time the event was logged + + + + The TimeStamp is stored in the local time zone for this computer. + + + + + + Location information for the caller. + + + + Location information for the caller. + + + + + + String representation of the user + + + + String representation of the user's windows name, + like DOMAIN\username + + + + + + String representation of the identity. + + + + String representation of the current thread's principal identity. + + + + + + The string representation of the exception + + + + The string representation of the exception + + + + + + String representation of the AppDomain. + + + + String representation of the AppDomain. + + + + + + Additional event specific properties + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + + + + Flags passed to the property + + + + Flags passed to the property + + + Nicko Cadell + + + + Fix the MDC + + + + + Fix the NDC + + + + + Fix the rendered message + + + + + Fix the thread name + + + + + Fix the callers location information + + + CAUTION: Very slow to generate + + + + + Fix the callers windows user name + + + CAUTION: Slow to generate + + + + + Fix the domain friendly name + + + + + Fix the callers principal name + + + CAUTION: May be slow to generate + + + + + Fix the exception text + + + + + Fix the event properties + + + + + No fields fixed + + + + + All fields fixed + + + + + Partial fields fixed + + + + This set of partial fields gives good performance. The following fields are fixed: + + + + + + + + + + + + + The internal representation of logging events. + + + + When an affirmative decision is made to log then a + instance is created. This instance + is passed around to the different log4net components. + + + This class is of concern to those wishing to extend log4net. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino + + + + The key into the Properties map for the host name value. + + + + + The key into the Properties map for the thread identity value. + + + + + The key into the Properties map for the user name value. + + + + + Initializes a new instance of the class + from the supplied parameters. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + The name of the logger of this event. + The level of this event. + The message of this event. + The exception for this event. + + + Except , and , + all fields of LoggingEvent are filled when actually needed. Call + to cache all data locally + to prevent inconsistencies. + + This method is called by the log4net framework + to create a logging event. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + The fields in the struct that have already been fixed. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + The parameter should be used to specify which fields in the + struct have been preset. Fields not specified in the + will be captured from the environment if requested or fixed. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Initializes a new instance of the class + using specific data. + + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Serialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Ensure that the repository is set. + + the value for the repository + + + + Write the rendered message to a TextWriter + + the writer to write the message to + + + Unlike the property this method + does store the message data in the internal cache. Therefore + if called only once this method should be faster than the + property, however if the message is + to be accessed multiple times then the property will be more efficient. + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + The data in this event must be fixed before it can be serialized. + + + The method must be called during the + method call if this event + is to be used outside that method. + + + + + + Gets the portable data for this . + + The for this event. + + + A new can be constructed using a + instance. + + + Does a fix of the data + in the logging event before returning the event data. + + + + + + Gets the portable data for this . + + The set of data to ensure is fixed in the LoggingEventData + The for this event. + + + A new can be constructed using a + instance. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Obsolete. Use instead. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Returns this event's exception's rendered using the + . + + + + + + Fix instance fields that hold volatile data. + + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + incurred by calling but it + is essential to maintaining data consistency. + + + Calling is equivalent to + calling passing the parameter + false. + + + See for more + information. + + + + + + Fixes instance fields that hold volatile data. + + Set to true to not fix data that takes a long time to fix. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + The param controls the data that + is fixed. Some of the data that can be fixed takes a long time to + generate, therefore if you do not require those settings to be fixed + they can be ignored by setting the param + to true. This setting will ignore the + and settings. + + + Set to false to ensure that all + settings are fixed. + + + + + + Fix the fields specified by the parameter + + the fields to fix + + + Only fields specified in the will be fixed. + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Lookup a composite property in this event + + the key for the property to lookup + the value for the property + + + This event has composite properties that combine together properties from + several different contexts in the following order: + + + this events properties + + This event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + + Get all the composite properties in this event + + the containing all the properties + + + See for details of the composite properties + stored by the event. + + + This method returns a single containing all the + properties defined for this event. + + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The fully qualified Type of the calling + logger class in the stack frame (i.e. the declaring type of the method). + + + + + The application supplied message of logging event. + + + + + The exception that was thrown. + + + This is not serialized. The string representation + is serialized instead. + + + + + The repository that generated the logging event + + + This is not serialized. + + + + + The fix state for this event + + + These flags indicate which fields have been fixed. + Not serialized. + + + + + Indicated that the internal cache is updateable (ie not fixed) + + + This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler + changes in the caching strategy. + + + + + Gets the time when the current process started. + + + This is the time when this process started. + + + + The TimeStamp is stored in the local time zone for this computer. + + + Tries to get the start time for the current process. + Failing that it returns the time of the first call to + this property. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating and therefore + without the process start time being reset. + + + + + + Gets the of the logging event. + + + The of the logging event. + + + + Gets the of the logging event. + + + + + + Gets the time of the logging event. + + + The time of the logging event. + + + + The TimeStamp is stored in the local time zone for this computer. + + + + + + Gets the name of the logger that logged the event. + + + The name of the logger that logged the event. + + + + Gets the name of the logger that logged the event. + + + + + + Gets the location information for this logging event. + + + The location information for this logging event. + + + + The collected information is cached for future use. + + + See the class for more information on + supported frameworks and the different behavior in Debug and + Release builds. + + + + + + Gets the message object used to initialize this event. + + + The message object used to initialize this event. + + + + Gets the message object used to initialize this event. + Note that this event may not have a valid message object. + If the event is serialized the message object will not + be transferred. To get the text of the message the + property must be used + not this property. + + + If there is no defined message object for this event then + null will be returned. + + + + + + Gets the exception object used to initialize this event. + + + The exception object used to initialize this event. + + + + Gets the exception object used to initialize this event. + Note that this event may not have a valid exception object. + If the event is serialized the exception object will not + be transferred. To get the text of the exception the + method must be used + not this property. + + + If there is no defined exception object for this event then + null will be returned. + + + + + + The that this event was created in. + + + + The that this event was created in. + + + + + + Gets the message, rendered through the . + + + The message rendered through the . + + + + The collected information is cached for future use. + + + + + + Gets the name of the current thread. + + + The name of the current thread, or the thread ID when + the name is not available. + + + + The collected information is cached for future use. + + + + + + Gets the name of the current user. + + + The name of the current user, or NOT AVAILABLE when the + underlying runtime has no support for retrieving the name of the + current user. + + + + Calls WindowsIdentity.GetCurrent().Name to get the name of + the current windows user. + + + To improve performance, we could cache the string representation of + the name, and reuse that as long as the identity stayed constant. + Once the identity changed, we would need to re-assign and re-render + the string. + + + However, the WindowsIdentity.GetCurrent() call seems to + return different objects every time, so the current implementation + doesn't do this type of caching. + + + Timing for these operations: + + + + Method + Results + + + WindowsIdentity.GetCurrent() + 10000 loops, 00:00:00.2031250 seconds + + + WindowsIdentity.GetCurrent().Name + 10000 loops, 00:00:08.0468750 seconds + + + + This means we could speed things up almost 40 times by caching the + value of the WindowsIdentity.GetCurrent().Name property, since + this takes (8.04-0.20) = 7.84375 seconds. + + + + + + Gets the identity of the current thread principal. + + + The string name of the identity of the current thread principal. + + + + Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get + the name of the current thread principal. + + + + + + Gets the AppDomain friendly name. + + + The AppDomain friendly name. + + + + Gets the AppDomain friendly name. + + + + + + Additional event specific properties. + + + Additional event specific properties. + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + This property is for events that have been added directly to + this event. The aggregate properties (which include these + event properties) can be retrieved using + and . + + + Once the properties have been fixed this property + returns the combined cached properties. This ensures that updates to + this property are always reflected in the underlying storage. When + returning the combined properties there may be more keys in the + Dictionary than expected. + + + + + + The fixed fields in this event + + + The set of fields that are fixed in this event + + + + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Implementation of wrapper interface. + + + + This implementation of the interface + forwards to the held by the base class. + + + This logger has methods to allow the caller to log at the following + levels: + + + + DEBUG + + The and methods log messages + at the DEBUG level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + INFO + + The and methods log messages + at the INFO level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + WARN + + The and methods log messages + at the WARN level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + ERROR + + The and methods log messages + at the ERROR level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + FATAL + + The and methods log messages + at the FATAL level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + + The values for these levels and their semantic meanings can be changed by + configuring the for the repository. + + + Nicko Cadell + Gert Driesen + + + + The ILog interface is use by application to log messages into + the log4net framework. + + + + Use the to obtain logger instances + that implement this interface. The + static method is used to get logger instances. + + + This class contains methods for logging at different levels and also + has properties for determining if those logging levels are + enabled in the current configuration. + + + This interface can be implemented in different ways. This documentation + specifies reasonable behavior that a caller can expect from the actual + implementation, however different implementations reserve the right to + do things differently. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + Log a message object with the level. + + Log a message object with the level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Logs a message object with the INFO level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + For some ILog interface log, when you write: + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, string construction and concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed (who isn't), then you should write: + + + if (log.IsDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in and once in + the . This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. This is the preferred style of logging. + + Alternatively if your logger is available statically then the is debug + enabled state can be stored in a static variable like this: + + + private static readonly bool isDebugEnabled = log.IsDebugEnabled; + + + Then when you come to log you can write: + + + if (isDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way the debug enabled state is only queried once + when the class is loaded. Using a private static readonly + variable is the most efficient because it is a run time constant + and can be heavily optimized by the JIT compiler. + + + Of course if you use a static readonly variable to + hold the enabled state of the logger then you cannot + change the enabled state at runtime to vary the logging + that is produced. You have to decide if you need absolute + speed or runtime flexibility. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Construct a new wrapper for the specified logger. + + The logger to wrap. + + + Construct a new wrapper for the specified logger. + + + + + + Virtual method called when the configuration of the repository changes + + the repository holding the levels + + + Virtual method called when the configuration of the repository changes + + + + + + Logs a message object with the DEBUG level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + DEBUG level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the DEBUG level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the DEBUG level including + the stack trace of the passed + as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + INFO level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the INFO level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the WARN level. + + the message object to log + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + WARN level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the WARN level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the WARN level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the ERROR level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + ERROR level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the ERROR level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the ERROR level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the FATAL level. + + The message object to log. + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + FATAL level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the FATAL level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the FATAL level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Event handler for the event + + the repository + Empty + + + + The fully qualified name of this declaring type not the type of any subclass. + + + + + Checks if this logger is enabled for the DEBUG + level. + + + true if this logger is enabled for DEBUG events, + false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + + For some log Logger object, when you write: + + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed, then you should write: + + + if (log.IsDebugEnabled()) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in IsDebugEnabled and once in + the Debug. This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. + + + + + + Checks if this logger is enabled for the INFO level. + + + true if this logger is enabled for INFO events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the WARN level. + + + true if this logger is enabled for WARN events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the ERROR level. + + + true if this logger is enabled for ERROR events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + Checks if this logger is enabled for the FATAL level. + + + true if this logger is enabled for FATAL events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + A SecurityContext used by log4net when interacting with protected resources + + + + A SecurityContext used by log4net when interacting with protected resources + for example with operating system services. This can be used to impersonate + a principal that has been granted privileges on the system resources. + + + Nicko Cadell + + + + Impersonate this SecurityContext + + State supplied by the caller + An instance that will + revoke the impersonation of this SecurityContext, or null + + + Impersonate this security context. Further calls on the current + thread should now be made in the security context provided + by this object. When the result + method is called the security + context of the thread should be reverted to the state it was in + before was called. + + + + + + The providers default instances. + + + + A configured component that interacts with potentially protected system + resources uses a to provide the elevated + privileges required. If the object has + been not been explicitly provided to the component then the component + will request one from this . + + + By default the is + an instance of which returns only + objects. This is a reasonable default + where the privileges required are not know by the system. + + + This default behavior can be overridden by subclassing the + and overriding the method to return + the desired objects. The default provider + can be replaced by programmatically setting the value of the + property. + + + An alternative is to use the log4net.Config.SecurityContextProviderAttribute + This attribute can be applied to an assembly in the same way as the + log4net.Config.XmlConfiguratorAttribute". The attribute takes + the type to use as the as an argument. + + + Nicko Cadell + + + + The default provider + + + + + Protected default constructor to allow subclassing + + + + Protected default constructor to allow subclassing + + + + + + Create a SecurityContext for a consumer + + The consumer requesting the SecurityContext + An impersonation context + + + The default implementation is to return a . + + + Subclasses should override this method to provide their own + behavior. + + + + + + Gets or sets the default SecurityContextProvider + + + The default SecurityContextProvider + + + + The default provider is used by configured components that + require a and have not had one + given to them. + + + By default this is an instance of + that returns objects. + + + The default provider can be set programmatically by setting + the value of this property to a sub class of + that has the desired behavior. + + + + + + Delegate used to handle creation of new wrappers. + + The logger to wrap in a wrapper. + + + Delegate used to handle creation of new wrappers. This delegate + is called from the + method to construct the wrapper for the specified logger. + + + The delegate to use is supplied to the + constructor. + + + + + + Maps between logger objects and wrapper objects. + + + + This class maintains a mapping between objects and + objects. Use the method to + lookup the for the specified . + + + New wrapper instances are created by the + method. The default behavior is for this method to delegate construction + of the wrapper to the delegate supplied + to the constructor. This allows specialization of the behavior without + requiring subclassing of this type. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the + + The handler to use to create the wrapper objects. + + + Initializes a new instance of the class with + the specified handler to create the wrapper objects. + + + + + + Gets the wrapper object for the specified logger. + + The wrapper object for the specified logger + + + If the logger is null then the corresponding wrapper is null. + + + Looks up the wrapper it it has previously been requested and + returns it. If the wrapper has never been requested before then + the virtual method is + called. + + + + + + Creates the wrapper object for the specified logger. + + The logger to wrap in a wrapper. + The wrapper object for the logger. + + + This implementation uses the + passed to the constructor to create the wrapper. This method + can be overridden in a subclass. + + + + + + Called when a monitored repository shutdown event is received. + + The that is shutting down + + + This method is called when a that this + is holding loggers for has signaled its shutdown + event . The default + behavior of this method is to release the references to the loggers + and their wrappers generated for this repository. + + + + + + Event handler for repository shutdown event. + + The sender of the event. + The event args. + + + + Map of logger repositories to hashtables of ILogger to ILoggerWrapper mappings + + + + + The handler to use to create the extension wrapper objects. + + + + + Internal reference to the delegate used to register for repository shutdown events. + + + + + Gets the map of logger repositories. + + + Map of logger repositories. + + + + Gets the hashtable that is keyed on . The + values are hashtables keyed on with the + value being the corresponding . + + + + + + Formats a as "HH:mm:ss,fff". + + + + Formats a in the format "HH:mm:ss,fff" for example, "15:49:37,459". + + + Nicko Cadell + Gert Driesen + + + + Render a as a string. + + + + Interface to abstract the rendering of a + instance into a string. + + + The method is used to render the + date to a text writer. + + + Nicko Cadell + Gert Driesen + + + + Formats the specified date as a string. + + The date to format. + The writer to write to. + + + Format the as a string and write it + to the provided. + + + + + + String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is ABSOLUTE. + + + + + String constant used to specify DateTimeDateFormat in layouts. Current value is DATE. + + + + + String constant used to specify ISO8601DateFormat in layouts. Current value is ISO8601. + + + + + Renders the date into a string. Format is "HH:mm:ss". + + The date to render into a string. + The string builder to write to. + + + Subclasses should override this method to render the date + into a string using a precision up to the second. This method + will be called at most once per second and the result will be + reused if it is needed again during the same second. + + + + + + Renders the date into a string. Format is "HH:mm:ss,fff". + + The date to render into a string. + The writer to write to. + + + Uses the method to generate the + time string up to the seconds and then appends the current + milliseconds. The results from are + cached and is called at most once + per second. + + + Sub classes should override + rather than . + + + + + + Last stored time with precision up to the second. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Formats a as "dd MMM yyyy HH:mm:ss,fff" + + + + Formats a in the format + "dd MMM yyyy HH:mm:ss,fff" for example, + "06 Nov 1994 15:49:37,459". + + + Nicko Cadell + Gert Driesen + Angelika Schnagl + + + + Default constructor. + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats a DateTime in the format "dd MMM yyyy HH:mm:ss" + for example, "06 Nov 1994 15:49:37". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + The format info for the invariant culture. + + + + + Formats the as "yyyy-MM-dd HH:mm:ss,fff". + + + + Formats the specified as a string: "yyyy-MM-dd HH:mm:ss,fff". + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats the date specified as a string: "yyyy-MM-dd HH:mm:ss". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + Formats the using the method. + + + + Formats the using the method. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The format string. + + + Initializes a new instance of the class + with the specified format string. + + + The format string must be compatible with the options + that can be supplied to . + + + + + + Formats the date using . + + The date to convert to a string. + The writer to write to. + + + Uses the date format string supplied to the constructor to call + the method to format the date. + + + + + + The format string used to format the . + + + + The format string must be compatible with the options + that can be supplied to . + + + + + + This filter drops all . + + + + You can add this filter to the end of a filter chain to + switch from the default "accept all unless instructed otherwise" + filtering behavior to a "deny all unless instructed otherwise" + behavior. + + + Nicko Cadell + Gert Driesen + + + + Subclass this type to implement customized logging event filtering + + + + Users should extend this class to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface to provide customized logging event filtering + + + + Users should implement this interface to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Decide if the logging event should be logged through an appender. + + The LoggingEvent to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Points to the next filter in the filter chain. + + + + See for more information. + + + + + + Initialize the filter with the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Typically filter's options become active immediately on set, + however this method must still be called. + + + + + + Decide if the should be logged through an appender. + + The to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + This method is marked abstract and must be implemented + in a subclass. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Default constructor + + + + + Always returns the integer constant + + the LoggingEvent to filter + Always returns + + + Ignores the event being logged and just returns + . This can be used to change the default filter + chain behavior from to . This filter + should only be used as the last filter in the chain + as any further filters will be ignored! + + + + + + The return result from + + + + The return result from + + + + + + The log event must be dropped immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This filter is neutral with respect to the log event. + The remaining filters, if any, should be consulted for a final decision. + + + + + The log event must be logged immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This is a very simple filter based on matching. + + + + The filter admits two options and + . If there is an exact match between the value + of the option and the of the + , then the method returns in + case the option value is set + to true, if it is false then + is returned. If the does not match then + the result will be . + + + Nicko Cadell + Gert Driesen + + + + flag to indicate if the filter should on a match + + + + + the to match against + + + + + Default constructor + + + + + Tests if the of the logging event matches that of the filter + + the event to filter + see remarks + + + If the of the event matches the level of the + filter then the result of the function depends on the + value of . If it is true then + the function will return , it it is false then it + will return . If the does not match then + the result will be . + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + The level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + This is a simple filter based on matching. + + + + The filter admits three options and + that determine the range of priorities that are matched, and + . If there is a match between the range + of priorities and the of the , then the + method returns in case the + option value is set to true, if it is false + then is returned. If there is no match, is returned. + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when matching a + + + + + the minimum value to match + + + + + the maximum value to match + + + + + Default constructor + + + + + Check if the event should be logged. + + the logging event to check + see remarks + + + If the of the logging event is outside the range + matched by this filter then + is returned. If the is matched then the value of + is checked. If it is true then + is returned, otherwise + is returned. + + + + + + when matching and + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Set the minimum matched + + + + The minimum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Sets the maximum matched + + + + The maximum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a string in the event's logger name. + + + + The works very similar to the . It admits two + options and . If the + of the starts + with the value of the option, then the + method returns in + case the option value is set to true, + if it is false then is returned. + + + Daniel Cazzulino + + + + Flag to indicate the behavior when we have a match + + + + + The logger name string to substring match against the event + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the equals the beginning of + the incoming () + then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + This filter will attempt to match this value against logger name in + the following way. The match will be done against the beginning of the + logger name (using ). The match is + case sensitive. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a keyed string in the + + + + Simple filter to match a keyed string in the + + + As the MDC has been replaced with layered properties the + should be used instead. + + + Nicko Cadell + Gert Driesen + + + + Simple filter to match a string an event property + + + + Simple filter to match a string in the value for a + specific event property + + + Nicko Cadell + + + + Simple filter to match a string in the rendered message + + + + Simple filter to match a string in the rendered message + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when we have a match + + + + + The string to substring match against the message + + + + + A string regex to match + + + + + A regex object to match (generated from m_stringRegexToMatch) + + + + + Default constructor + + + + + Initialize and precompile the Regex if required + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the occurs as a substring within + the message then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching or + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Sets the static string to match + + + + The string that will be substring matched against + the rendered message. If the message contains this + string then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + Sets the regular expression to match + + + + The regular expression pattern that will be matched against + the rendered message. If the message matches this + pattern then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + The key to use to lookup the string from the event properties + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The event property for the is matched against + the . + If the occurs as a substring within + the property value then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + The key to lookup in the event properties and then match against. + + + + The key name to use to lookup in the properties map of the + . The match will be performed against + the value of this property if it exists. + + + + + + Simple filter to match a string in the + + + + Simple filter to match a string in the + + + As the MDC has been replaced with named stacks stored in the + properties collections the should + be used instead. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Sets the to "NDC". + + + + + + Write the event appdomain name to the output + + + + Writes the to the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + + Nicko Cadell + Gert Driesen + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Protected constructor + + + + Initializes a new instance of the class. + + + + + + Evaluate this pattern converter and write the output to a writer. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the appropriate way. + + + + + + Set the next pattern converter in the chains + + the pattern converter that should follow this converter in the chain + the next converter + + + The PatternConverter can merge with its neighbor during this method (or a sub class). + Therefore the return value may or may not be the value of the argument passed in. + + + + + + Write the pattern converter to the writer with appropriate formatting + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + This method calls to allow the subclass to perform + appropriate conversion of the pattern converter. If formatting options have + been specified via the then this method will + apply those formattings before writing the output. + + + + + + Fast space padding method. + + to which the spaces will be appended. + The number of spaces to be padded. + + + Fast space padding method. + + + + + + The option string to the converter + + + + + Write an dictionary to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the to a writer in the form: + + + {key1=value1, key2=value2, key3=value3} + + + If the specified + is not null then it is used to render the key and value to text, otherwise + the object's ToString method is called. + + + + + + Write an object to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the Object to a writer. If the specified + is not null then it is used to render the object to text, otherwise + the object's ToString method is called. + + + + + + Get the next pattern converter in the chain + + + the next pattern converter in the chain + + + + Get the next pattern converter in the chain + + + + + + Gets or sets the formatting info for this converter + + + The formatting info for this converter + + + + Gets or sets the formatting info for this converter + + + + + + Gets or sets the option value for this converter + + + The option for this converter + + + + Gets or sets the option value for this converter + + + + + + Initializes a new instance of the class. + + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The on which the pattern converter should be executed. + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + + Flag indicating if this converter handles exceptions + + + false if this converter handles exceptions + + + + + Flag indicating if this converter handles the logging event exception + + false if this converter handles the logging event exception + + + If this converter handles the exception object contained within + , then this property should be set to + false. Otherwise, if the layout ignores the exception + object, then the property should be set to true. + + + Set this value to override a this default setting. The default + value is true, this converter does not handle the exception. + + + + + + Write the event appdomain name to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output . + + + + + + Date pattern converter, uses a to format + the date of a . + + + + Render the to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,yyyy" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter pattern based on the property. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert the pattern into the rendered message + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone. + + + + + + Write the exception text to the output + + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + Nicko Cadell + + + + Default constructor + + + + + Write the exception text to the output + + that will receive the formatted result. + the event being logged + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + + + + Writes the caller location file name to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location file name to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Write the caller location info to the output + + + + Writes the to the output writer. + + + Nicko Cadell + + + + Write the caller location info to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output writer. + + + + + + Writes the event identity to the output + + + + Writes the value of the to + the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Writes the event identity to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the + to + the output . + + + + + + Write the event level to the output + + + + Writes the display name of the event + to the writer. + + + Nicko Cadell + + + + Write the event level to the output + + that will receive the formatted result. + the event being logged + + + Writes the of the + to the . + + + + + + Write the caller location line number to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location line number to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Converter for logger name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Converter to output and truncate '.' separated strings + + + + This abstract class supports truncating a '.' separated string + to show a specified number of elements from the right hand side. + This is used to truncate class names that are fully qualified. + + + Subclasses should override the method to + return the fully qualified string. + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Get the fully qualified string data + + the event being logged + the fully qualified name + + + Overridden by subclasses to get the fully qualified name before the + precision is applied to it. + + + Return the fully qualified '.' (dot/period) separated string. + + + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + Render the to the precision + specified by the property. + + + + + Gets the fully qualified name of the logger + + the event being logged + The fully qualified logger name + + + Returns the of the . + + + + + + Writes the event message to the output + + + + Uses the method + to write out the event message. + + + Nicko Cadell + + + + Writes the event message to the output + + that will receive the formatted result. + the event being logged + + + Uses the method + to write out the event message. + + + + + + Write the method name to the output + + + + Writes the caller location to + the output. + + + Nicko Cadell + + + + Write the method name to the output + + that will receive the formatted result. + the event being logged + + + Writes the caller location to + the output. + + + + + + Converter to include event NDC + + + + Outputs the value of the event property named NDC. + + + The should be used instead. + + + Nicko Cadell + + + + Write the event NDC to the output + + that will receive the formatted result. + the event being logged + + + As the thread context stacks are now stored in named event properties + this converter simply looks up the value of the NDC property. + + + The should be used instead. + + + + + + Property pattern converter + + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + the event being logged + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + Converter to output the relative time of the event + + + + Converter to output the time of the event relative to the start of the program. + + + Nicko Cadell + + + + Write the relative time to the output + + that will receive the formatted result. + the event being logged + + + Writes out the relative time of the event in milliseconds. + That is the number of milliseconds between the event + and the . + + + + + + Helper method to get the time difference between two DateTime objects + + start time (in the current local time zone) + end time (in the current local time zone) + the time difference in milliseconds + + + + Converter to include event thread name + + + + Writes the to the output. + + + Nicko Cadell + + + + Write the ThreadName to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the . + + + + + + Pattern converter for the class name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Gets the fully qualified name of the class + + the event being logged + The fully qualified type name for the caller location + + + Returns the of the . + + + + + + Converter to include event user name + + Douglas de la Torre + Nicko Cadell + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + + + Write the TimeStamp to the output + + + + Date pattern converter, uses a to format + the date of a . + + + Uses a to format the + in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the TimeStamp to the output + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone, this is converted + to Universal time before it is rendered. + + + + + + + A Layout that renders only the Exception text from the logging event + + + + A Layout that renders only the Exception text from the logging event. + + + This Layout should only be used with appenders that utilize multiple + layouts (e.g. ). + + + Nicko Cadell + Gert Driesen + + + + Extend this abstract class to create your own log layout format. + + + + This is the base implementation of the + interface. Most layout objects should extend this class. + + + + + + Subclasses must implement the + method. + + + Subclasses should set the in their default + constructor. + + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by layout objects + + + + An object is used to format a + as text. The method is called by an + appender to transform the into a string. + + + The layout can also supply and + text that is appender before any events and after all the events respectively. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text and output to a writer. + + + If the caller does not have a and prefers the + event to be formatted as a then the following + code can be used to format the event into a . + + + StringWriter writer = new StringWriter(); + Layout.Format(writer, loggingEvent); + string formattedEvent = writer.ToString(); + + + + + + The content type output by this layout. + + The content type + + + The content type output by this layout. + + + This is a MIME type e.g. "text/plain". + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handle exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + + + + The header text + + + + See for more information. + + + + + + The footer text + + + + See for more information. + + + + + + Flag indicating if this layout handles exceptions + + + + false if this layout handles exceptions + + + + + + Empty default constructor + + + + Empty default constructor + + + + + + Activate component options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This method must be implemented by the subclass. + + + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text. + + + + + + The content type output by this layout. + + The content type is "text/plain" + + + The content type output by this layout. + + + This base class uses the value "text/plain". + To change this value a subclass must override this + property. + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handles exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + Set this value to override a this default setting. The default + value is true, this layout does not handle the exception. + + + + + + Default constructor + + + + Constructs a ExceptionLayout + + + + + + Activate component options + + + + Part of the component activation + framework. + + + This method does nothing as options become effective immediately. + + + + + + Gets the exception text from the logging event + + The TextWriter to write the formatted event to + the event being logged + + + Write the exception string to the . + The exception string is retrieved from . + + + + + + Interface for raw layout objects + + + + Interface used to format a + to an object. + + + This interface should not be confused with the + interface. This interface is used in + only certain specialized situations where a raw object is + required rather than a formatted string. The + is not generally useful than this interface. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The event to format + returns the formatted event + + + Implement this method to create your own layout format. + + + + + + Adapts any to a + + + + Where an is required this adapter + allows a to be specified. + + + Nicko Cadell + Gert Driesen + + + + The layout to adapt + + + + + Construct a new adapter + + the layout to adapt + + + Create the adapter for the specified . + + + + + + Format the logging event as an object. + + The event to format + returns the formatted event + + + Format the logging event as an object. + + + Uses the object supplied to + the constructor to perform the formatting. + + + + + + A flexible layout configurable with pattern string. + + + + The goal of this class is to a + as a string. The results + depend on the conversion pattern. + + + The conversion pattern is closely related to the conversion + pattern of the printf function in C. A conversion pattern is + composed of literal text and format control expressions called + conversion specifiers. + + + You are free to insert any literal text within the conversion + pattern. + + + Each conversion specifier starts with a percent sign (%) and is + followed by optional format modifiers and a conversion + pattern name. The conversion pattern name specifies the type of + data, e.g. logger, level, date, thread name. The format + modifiers control such things as field width, padding, left and + right justification. The following is a simple example. + + + Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume + that the log4net environment was set to use a PatternLayout. Then the + statements + + + ILog log = LogManager.GetLogger(typeof(TestApp)); + log.Debug("Message 1"); + log.Warn("Message 2"); + + would yield the output + + DEBUG [main]: Message 1 + WARN [main]: Message 2 + + + Note that there is no explicit separator between text and + conversion specifiers. The pattern parser knows when it has reached + the end of a conversion specifier when it reads a conversion + character. In the example above the conversion specifier + %-5level means the level of the logging event should be left + justified to a width of five characters. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + a + Equivalent to appdomain + + + appdomain + + Used to output the friendly name of the AppDomain where the + logging event was generated. + + + + c + Equivalent to logger + + + C + Equivalent to type + + + class + Equivalent to type + + + d + Equivalent to date + + + date + + + Used to output the date of the logging event in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + exception + + + Used to output the exception passed in with the log message. + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + + + F + Equivalent to file + + + file + + + Used to output the file name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + WARNING Generating caller information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + l + Equivalent to location + + + L + Equivalent to line + + + location + + + Used to output location information of the caller which generated + the logging event. + + + The location information depends on the CLI implementation but + usually consists of the fully qualified name of the calling + method followed by the callers source the file name and line + number between parentheses. + + + The location information can be very useful. However, its + generation is extremely slow. Its use should be avoided + unless execution speed is not an issue. + + + See the note below on the availability of caller location information. + + + + + level + + + Used to output the level of the logging event. + + + + + line + + + Used to output the line number from where the logging request + was issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + logger + + + Used to output the logger of the logging event. The + logger conversion specifier can be optionally followed by + precision specifier, that is a decimal constant in + brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the logger name will be + printed. By default the logger name is printed in full. + + + For example, for the logger name "a.b.c" the pattern + %logger{2} will output "b.c". + + + + + m + Equivalent to message + + + M + Equivalent to method + + + message + + + Used to output the application supplied message associated with + the logging event. + + + + + mdc + + + The MDC (old name for the ThreadContext.Properties) is now part of the + combined event properties. This pattern is supported for compatibility + but is equivalent to property. + + + + + method + + + Used to output the method name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + n + Equivalent to newline + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + ndc + + + Used to output the NDC (nested diagnostic context) associated + with the thread that generated the logging event. + + + + + p + Equivalent to level + + + P + Equivalent to property + + + properties + Equivalent to property + + + property + + + Used to output the an event specific property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are added to events by loggers or appenders. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the event properties + + The event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + r + Equivalent to timestamp + + + t + Equivalent to thread + + + timestamp + + + Used to output the number of milliseconds elapsed since the start + of the application until the creation of the logging event. + + + + + thread + + + Used to output the name of the thread that generated the + logging event. Uses the thread number if no name is available. + + + + + type + + + Used to output the fully qualified type name of the caller + issuing the logging request. This conversion specifier + can be optionally followed by precision specifier, that + is a decimal constant in brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the class name will be + printed. By default the class name is output in fully qualified form. + + + For example, for the class name "log4net.Layout.PatternLayout", the + pattern %type{1} will output "PatternLayout". + + + WARNING Generating the caller class information is + slow. Thus, its use should be avoided unless execution speed is + not an issue. + + + See the note below on the availability of caller location information. + + + + + u + Equivalent to identity + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + WARNING Generating caller WindowsIdentity information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + w + Equivalent to username + + + x + Equivalent to ndc + + + X + Equivalent to mdc + + + % + + + The sequence %% outputs a single percent sign. + + + + + + The single letter patterns are deprecated in favor of the + longer more descriptive pattern names. + + + By default the relevant information is output as is. However, + with the aid of format modifiers it is possible to change the + minimum field width, the maximum field width and justification. + + + The optional format modifier is placed between the percent sign + and the conversion pattern name. + + + The first optional format modifier is the left justification + flag which is just the minus (-) character. Then comes the + optional minimum field width modifier. This is a decimal + constant that represents the minimum number of characters to + output. If the data item requires fewer characters, it is padded on + either the left or the right until the minimum width is + reached. The default is to pad on the left (right justify) but you + can specify right padding with the left justification flag. The + padding character is space. If the data item is larger than the + minimum field width, the field is expanded to accommodate the + data. The value is never truncated. + + + This behavior can be changed using the maximum field + width modifier which is designated by a period followed by a + decimal constant. If the data item is longer than the maximum + field, then the extra characters are removed from the + beginning of the data item and not from the end. For + example, it the maximum field width is eight and the data item is + ten characters long, then the first two characters of the data item + are dropped. This behavior deviates from the printf function in C + where truncation is done from the end. + + + Below are various format modifier examples for the logger + conversion specifier. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none + + Left pad with spaces if the logger name is less than 20 + characters long. + +
%-20loggertrue20none + + Right pad with spaces if the logger + name is less than 20 characters long. + +
%.30loggerNAnone30 + + Truncate from the beginning if the logger + name is longer than 30 characters. + +
%20.30loggerfalse2030 + + Left pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
%-20.30loggertrue2030 + + Right pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
+
+ + Note about caller location information.
+ The following patterns %type %file %line %method %location %class %C %F %L %l %M + all generate caller location information. + Location information uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. +
+ + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + + Additional pattern converters may be registered with a specific + instance using the method. + +
+ + This is a more detailed pattern. + %timestamp [%thread] %level %logger %ndc - %message%newline + + + A similar pattern except that the relative time is + right padded if less than 6 digits, thread name is right padded if + less than 15 characters and truncated if longer and the logger + name is left padded if shorter than 30 characters and truncated if + longer. + %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino +
+ + + Default pattern string for log output. + + + + Default pattern string for log output. + Currently set to the string "%message%newline" + which just prints the application supplied message. + + + + + + A detailed conversion pattern + + + + A conversion pattern which includes Time, Thread, Logger, and Nested Context. + Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. + + + + + + Internal map of converter identifiers to converter types. + + + + This static map is overridden by the m_converterRegistry instance map + + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternLayout only + + + + + Initialize the global registry + + + + Defines the builtin global rules. + + + + + + Constructs a PatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + As per the contract the + method must be called after the properties on this object have been + configured. + + + + + + Constructs a PatternLayout using the supplied conversion pattern + + the pattern to use + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + When using this constructor the method + need not be called. This may not be the case when using a subclass. + + + + + + Create the pattern parser instance + + the pattern to parse + The that will format the event + + + Creates the used to parse the conversion string. Sets the + global and instance rules on the . + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string as specified by the conversion pattern. + + the event being logged + The TextWriter to write the formatted event to + + + Parse the using the patter format + specified in the property. + + + + + + Add a converter to this PatternLayout + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternLayout + + the name of the conversion pattern for this converter + the type of the converter + + + Add a named pattern converter to this instance. This + converter will be used in the formatting of the event. + This method must be called before . + + + The specified must extend the + type. + + + + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + Wrapper class used to map converter names to converter types + + + + Pattern converter info class used during configuration to + pass to the + method. + + + + + + default constructor + + + + + Gets or sets the name of the conversion pattern + + + + The name of the pattern in the format string + + + + + + Gets or sets the type of the converter + + + + The value specified must extend the + type. + + + + + + Type converter for the interface + + + + Used to convert objects to the interface. + Supports converting from the interface to + the interface using the . + + + Nicko Cadell + Gert Driesen + + + + Interface supported by type converters + + + + This interface supports conversion from arbitrary types + to a single target type. See . + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Test if the can be converted to the + type supported by this converter. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Converts the to the type supported + by this converter. + + + + + + Can the sourceType be converted to an + + the source to be to be converted + true if the source type can be converted to + + + Test if the can be converted to a + . Only is supported + as the . + + + + + + Convert the value to a object + + the value to convert + the object + + + Convert the object to a + object. If the object + is a then the + is used to adapt between the two interfaces, otherwise an + exception is thrown. + + + + + + Extract the value of a property from the + + + + Extract the value of a property from the + + + Nicko Cadell + + + + Constructs a RawPropertyLayout + + + + + Lookup the property for + + The event to format + returns property value + + + Looks up and returns the object value of the property + named . If there is no property defined + with than name then null will be returned. + + + + + + The name of the value to lookup in the LoggingEvent Properties collection. + + + Value to lookup in the LoggingEvent Properties collection + + + + String name of the property to lookup in the . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in local time. To format the time stamp + in universal time use . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawUtcTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in universal time. To format the time stamp + in local time use . + + + + + + A very simple layout + + + + SimpleLayout consists of the level of the log statement, + followed by " - " and then the log message itself. For example, + + DEBUG - Hello world + + + + Nicko Cadell + Gert Driesen + + + + Constructs a SimpleLayout + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a simple formatted output. + + the event being logged + The TextWriter to write the formatted event to + + + Formats the event as the level of the even, + followed by " - " and then the log message itself. The + output is terminated by a newline. + + + + + + Layout that formats the log events as XML elements. + + + + The output of the consists of a series of + log4net:event elements. It does not output a complete well-formed XML + file. The output is designed to be included as an external entity + in a separate file to form a correct XML file. + + + For example, if abc is the name of the file where + the output goes, then a well-formed XML file would + be: + + + <?xml version="1.0" ?> + + <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> + + <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> + &data; + </log4net:events> + + + This approach enforces the independence of the + and the appender where it is embedded. + + + The version attribute helps components to correctly + interpret output generated by . The value of + this attribute should be "1.2" for release 1.2 and later. + + + Alternatively the Header and Footer properties can be + configured to output the correct XML header, open tag and close tag. + When setting the Header and Footer properties it is essential + that the underlying data store not be appendable otherwise the data + will become invalid XML. + + + Nicko Cadell + Gert Driesen + + + + Layout that formats the log events as XML elements. + + + + This is an abstract class that must be subclassed by an implementation + to conform to a specific schema. + + + Deriving classes must implement the method. + + + Nicko Cadell + Gert Driesen + + + + Protected constructor to support subclasses + + + + Initializes a new instance of the class + with no location info. + + + + + + Protected constructor to support subclasses + + + + The parameter determines whether + location information will be output by the layout. If + is set to true, then the + file name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string. + + The event being logged. + The TextWriter to write the formatted event to + + + Format the and write it to the . + + + This method creates an that writes to the + . The is passed + to the method. Subclasses should override the + method rather than this method. + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Subclasses should override this method to format + the as XML. + + + + + + Flag to indicate if location information should be included in + the XML events. + + + + + Writer adapter that ignores Close + + + + + The string to replace invalid chars with + + + + + Gets a value indicating whether to include location information in + the XML events. + + + true if location information should be included in the XML + events; otherwise, false. + + + + If is set to true, then the file + name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + The string to replace characters that can not be expressed in XML with. + + + Not all characters may be expressed in XML. This property contains the + string to replace those that can not with. This defaults to a ?. Set it + to the empty string to simply remove offending characters. For more + details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets + Character replacement will occur in the log message, the property names + and the property values. + + + + + + + Gets the content type output by this layout. + + + As this is the XML layout, the value is always "text/xml". + + + + As this is the XML layout, the value is always "text/xml". + + + + + + Constructs an XmlLayout + + + + + Constructs an XmlLayout. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SmtpAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Builds a cache of the element names + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Override the base class method + to write the to the . + + + + + + The prefix to use for all generated element names + + + + + The prefix to use for all element names + + + + The default prefix is log4net. Set this property + to change the prefix. If the prefix is set to an empty string + then no prefix will be written. + + + + + + Set whether or not to base64 encode the message. + + + + By default the log message will be written as text to the xml + output. This can cause problems when the message contains binary + data. By setting this to true the contents of the message will be + base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the log message. + + + + + + Set whether or not to base64 encode the property values. + + + + By default the properties will be written as text to the xml + output. This can cause problems when one or more properties contain + binary data. By setting this to true the values of the properties + will be base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the property values. + + + + + + Layout that formats the log events as XML elements compatible with the log4j schema + + + + Formats the log events according to the http://logging.apache.org/log4j schema. + + + Nicko Cadell + + + + The 1st of January 1970 in UTC + + + + + Constructs an XMLLayoutSchemaLog4j + + + + + Constructs an XMLLayoutSchemaLog4j. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Actually do the writing of the xml + + the writer to use + the event to write + + + Generate XML that is compatible with the log4j schema. + + + + + + The version of the log4j schema to use. + + + + Only version 1.2 of the log4j schema is supported. + + + + + + The default object Renderer. + + + + The default renderer supports rendering objects and collections to strings. + + + See the method for details of the output. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface in order to render objects as strings + + + + Certain types require special case conversion to + string form. This conversion is done by an object renderer. + Object renderers implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a + string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + + + + Default constructor + + + + Default constructor + + + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + The default renderer supports rendering objects to strings as follows: + + + + Value + Rendered String + + + null + + "(null)" + + + + + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + , & + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: {a, b, c}. + + + All collection classes that implement its subclasses, + or generic equivalents all implement the interface. + + + + + + + + Rendered as the key, an equals sign ('='), and the value (using the appropriate + renderer). + + + For example: key=value. + + + + + other + + Object.ToString() + + + + + + + + Render the array argument into a string + + The map used to lookup renderers + the array to render + The writer to render to + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + + Render the enumerator argument into a string + + The map used to lookup renderers + the enumerator to render + The writer to render to + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + {a, b, c}. + + + + + + Render the DictionaryEntry argument into a string + + The map used to lookup renderers + the DictionaryEntry to render + The writer to render to + + + Render the key, an equals sign ('='), and the value (using the appropriate + renderer). For example: key=value. + + + + + + Map class objects to an . + + + + Maintains a mapping between types that require special + rendering and the that + is used to render them. + + + The method is used to render an + object using the appropriate renderers defined in this map. + + + Nicko Cadell + Gert Driesen + + + + Default Constructor + + + + Default constructor. + + + + + + Render using the appropriate renderer. + + the object to render to a string + the object rendered as a string + + + This is a convenience method used to render an object to a string. + The alternative method + should be used when streaming output to a . + + + + + + Render using the appropriate renderer. + + the object to render to a string + The writer to render to + + + Find the appropriate renderer for the type of the + parameter. This is accomplished by calling the + method. Once a renderer is found, it is + applied on the object and the result is returned + as a . + + + + + + Gets the renderer for the specified object type + + the object to lookup the renderer for + the renderer for + + + Gets the renderer for the specified object type. + + + Syntactic sugar method that calls + with the type of the object parameter. + + + + + + Gets the renderer for the specified type + + the type to lookup the renderer for + the renderer for the specified type + + + Returns the renderer for the specified type. + If no specific renderer has been defined the + will be returned. + + + + + + Internal function to recursively search interfaces + + the type to lookup the renderer for + the renderer for the specified type + + + + Clear the map of renderers + + + + Clear the custom renderers defined by using + . The + cannot be removed. + + + + + + Register an for . + + the type that will be rendered by + the renderer for + + + Register an object renderer for a specific source type. + This renderer will be returned from a call to + specifying the same as an argument. + + + + + + Get the default renderer instance + + the default renderer + + + Get the default renderer + + + + + + Interface implemented by logger repository plugins. + + + + Plugins define additional behavior that can be associated + with a . + The held by the + property is used to store the plugins for a repository. + + + The log4net.Config.PluginAttribute can be used to + attach plugins to repositories created using configuration + attributes. + + + Nicko Cadell + Gert Driesen + + + + Attaches the plugin to the specified . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + Gets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a PluginCollection instance. + + list to create a readonly wrapper arround + + A PluginCollection wrapper that is read-only. + + + + + Initializes a new instance of the PluginCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the PluginCollection class + that has the specified initial capacity. + + + The number of elements that the new PluginCollection is initially capable of storing. + + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified PluginCollection. + + The PluginCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire PluginCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire PluginCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the PluginCollection. + + The to be added to the end of the PluginCollection. + The index at which the value has been added. + + + + Removes all elements from the PluginCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the PluginCollection. + + The to check for. + true if is found in the PluginCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the PluginCollection. + + The to locate in the PluginCollection. + + The zero-based index of the first occurrence of + in the entire PluginCollection, if found; otherwise, -1. + + + + + Inserts an element into the PluginCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the PluginCollection. + + The to remove from the PluginCollection. + + The specified was not found in the PluginCollection. + + + + + Removes the element at the specified index of the PluginCollection. + + The zero-based index of the element to remove. + + is less than zero. + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the PluginCollection. + + An for the entire PluginCollection. + + + + Adds the elements of another PluginCollection to the current PluginCollection. + + The PluginCollection whose elements should be added to the end of the current PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a array to the current PluginCollection. + + The array whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a collection to the current PluginCollection. + + The collection whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the PluginCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + An object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + + The at the specified index. + + The zero-based index of the element to get or set. + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false. + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false. + + + + Gets or sets the number of elements the PluginCollection can contain. + + + The number of elements the PluginCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + The current element in the collection. + + + + + + + + Map of repository plugins. + + + + This class is a name keyed map of the plugins that are + attached to a repository. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The repository that the plugins should be attached to. + + + Initialize a new instance of the class with a + repository that the plugins should be attached to. + + + + + + Adds a to the map. + + The to add to the map. + + + The will be attached to the repository when added. + + + If there already exists a plugin with the same name + attached to the repository then the old plugin will + be and replaced with + the new plugin. + + + + + + Removes a from the map. + + The to remove from the map. + + + Remove a specific plugin from this map. + + + + + + Gets a by name. + + The name of the to lookup. + + The from the map with the name specified, or + null if no plugin is found. + + + + Lookup a plugin by name. If the plugin is not found null + will be returned. + + + + + + Gets all possible plugins as a list of objects. + + All possible plugins as a list of objects. + + + Get a collection of all the plugins defined in this map. + + + + + + Base implementation of + + + + Default abstract implementation of the + interface. This base class can be used by implementors + of the interface. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + the name of the plugin + + Initializes a new Plugin with the specified name. + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + The name of this plugin. + + + + + The repository this plugin is attached to. + + + + + Gets or sets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + The name of the plugin must not change one the + plugin has been attached to a repository. + + + + + + The repository for this plugin + + + The that this plugin is attached to. + + + + Gets or sets the that this plugin is + attached to. + + + + + + Plugin that listens for events from the + + + + This plugin publishes an instance of + on a specified . This listens for logging events delivered from + a remote . + + + When an event is received it is relogged within the attached repository + as if it had been raised locally. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + The property must be set. + + + + + + Construct with sink Uri. + + The name to publish the sink under in the remoting infrastructure. + See for more details. + + + Initializes a new instance of the class + with specified name. + + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + When the plugin is shutdown the remote logging + sink is disconnected. + + + + + + Gets or sets the URI of this sink. + + + The URI of this sink. + + + + This is the name under which the object is marshaled. + + + + + + + Delivers objects to a remote sink. + + + + Internal class used to listen for logging events + and deliver them to the local repository. + + + + + + Constructor + + The repository to log to. + + + Initializes a new instance of the for the + specified . + + + + + + Logs the events to the repository. + + The events to log. + + + The events passed are logged to the + + + + + + Obtains a lifetime service object to control the lifetime + policy for this instance. + + null to indicate that this instance should live forever. + + + Obtains a lifetime service object to control the lifetime + policy for this instance. This object should live forever + therefore this implementation returns null. + + + + + + The underlying that events should + be logged to. + + + + + Default implementation of + + + + This default implementation of the + interface is used to create the default subclass + of the object. + + + Nicko Cadell + Gert Driesen + + + + Interface abstracts creation of instances + + + + This interface is used by the to + create new objects. + + + The method is called + to create a named . + + + Implement this interface to create new subclasses of . + + + Nicko Cadell + Gert Driesen + + + + Create a new instance + + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Create a new instance + + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default internal subclass of + + + + This subclass has no additional behavior over the + class but does allow instances + to be created. + + + + + + Implementation of used by + + + + Internal class used to provide implementation of + interface. Applications should use to get + logger instances. + + + This is one of the central classes in the log4net implementation. One of the + distinctive features of log4net are hierarchical loggers and their + evaluation. The organizes the + instances into a rooted tree hierarchy. + + + The class is abstract. Only concrete subclasses of + can be created. The + is used to create instances of this type for the . + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + + + + This constructor created a new instance and + sets its name. + + The name of the . + + + This constructor is protected and designed to be used by + a subclass that is not abstract. + + + Loggers are constructed by + objects. See for the default + logger creator. + + + + + + Add to the list of appenders of this + Logger instance. + + An appender to add to this logger + + + Add to the list of appenders of this + Logger instance. + + + If is already in the list of + appenders, then it won't be added again. + + + + + + Look for the appender named as name + + The name of the appender to lookup + The appender with the name specified, or null. + + + Returns the named appender, or null if the appender is not found. + + + + + + Remove all previously added appenders from this Logger instance. + + + + Remove all previously added appenders from this Logger instance. + + + This is useful when re-reading configuration information. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The appender to remove + The appender removed from the list + + + Remove the appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The name of the appender to remove + The appender removed from the list + + + Remove the named appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the and . + + + This method must not throw any exception to the caller. + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + This method must not throw any exception to the caller. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + This method must not throw any exception to the caller. + + + + + + Deliver the to the attached appenders. + + The event to log. + + + Call the appenders in the hierarchy starting at + this. If no appenders could be found, emit a + warning. + + + This method calls all the appenders inherited from the + hierarchy circumventing any evaluation of whether to log or not + to log the particular log request. + + + + + + Closes all attached appenders implementing the interface. + + + + Used to ensure that the appenders are correctly shutdown. + + + + + + This is the most generic printing method. This generic form is intended to be used by wrappers + + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the . + + + + + + Creates a new logging event and logs the event without further checks. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generates a logging event and delivers it to the attached + appenders. + + + + + + Creates a new logging event and logs the event without further checks. + + The event being logged. + + + Delivers the logging event to the attached appenders. + + + + + + The fully qualified type of the Logger class. + + + + + The name of this logger. + + + + + The assigned level of this logger. + + + + The level variable need not be + assigned a value in which case it is inherited + form the hierarchy. + + + + + + The parent of this logger. + + + + The parent of this logger. + All loggers have at least one ancestor which is the root logger. + + + + + + Loggers need to know what Hierarchy they are in. + + + + Loggers need to know what Hierarchy they are in. + The hierarchy that this logger is a member of is stored + here. + + + + + + Helper implementation of the interface + + + + + Flag indicating if child loggers inherit their parents appenders + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl + + + + + Gets or sets the parent logger in the hierarchy. + + + The parent logger in the hierarchy. + + + + Part of the Composite pattern that makes the hierarchy. + The hierarchy is parent linked rather than child linked. + + + + + + Gets or sets a value indicating if child loggers inherit their parent's appenders. + + + true if child loggers inherit their parent's appenders. + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Gets the effective level for this logger. + + The nearest level in the logger hierarchy. + + + Starting from this logger, searches the logger hierarchy for a + non-null level and returns it. Otherwise, returns the level of the + root logger. + + The Logger class is designed so that this method executes as + quickly as possible. + + + + + Gets or sets the where this + Logger instance is attached to. + + The hierarchy that this logger belongs to. + + + This logger must be attached to a single . + + + + + + Gets or sets the assigned , if any, for this Logger. + + + The of this logger. + + + + The assigned can be null. + + + + + + Get the appenders contained in this logger as an + . + + A collection of the appenders in this logger + + + Get the appenders contained in this logger as an + . If no appenders + can be found, then a is returned. + + + + + + Gets the logger name. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Construct a new Logger + + the name of the logger + + + Initializes a new instance of the class + with the specified name. + + + + + + Delegate used to handle logger creation event notifications. + + The in which the has been created. + The event args that hold the instance that has been created. + + + Delegate used to handle logger creation event notifications. + + + + + + Provides data for the event. + + + + A event is raised every time a + is created. + + + + + + The created + + + + + Constructor + + The that has been created. + + + Initializes a new instance of the event argument + class,with the specified . + + + + + + Gets the that has been created. + + + The that has been created. + + + + The that has been created. + + + + + + Hierarchical organization of loggers + + + + The casual user should not have to deal with this class + directly. + + + This class is specialized in retrieving loggers by name and + also maintaining the logger hierarchy. Implements the + interface. + + + The structure of the logger hierarchy is maintained by the + method. The hierarchy is such that children + link to their parent but parents do not have any references to their + children. Moreover, loggers can be instantiated in any order, in + particular descendant before ancestor. + + + In case a descendant is created before a particular ancestor, + then it creates a provision node for the ancestor and adds itself + to the provision node. Other descendants of the same ancestor add + themselves to the previously created provision node. + + + Nicko Cadell + Gert Driesen + + + + Base implementation of + + + + Default abstract implementation of the interface. + + + Skeleton implementation of the interface. + All types can extend this type. + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by logger repositories. + + + + This interface is implemented by logger repositories. e.g. + . + + + This interface is used by the + to obtain interfaces. + + + Nicko Cadell + Gert Driesen + + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + The name of the logger to lookup + The Logger object with the name specified + + + If the names logger exists it is returned, otherwise + null is returned. + + + + + + Returns all the currently defined loggers as an Array. + + All the defined loggers + + + Returns all the currently defined loggers as an Array. + + + + + + Returns a named logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Returns a named logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + Shutdown the repository + + + Shutting down a repository will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + The name of the repository + + + The name of the repository + + + + The name of the repository. + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + + These properties can be specified on a repository specific basis. + + + + + + Default Constructor + + + + Initializes the repository with default (empty) properties. + + + + + + Construct the repository using specific properties + + the properties to set for this repository + + + Initializes the repository with specified properties. + + + + + + Test if logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the repository + + All the defined loggers + + + Returns all the currently defined loggers in the repository as an Array. + + + + + + Return a new logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Return a new logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + + Shutdown the repository + + + + Shutdown the repository. Can be overridden in a subclass. + This base class implementation notifies the + listeners and all attached plugins of the shutdown event. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + Adds an object renderer for a specific class. + + The type that will be rendered by the renderer supplied. + The object renderer used to render the object. + + + Adds an object renderer for a specific class. + + + + + + Notify the registered listeners that the repository is shutting down + + Empty EventArgs + + + Notify any listeners that this repository is shutting down. + + + + + + Notify the registered listeners that the repository has had its configuration reset + + Empty EventArgs + + + Notify any listeners that this repository's configuration has been reset. + + + + + + Notify the registered listeners that the repository has had its configuration changed + + Empty EventArgs + + + Notify any listeners that this repository's configuration has changed. + + + + + + Raise a configuration changed event on this repository + + EventArgs.Empty + + + Applications that programmatically change the configuration of the repository should + raise this event notification to notify listeners. + + + + + + The name of the repository + + + The string name of the repository + + + + The name of this repository. The name is + used to store and lookup the repositories + stored by the . + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + These properties can be specified on a repository specific basis + + + + + Basic Configurator interface for repositories + + + + Interface used by basic configurator to configure a + with a default . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified appender + + the appender to use to log all logging events + + + Configure the repository to route all logging events to the + specified appender. + + + + + + Configure repository using XML + + + + Interface used by Xml configurator to configure a . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified config + + the element containing the root of the config + + + The schema for the XML configuration data is defined by + the implementation. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Construct with properties + + The properties to pass to this repository. + + + Initializes a new instance of the class. + + + + + + Construct with a logger factory + + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Construct with properties and a logger factory + + The properties to pass to this repository. + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Test if a logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the hierarchy. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the hierarchy as an Array + + All the defined loggers + + + Returns all the currently defined loggers in the hierarchy as an Array. + The root logger is not included in the returned + enumeration. + + + + + + Return a new logger instance named as the first parameter using + the default factory. + + + + Return a new logger instance named as the first parameter using + the default factory. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + The name of the logger to retrieve + The logger object with the name specified + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The Shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset all values contained in this hierarchy instance to their default. + + + + Reset all values contained in this hierarchy instance to their + default. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this hierarchy. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are currently configured + + An array containing all the currently configured appenders + + + Returns all the instances that are currently configured. + All the loggers are searched for appenders. The appenders may also be containers + for appenders and these are also searched for additional loggers. + + + The list returned is unordered but does not contain duplicates. + + + + + + Collect the appenders from an . + The appender may also be a container. + + + + + + + Collect the appenders from an container + + + + + + + Initialize the log4net system using the specified appender + + the appender to use to log all logging events + + + + Initialize the log4net system using the specified appender + + the appender to use to log all logging events + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Test if this hierarchy is disabled for the specified . + + The level to check against. + + true if the repository is disabled for the level argument, false otherwise. + + + + If this hierarchy has not been configured then this method will + always return true. + + + This method will return true if this repository is + disabled for level object passed as parameter and + false otherwise. + + + See also the property. + + + + + + Clear all logger definitions from the internal hashtable + + + + This call will clear all logger definitions from the internal + hashtable. Invoking this method will irrevocably mess up the + logger hierarchy. + + + You should really know what you are doing before + invoking this method. + + + + + + Return a new logger instance named as the first parameter using + . + + The name of the logger to retrieve + The factory that will make the new logger instance + The logger object with the name specified + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated by the + parameter and linked with its existing + ancestors as well as children. + + + + + + Sends a logger creation event to all registered listeners + + The newly created logger + + Raises the logger creation event. + + + + + Updates all the parents of the specified logger + + The logger to update the parents for + + + This method loops through all the potential parents of + . There 3 possible cases: + + + + No entry for the potential parent of exists + + We create a ProvisionNode for this potential + parent and insert in that provision node. + + + + The entry is of type Logger for the potential parent. + + The entry is 's nearest existing parent. We + update 's parent field with this entry. We also break from + he loop because updating our parent's parent is our parent's + responsibility. + + + + The entry is of type ProvisionNode for this potential parent. + + We add to the list of children for this + potential parent. + + + + + + + + Replace a with a in the hierarchy. + + + + + + We update the links for all the children that placed themselves + in the provision node 'pn'. The second argument 'log' is a + reference for the newly created Logger, parent of all the + children in 'pn'. + + + We loop on all the children 'c' in 'pn'. + + + If the child 'c' has been already linked to a child of + 'log' then there is no need to update 'c'. + + + Otherwise, we set log's parent field to c's parent and set + c's parent field to log. + + + + + + Define or redefine a Level using the values in the argument + + the level values + + + Define or redefine a Level using the values in the argument + + + Supports setting levels via the configuration file. + + + + + + Set a Property using the values in the argument + + the property value + + + Set a Property using the values in the argument. + + + Supports setting property values via the configuration file. + + + + + + Event used to notify that a logger has been created. + + + + Event raised when a logger is created. + + + + + + Has no appender warning been emitted + + + + Flag to indicate if we have already issued a warning + about not having an appender warning. + + + + + + Get the root of this hierarchy + + + + Get the root of this hierarchy. + + + + + + Gets or sets the default instance. + + The default + + + The logger factory is used to create logger instances. + + + + + + A class to hold the value, name and display name for a level + + + + A class to hold the value, name and display name for a level + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Value of the level + + + + If the value is not set (defaults to -1) the value will be looked + up for the current level with the same name. + + + + + + Name of the level + + + The name of the level + + + + The name of the level. + + + + + + Display name for the level + + + The display name of the level + + + + The display name of the level. + + + + + + A class to hold the key and data for a property set in the config file + + + + A class to hold the key and data for a property set in the config file + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Property Key + + + Property Key + + + + Property Key. + + + + + + Property Value + + + Property Value + + + + Property Value. + + + + + + Used internally to accelerate hash table searches. + + + + Internal class used to improve performance of + string keyed hashtables. + + + The hashcode of the string is cached for reuse. + The string is stored as an interned value. + When comparing two objects for equality + the reference equality of the interned strings is compared. + + + Nicko Cadell + Gert Driesen + + + + Construct key with string name + + + + Initializes a new instance of the class + with the specified name. + + + Stores the hashcode of the string and interns + the string key to optimize comparisons. + + + The Compact Framework 1.0 the + method does not work. On the Compact Framework + the string keys are not interned nor are they + compared by reference. + + + The name of the logger. + + + + Returns a hash code for the current instance. + + A hash code for the current instance. + + + Returns the cached hashcode. + + + + + + Determines whether two instances + are equal. + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + + Compares the references of the interned strings. + + + + + + Provision nodes are used where no logger instance has been specified + + + + instances are used in the + when there is no specified + for that node. + + + A provision node holds a list of child loggers on behalf of + a logger that does not exist. + + + Nicko Cadell + Gert Driesen + + + + Create a new provision node with child node + + A child logger to add to this node. + + + Initializes a new instance of the class + with the specified child logger. + + + + + + The sits at the root of the logger hierarchy tree. + + + + The is a regular except + that it provides several guarantees. + + + First, it cannot be assigned a null + level. Second, since the root logger cannot have a parent, the + property always returns the value of the + level field without walking the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Construct a + + The level to assign to the root logger. + + + Initializes a new instance of the class with + the specified logging level. + + + The root logger names itself as "root". However, the root + logger cannot be retrieved by name. + + + + + + Gets the assigned level value without walking the logger hierarchy. + + The assigned level value without walking the logger hierarchy. + + + Because the root logger cannot have a parent and its level + must not be null this property just returns the + value of . + + + + + + Gets or sets the assigned for the root logger. + + + The of the root logger. + + + + Setting the level of the root logger to a null reference + may have catastrophic results. We prevent this here. + + + + + + Initializes the log4net environment using an XML DOM. + + + + Configures a using an XML DOM. + + + Nicko Cadell + Gert Driesen + + + + Construct the configurator for a hierarchy + + The hierarchy to build. + + + Initializes a new instance of the class + with the specified . + + + + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + The root element to parse. + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + + + + + Parse appenders by IDREF. + + The appender ref element. + The instance of the appender that the ref refers to. + + + Parse an XML element that represents an appender and return + the appender. + + + + + + Parses an appender element. + + The appender element. + The appender instance or null when parsing failed. + + + Parse an XML element that represents an appender and return + the appender instance. + + + + + + Parses a logger element. + + The logger element. + + + Parse an XML element that represents a logger. + + + + + + Parses the root logger element. + + The root element. + + + Parse an XML element that represents the root logger. + + + + + + Parses the children of a logger element. + + The category element. + The logger instance. + Flag to indicate if the logger is the root logger. + + + Parse the child elements of a <logger> element. + + + + + + Parses an object renderer. + + The renderer element. + + + Parse an XML element that represents a renderer. + + + + + + Parses a level element. + + The level element. + The logger object to set the level on. + Flag to indicate if the logger is the root logger. + + + Parse an XML element that represents a level. + + + + + + Sets a parameter on an object. + + The parameter element. + The object to set the parameter on. + + The parameter name must correspond to a writable property + on the object. The value of the parameter is a string, + therefore this function will attempt to set a string + property first. If unable to set a string property it + will inspect the property and its argument type. It will + attempt to call a static method called Parse on the + type of the property. This method will take a single + string argument and return a value that can be used to + set the property. + + + + + Test if an element has no attributes or child elements + + the element to inspect + true if the element has any attributes or child elements, false otherwise + + + + Test if a is constructible with Activator.CreateInstance. + + the type to inspect + true if the type is creatable using a default constructor, false otherwise + + + + Look for a method on the that matches the supplied + + the type that has the method + the name of the method + the method info found + + + The method must be a public instance method on the . + The method must be named or "Add" followed by . + The method must take a single parameter. + + + + + + Converts a string value to a target type. + + The type of object to convert the string to. + The string value to use as the value of the object. + + + An object of type with value or + null when the conversion could not be performed. + + + + + + Creates an object as specified in XML. + + The XML element that contains the definition of the object. + The object type to use if not explicitly specified. + The type that the returned object must be or must inherit from. + The object or null + + + Parse an XML element and create an object instance based on the configuration + data. + + + The type of the instance may be specified in the XML. If not + specified then the is used + as the type. However the type is specified it must support the + type. + + + + + + key: appenderName, value: appender. + + + + + The Hierarchy being configured. + + + + + Delegate used to handle logger repository shutdown event notifications + + The that is shutting down. + Empty event args + + + Delegate used to handle logger repository shutdown event notifications. + + + + + + Delegate used to handle logger repository configuration reset event notifications + + The that has had its configuration reset. + Empty event args + + + Delegate used to handle logger repository configuration reset event notifications. + + + + + + Delegate used to handle event notifications for logger repository configuration changes. + + The that has had its configuration changed. + Empty event arguments. + + + Delegate used to handle event notifications for logger repository configuration changes. + + + + + + Write the name of the current AppDomain to the output + + + + Write the name of the current AppDomain to the output writer + + + Nicko Cadell + + + + Write the name of the current AppDomain to the output + + the writer to write to + null, state is not set + + + Writes name of the current AppDomain to the output . + + + + + + Write the current date to the output + + + + Date pattern converter, uses a to format + the current date and time to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The date and time is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current date to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date and time passed is in the local time zone. + + + + + + Write an environment variable to the output + + + + Write an environment variable to the output writer. + The value of the determines + the name of the variable to output. + + + Nicko Cadell + + + + Write an environment variable to the output + + the writer to write to + null, state is not set + + + Writes the environment variable to the output . + The name of the environment variable to output must be set + using the + property. + + + + + + Write the current thread identity to the output + + + + Write the current thread identity to the output writer + + + Nicko Cadell + + + + Write the current thread identity to the output + + the writer to write to + null, state is not set + + + Writes the current thread identity to the output . + + + + + + Pattern converter for literal string instances in the pattern + + + + Writes the literal string value specified in the + property to + the output. + + + Nicko Cadell + + + + Set the next converter in the chain + + The next pattern converter in the chain + The next pattern converter + + + Special case the building of the pattern converter chain + for instances. Two adjacent + literals in the pattern can be represented by a single combined + pattern converter. This implementation detects when a + is added to the chain + after this converter and combines its value with this converter's + literal value. + + + + + + Write the literal to the output + + the writer to write to + null, not set + + + Override the formatting behavior to ignore the FormattingInfo + because we have a literal instead. + + + Writes the value of + to the output . + + + + + + Convert this pattern into the rendered message + + that will receive the formatted result. + null, not set + + + This method is not used. + + + + + + Writes a newline to the output + + + + Writes the system dependent line terminator to the output. + This behavior can be overridden by setting the : + + + + Option Value + Output + + + DOS + DOS or Windows line terminator "\r\n" + + + UNIX + UNIX line terminator "\n" + + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current process ID to the output + + + + Write the current process ID to the output writer + + + Nicko Cadell + + + + Write the current process ID to the output + + the writer to write to + null, state is not set + + + Write the current process ID to the output . + + + + + + Property pattern converter + + + + This pattern converter reads the thread and global properties. + The thread properties take priority over global properties. + See for details of the + thread properties. See for + details of the global properties. + + + If the is specified then that will be used to + lookup a single property. If no is specified + then all properties will be dumped as a list of key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + null, state is not set + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + A Pattern converter that generates a string of random characters + + + + The converter generates a string of random characters. By default + the string is length 4. This can be changed by setting the + to the string value of the length required. + + + The random characters in the string are limited to uppercase letters + and numbers only. + + + The random number generator used by this class is not cryptographically secure. + + + Nicko Cadell + + + + Shared random number generator + + + + + Length of random string to generate. Default length 4. + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write a randoim string to the output + + the writer to write to + null, state is not set + + + Write a randoim string to the output . + + + + + + Write the current threads username to the output + + + + Write the current threads username to the output writer + + + Nicko Cadell + + + + Write the current threads username to the output + + the writer to write to + null, state is not set + + + Write the current threads username to the output . + + + + + + Write the UTC date time to the output + + + + Date pattern converter, uses a to format + the current date and time in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the current date and time to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date is in Universal time when it is rendered. + + + + + + + Type converter for Boolean. + + + + Supports conversion from string to bool type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Exception base type for conversion errors. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class + with the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + An instance of the . + + + Creates a new instance of the class. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + A nested exception to include. + An instance of the . + + + Creates a new instance of the class. + + + + + + Register of type converters for specific types. + + + + Maintains a registry of type converters used to convert between + types. + + + Use the and + methods to register new converters. + The and methods + lookup appropriate converters to use. + + + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + Initializes a new instance of the class. + + + + + Static constructor. + + + + This constructor defines the intrinsic type converters. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type converter to use to convert to the destination type. + + + Adds a converter instance for a specific type. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type of the type converter to use to convert to the destination type. + + + Adds a converter for a specific type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted from. + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Lookups the type converter to use as specified by the attributes on the + destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + + Creates the instance of the type converter. + + The type of the type converter. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + The type specified for the type converter must implement + the or interfaces + and must have a public default (no argument) constructor. + + + + + + Mapping from to type converter. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an encoding + the encoding + + + Uses the method to + convert the argument to an . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Interface supported by type converters + + + + This interface supports conversion from a single type to arbitrary types. + See . + + + Nicko Cadell + + + + Returns whether this converter can convert the object to the specified type + + A Type that represents the type you want to convert to + true if the conversion is possible + + + Test if the type supported by this converter can be converted to the + . + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Converts the (which must be of the type supported + by this converter) to the specified.. + + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an IPAddress + the IPAddress + + + Uses the method to convert the + argument to an . + If that fails then the string is resolved as a DNS hostname. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternLayout + the PatternLayout + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Convert between string and + + + + Supports conversion from string to type, + and from a type to a string. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the target type be converted to the type supported by this object + + A that represents the type you want to convert to + true if the conversion is possible + + + Returns true if the is + assignable from a type. + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + . To check for this condition use the + method. + + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternString + the PatternString + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a Type + the Type + + + Uses the method to convert the + argument to a . + Additional effort is made to locate partially specified types + by searching the loaded assemblies. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Attribute used to associate a type converter + + + + Class and Interface level attribute that specifies a type converter + to use with the associated type. + + + To associate a type converter with a target type apply a + TypeConverterAttribute to the target type. Specify the + type of the type converter on the attribute. + + + Nicko Cadell + Gert Driesen + + + + The string type name of the type converter + + + + + Default constructor + + + + Default constructor + + + + + + Create a new type converter attribute for the specified type name + + The string type name of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + Create a new type converter attribute for the specified type + + The type of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + The string type name of the type converter + + + The string type name of the type converter + + + + The type specified must implement the + or the interfaces. + + + + + + A straightforward implementation of the interface. + + + + This is the default implementation of the + interface. Implementors of the interface + should aggregate an instance of this type. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Append on on all attached appenders. + + The event being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Append on on all attached appenders. + + The array of events being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Calls the DoAppende method on the with + the objects supplied. + + The appender + The events + + + If the supports the + interface then the will be passed + through using that interface. Otherwise the + objects in the array will be passed one at a time. + + + + + + Attaches an appender. + + The appender to add. + + + If the appender is already in the list it won't be added again. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Lookup an attached appender by name. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + List of appenders + + + + + Array of appenders, used to cache the m_appenderList + + + + + Gets all attached appenders. + + + A collection of attached appenders, or null if there + are no attached appenders. + + + + The read only collection of all currently attached appenders. + + + + + + This class aggregates several PropertiesDictionary collections together. + + + + Provides a dictionary style lookup over an ordered list of + collections. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Add a Properties Dictionary to this composite collection + + the properties to add + + + Properties dictionaries added first take precedence over dictionaries added + later. + + + + + + Flatten this composite collection into a single properties dictionary + + the flattened dictionary + + + Reduces the collection of ordered dictionaries to a single dictionary + containing the resultant values for the keys. + + + + + + Gets the value of a property + + + The value for the property with the specified key + + + + Looks up the value for the specified. + The collections are searched + in the order in which they were added to this collection. The value + returned is the value held by the first collection that contains + the specified key. + + + If none of the collections contain the specified key then + null is returned. + + + + + + Base class for Context Properties implementations + + + + This class defines a basic property get set accessor + + + Nicko Cadell + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Subclass of that maintains a count of + the number of bytes written. + + + + This writer counts the number of bytes written. + + + Nicko Cadell + Gert Driesen + + + + that does not leak exceptions + + + + does not throw exceptions when things go wrong. + Instead, it delegates error handling to its . + + + Nicko Cadell + Gert Driesen + + + + Adapter that extends and forwards all + messages to an instance of . + + + + Adapter that extends and forwards all + messages to an instance of . + + + Nicko Cadell + + + + The writer to forward messages to + + + + + Create an instance of that forwards all + messages to a . + + The to forward to + + + Create an instance of that forwards all + messages to a . + + + + + + Closes the writer and releases any system resources associated with the writer + + + + + + + + + Dispose this writer + + flag indicating if we are being disposed + + + Dispose this writer + + + + + + Flushes any buffered output + + + + Clears all buffers for the writer and causes any buffered data to be written + to the underlying device + + + + + + Writes a character to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a character to the wrapped TextWriter + + + + + + Writes a character buffer to the wrapped TextWriter + + the data buffer + the start index + the number of characters to write + + + Writes a character buffer to the wrapped TextWriter + + + + + + Writes a string to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a string to the wrapped TextWriter + + + + + + Gets or sets the underlying . + + + The underlying . + + + + Gets or sets the underlying . + + + + + + The Encoding in which the output is written + + + The + + + + The Encoding in which the output is written + + + + + + Gets an object that controls formatting + + + The format provider + + + + Gets an object that controls formatting + + + + + + Gets or sets the line terminator string used by the TextWriter + + + The line terminator to use + + + + Gets or sets the line terminator string used by the TextWriter + + + + + + Constructor + + the writer to actually write to + the error handler to report error to + + + Create a new QuietTextWriter using a writer and error handler + + + + + + Writes a character to the underlying writer + + the char to write + + + Writes a character to the underlying writer + + + + + + Writes a buffer to the underlying writer + + the buffer to write + the start index to write from + the number of characters to write + + + Writes a buffer to the underlying writer + + + + + + Writes a string to the output. + + The string data to write to the output. + + + Writes a string to the output. + + + + + + Closes the underlying output writer. + + + + Closes the underlying output writer. + + + + + + The error handler instance to pass all errors to + + + + + Flag to indicate if this writer is closed + + + + + Gets or sets the error handler that all errors are passed to. + + + The error handler that all errors are passed to. + + + + Gets or sets the error handler that all errors are passed to. + + + + + + Gets a value indicating whether this writer is closed. + + + true if this writer is closed, otherwise false. + + + + Gets a value indicating whether this writer is closed. + + + + + + Constructor + + The to actually write to. + The to report errors to. + + + Creates a new instance of the class + with the specified and . + + + + + + Writes a character to the underlying writer and counts the number of bytes written. + + the char to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a buffer to the underlying writer and counts the number of bytes written. + + the buffer to write + the start index to write from + the number of characters to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a string to the output and counts the number of bytes written. + + The string data to write to the output. + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Total number of bytes written. + + + + + Gets or sets the total number of bytes written. + + + The total number of bytes written. + + + + Gets or sets the total number of bytes written. + + + + + + A fixed size rolling buffer of logging events. + + + + An array backed fixed size leaky bucket. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The maximum number of logging events in the buffer. + + + Initializes a new instance of the class with + the specified maximum number of buffered logging events. + + + The argument is not a positive integer. + + + + Appends a to the buffer. + + The event to append to the buffer. + The event discarded from the buffer, if the buffer is full, otherwise null. + + + Append an event to the buffer. If the buffer still contains free space then + null is returned. If the buffer is full then an event will be dropped + to make space for the new event, the event dropped is returned. + + + + + + Get and remove the oldest event in the buffer. + + The oldest logging event in the buffer + + + Gets the oldest (first) logging event in the buffer and removes it + from the buffer. + + + + + + Pops all the logging events from the buffer into an array. + + An array of all the logging events in the buffer. + + + Get all the events in the buffer and clear the buffer. + + + + + + Clear the buffer + + + + Clear the buffer of all events. The events in the buffer are lost. + + + + + + Gets the th oldest event currently in the buffer. + + The th oldest event currently in the buffer. + + + If is outside the range 0 to the number of events + currently in the buffer, then null is returned. + + + + + + Gets the maximum size of the buffer. + + The maximum size of the buffer. + + + Gets the maximum size of the buffer + + + + + + Gets the number of logging events in the buffer. + + The number of logging events in the buffer. + + + This number is guaranteed to be in the range 0 to + (inclusive). + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + The singleton instance of the empty collection. + + + + + Gets the singleton instance of the empty collection. + + The singleton instance of the empty collection. + + + Gets the singleton instance of the empty collection. + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the . + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Adds an element with the provided key and value to the + . + + The to use as the key of the element to add. + The to use as the value of the element to add. + + + As the collection is empty no new values can be added. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Removes all elements from the . + + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Determines whether the contains an element + with the specified key. + + The key to locate in the . + false + + + As the collection is empty the method always returns false. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Removes the element with the specified key from the . + + The key of the element to remove. + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + The singleton instance of the empty dictionary. + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + Gets a value indicating whether the has a fixed size. + + true + + + As the collection is empty always returns true. + + + + + + Gets a value indicating whether the is read-only. + + true + + + As the collection is empty always returns true. + + + + + + Gets an containing the keys of the . + + An containing the keys of the . + + + As the collection is empty a is returned. + + + + + + Gets an containing the values of the . + + An containing the values of the . + + + As the collection is empty a is returned. + + + + + + Gets or sets the element with the specified key. + + The key of the element to get or set. + null + + + As the collection is empty no values can be looked up or stored. + If the index getter is called then null is returned. + A is thrown if the setter is called. + + + This dictionary is always empty and cannot be modified. + + + + Contain the information obtained when parsing formatting modifiers + in conversion modifiers. + + + + Holds the formatting information extracted from the format string by + the . This is used by the + objects when rendering the output. + + + Nicko Cadell + Gert Driesen + + + + Defaut Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + + + Initializes a new instance of the class + with the specified parameters. + + + + + + Gets or sets the minimum value. + + + The minimum value. + + + + Gets or sets the minimum value. + + + + + + Gets or sets the maximum value. + + + The maximum value. + + + + Gets or sets the maximum value. + + + + + + Gets or sets a flag indicating whether left align is enabled + or not. + + + A flag indicating whether left align is enabled or not. + + + + Gets or sets a flag indicating whether left align is enabled or not. + + + + + + Implementation of Properties collection for the + + + + This class implements a properties collection that is thread safe and supports both + storing properties and capturing a read only copy of the current propertied. + + + This class is optimized to the scenario where the properties are read frequently + and are modified infrequently. + + + Nicko Cadell + + + + The read only copy of the properties. + + + + This variable is declared volatile to prevent the compiler and JIT from + reordering reads and writes of this thread performed on different threads. + + + + + + Lock object used to synchronize updates within this instance + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property from the global context + + the key for the entry to remove + + + Removing an entry from the global context properties is relatively expensive compared + with reading a value. + + + + + + Clear the global context properties + + + + + Get a readonly immutable copy of the properties + + the current global context properties + + + This implementation is fast because the GlobalContextProperties class + stores a readonly copy of the properties. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Reading the value for a key is faster than setting the value. + When the value is written a new read only copy of + the properties is created. + + + + + + Manages a mapping from levels to + + + + Manages an ordered mapping from instances + to subclasses. + + + Nicko Cadell + + + + Default constructor + + + + Initialise a new instance of . + + + + + + Add a to this mapping + + the entry to add + + + If a has previously been added + for the same then that entry will be + overwritten. + + + + + + Lookup the mapping for the specified level + + the level to lookup + the for the level or null if no mapping found + + + Lookup the value for the specified level. Finds the nearest + mapping value for the level that is equal to or less than the + specified. + + + If no mapping could be found then null is returned. + + + + + + Initialize options + + + + Caches the sorted list of in an array + + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove the value for the specified from the context. + + + + + + Clear all the context properties + + + + Clear all the context properties + + + + + + Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. + + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doings so. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Get or set the property value for the specified. + + + + + + Outputs log statements from within the log4net assembly. + + + + Log4net components cannot make log4net logging calls. However, it is + sometimes useful for the user to learn about what log4net is + doing. + + + All log4net internal debug calls go to the standard output stream + whereas internal error messages are sent to the standard error output + stream. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Static constructor that initializes logging by reading + settings from the application configuration file. + + + + The log4net.Internal.Debug application setting + controls internal debugging. This setting should be set + to true to enable debugging. + + + The log4net.Internal.Quiet application setting + suppresses all internal logging including error messages. + This setting should be set to true to enable message + suppression. + + + + + + Writes log4net internal debug messages to the + standard output stream. + + The message to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal debug messages to the + standard output stream. + + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The message to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The message to log. + An exception to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The message to log. + + + All internal error messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes output to the standard output stream. + + The message to log. + + + Writes to both Console.Out and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Writes output to the standard error stream. + + The message to log. + + + Writes to both Console.Error and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Default debug level + + + + + In quietMode not even errors generate any output. + + + + + Gets or sets a value indicating whether log4net internal logging + is enabled or disabled. + + + true if log4net internal logging is enabled, otherwise + false. + + + + When set to true, internal debug level logging will be + displayed. + + + This value can be set by setting the application setting + log4net.Internal.Debug in the application configuration + file. + + + The default value is false, i.e. debugging is + disabled. + + + + + The following example enables internal debugging using the + application configuration file : + + + + + + + + + + + + + Gets or sets a value indicating whether log4net should generate no output + from internal logging, not even for errors. + + + true if log4net should generate no output at all from internal + logging, otherwise false. + + + + When set to true will cause internal logging at all levels to be + suppressed. This means that no warning or error reports will be logged. + This option overrides the setting and + disables all debug also. + + This value can be set by setting the application setting + log4net.Internal.Quiet in the application configuration file. + + + The default value is false, i.e. internal logging is not + disabled. + + + + The following example disables internal logging using the + application configuration file : + + + + + + + + + + + + Test if LogLog.Debug is enabled for output. + + + true if Debug is enabled + + + + Test if LogLog.Debug is enabled for output. + + + + + + Test if LogLog.Warn is enabled for output. + + + true if Warn is enabled + + + + Test if LogLog.Warn is enabled for output. + + + + + + Test if LogLog.Error is enabled for output. + + + true if Error is enabled + + + + Test if LogLog.Error is enabled for output. + + + + + + Represents a native error code and message. + + + + Represents a Win32 platform native error. + + + Nicko Cadell + Gert Driesen + + + + Create an instance of the class with the specified + error number and message. + + The number of the native error. + The message of the native error. + + + Create an instance of the class with the specified + error number and message. + + + + + + Create a new instance of the class for the last Windows error. + + + An instance of the class for the last windows error. + + + + The message for the error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Create a new instance of the class. + + the error number for the native error + + An instance of the class for the specified + error number. + + + + The message for the specified error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Retrieves the message corresponding with a Win32 message identifier. + + Message identifier for the requested message. + + The message corresponding with the specified message identifier. + + + + The message will be searched for in system message-table resource(s) + using the native FormatMessage function. + + + + + + Return error information string + + error information string + + + Return error information string + + + + + + Formats a message string. + + Formatting options, and how to interpret the parameter. + Location of the message definition. + Message identifier for the requested message. + Language identifier for the requested message. + If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . + If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the maximum number of TCHARs that can be stored in the output buffer. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, this parameter specifies the minimum number of TCHARs to allocate for an output buffer. + Pointer to an array of values that are used as insert values in the formatted message. + + + The function requires a message definition as input. The message definition can come from a + buffer passed into the function. It can come from a message table resource in an + already-loaded module. Or the caller can ask the function to search the system's message + table resource(s) for the message definition. The function finds the message definition + in a message table resource based on a message identifier and a language identifier. + The function copies the formatted message text to an output buffer, processing any embedded + insert sequences if requested. + + + To prevent the usage of unsafe code, this stub does not support inserting values in the formatted message. + + + + + If the function succeeds, the return value is the number of TCHARs stored in the output + buffer, excluding the terminating null character. + + + If the function fails, the return value is zero. To get extended error information, + call . + + + + + + Gets the number of the native error. + + + The number of the native error. + + + + Gets the number of the native error. + + + + + + Gets the message of the native error. + + + The message of the native error. + + + + + Gets the message of the native error. + + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance. + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current key from the enumerator. + + + Throws an exception because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current value from the enumerator. + + The current value from the enumerator. + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current entry from the enumerator. + + + Throws an because the + never has a current entry. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Get the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + A SecurityContext used when a SecurityContext is not required + + + + The is a no-op implementation of the + base class. It is used where a + is required but one has not been provided. + + + Nicko Cadell + + + + Singleton instance of + + + + Singleton instance of + + + + + + Private constructor + + + + Private constructor for singleton pattern. + + + + + + Impersonate this SecurityContext + + State supplied by the caller + null + + + No impersonation is done and null is always returned. + + + + + + Implements log4net's default error handling policy which consists + of emitting a message for the first error in an appender and + ignoring all subsequent errors. + + + + The error message is printed on the standard error output stream. + + + This policy aims at protecting an otherwise working application + from being flooded with error messages when logging fails. + + + Nicko Cadell + Gert Driesen + + + + Default Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + The prefix to use for each message. + + + Initializes a new instance of the class + with the specified prefix. + + + + + + Log an Error + + The error message. + The exception. + The internal error code. + + + Prints the message and the stack trace of the exception on the standard + error output stream. + + + + + + Log an Error + + The error message. + The exception. + + + Prints the message and the stack trace of the exception on the standard + error output stream. + + + + + + Log an error + + The error message. + + + Print a the error message passed as parameter on the standard + error output stream. + + + + + + Flag to indicate if it is the first error + + + + + String to prefix each message with + + + + + Is error logging enabled + + + + Is error logging enabled. Logging is only enabled for the + first error delivered to the . + + + + + + A convenience class to convert property values to specific types. + + + + Utility functions for converting types and parsing values. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Converts a string to a value. + + String to convert. + The default value. + The value of . + + + If is "true", then true is returned. + If is "false", then false is returned. + Otherwise, is returned. + + + + + + Parses a file size into a number. + + String to parse. + The default value. + The value of . + + + Parses a file size of the form: number[KB|MB|GB] into a + long value. It is scaled with the appropriate multiplier. + + + is returned when + cannot be converted to a value. + + + + + + Converts a string to an object. + + The target type to convert to. + The string to convert to an object. + + The object converted from a string or null when the + conversion failed. + + + + Converts a string to an object. Uses the converter registry to try + to convert the string value into the specified target type. + + + + + + Checks if there is an appropriate type conversion from the source type to the target type. + + The type to convert from. + The type to convert to. + true if there is a conversion from the source type to the target type. + + Checks if there is an appropriate type conversion from the source type to the target type. + + + + + + + Converts an object to the target type. + + The object to convert to the target type. + The type to convert to. + The converted object. + + + Converts an object to the target type. + + + + + + Instantiates an object given a class name. + + The fully qualified class name of the object to instantiate. + The class to which the new object should belong. + The object to return in case of non-fulfillment. + + An instance of the or + if the object could not be instantiated. + + + + Checks that the is a subclass of + . If that test fails or the object could + not be instantiated, then is returned. + + + + + + Performs variable substitution in string from the + values of keys found in . + + The string on which variable substitution is performed. + The dictionary to use to lookup variables. + The result of the substitutions. + + + The variable substitution delimiters are ${ and }. + + + For example, if props contains key=value, then the call + + + + string s = OptionConverter.SubstituteVariables("Value of key is ${key}."); + + + + will set the variable s to "Value of key is value.". + + + If no value could be found for the specified key, then substitution + defaults to an empty string. + + + For example, if system properties contains no value for the key + "nonExistentKey", then the call + + + + string s = OptionConverter.SubstituteVariables("Value of nonExistentKey is [${nonExistentKey}]"); + + + + will set s to "Value of nonExistentKey is []". + + + An Exception is thrown if contains a start + delimiter "${" which is not balanced by a stop delimiter "}". + + + + + + Converts the string representation of the name or numeric value of one or + more enumerated constants to an equivalent enumerated object. + + The type to convert to. + The enum string value. + If true, ignore case; otherwise, regard case. + An object of type whose value is represented by . + + + + Most of the work of the class + is delegated to the PatternParser class. + + + + The PatternParser processes a pattern string and + returns a chain of objects. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The pattern to parse. + + + Initializes a new instance of the class + with the specified pattern string. + + + + + + Parses the pattern into a chain of pattern converters. + + The head of a chain of pattern converters. + + + Parses the pattern into a chain of pattern converters. + + + + + + Build the unified cache of converters from the static and instance maps + + the list of all the converter names + + + Build the unified cache of converters from the static and instance maps + + + + + + Internal method to parse the specified pattern to find specified matches + + the pattern to parse + the converter names to match in the pattern + + + The matches param must be sorted such that longer strings come before shorter ones. + + + + + + Process a parsed literal + + the literal text + + + + Process a parsed converter pattern + + the name of the converter + the optional option for the converter + the formatting info for the converter + + + + Resets the internal state of the parser and adds the specified pattern converter + to the chain. + + The pattern converter to add. + + + + The first pattern converter in the chain + + + + + the last pattern converter in the chain + + + + + The pattern + + + + + Internal map of converter identifiers to converter types + + + + This map overrides the static s_globalRulesRegistry map. + + + + + + Get the converter registry used by this parser + + + The converter registry used by this parser + + + + Get the converter registry used by this parser + + + + + + Sort strings by length + + + + that orders strings by string length. + The longest strings are placed first + + + + + + This class implements a patterned string. + + + + This string has embedded patterns that are resolved and expanded + when the string is formatted. + + + This class functions similarly to the + in that it accepts a pattern and renders it to a string. Unlike the + however the PatternString + does not render the properties of a specific but + of the process in general. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + appdomain + + + Used to output the friendly name of the current AppDomain. + + + + + date + + + Used to output the date of the logging event in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + env + + + Used to output the a specific environment variable. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %env{COMPUTERNAME} would include the value + of the COMPUTERNAME environment variable. + + + The env pattern is not supported on the .NET Compact Framework. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern name offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + processid + + + Used to output the system process ID for the current process. + + + + + property + + + Used to output a specific context property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are stored in logging contexts. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + random + + + Used to output a random string of characters. The string is made up of + uppercase letters and numbers. By default the string is 4 characters long. + The length of the string can be specified within braces directly following the + pattern specifier, e.g. %random{8} would output an 8 character string. + + + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + % + + + The sequence %% outputs a single percent sign. + + + + + + Additional pattern converters may be registered with a specific + instance using or + . + + + See the for details on the + format modifiers supported by the patterns. + + + Nicko Cadell + + + + Internal map of converter identifiers to converter types. + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternString only + + + + + Initialize the global registry + + + + + Default constructor + + + + Initialize a new instance of + + + + + + Constructs a PatternString + + The pattern to use with this PatternString + + + Initialize a new instance of with the pattern specified. + + + + + + Initialize object options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create the used to parse the pattern + + the pattern to parse + The + + + Returns PatternParser used to parse the conversion string. Subclasses + may override this to return a subclass of PatternParser which recognize + custom conversion pattern name. + + + + + + Produces a formatted string as specified by the conversion pattern. + + The TextWriter to write the formatted event to + + + Format the pattern to the . + + + + + + Format the pattern as a string + + the pattern formatted as a string + + + Format the pattern to a string. + + + + + + Add a converter to this PatternString + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternString + + the name of the conversion pattern for this converter + the type of the converter + + + Add a converter to this PatternString + + + + + + Gets or sets the pattern formatting string + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + Wrapper class used to map converter names to converter types + + + + Wrapper class used to map converter names to converter types + + + + + + default constructor + + + + + Gets or sets the name of the conversion pattern + + + The name of the conversion pattern + + + + Gets or sets the name of the conversion pattern + + + + + + Gets or sets the type of the converter + + + The type of the converter + + + + Gets or sets the type of the converter + + + + + + String keyed object map. + + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + String keyed object map that is read only. + + + + This collection is readonly and cannot be modified. + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + The Hashtable used to store the properties data + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Copy Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Deserialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Gets the key names. + + An array of all the keys. + + + Gets the key names. + + + + + + Test if the dictionary contains a specified key + + the key to look for + true if the dictionary contains the specified key + + + Test if the dictionary contains a specified key + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + Serializes this object into the provided. + + + + + + See + + + + + See + + + + + + See + + + + + + + Remove all properties from the properties collection + + + + + See + + + + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + The hashtable used to store the properties + + + The internal collection used to store the properties + + + + The hashtable used to store the properties + + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + The number of properties in this collection + + + + + See + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class + with serialized data. + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Because this class is sealed the serialization constructor is private. + + + + + + Remove the entry with the specified key from this dictionary + + the key for the entry to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + an enumerator + + + Returns a over the contest of this collection. + + + + + + See + + the key to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + the key to lookup in the collection + true if the collection contains the specified key + + + Test if this collection contains a specified key. + + + + + + Remove all properties from the properties collection + + + + Remove all properties from the properties collection + + + + + + See + + the key + the value to store for the key + + + Store a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + See + + + false + + + + This collection is modifiable. This property always + returns false. + + + + + + See + + + The value for the key specified. + + + + Get or set a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + A that ignores the message + + + + This writer is used in special cases where it is necessary + to protect a writer from being closed by a client. + + + Nicko Cadell + + + + Constructor + + the writer to actually write to + + + Create a new ProtectCloseTextWriter using a writer + + + + + + Attach this instance to a different underlying + + the writer to attach to + + + Attach this instance to a different underlying + + + + + + Does not close the underlying output writer. + + + + Does not close the underlying output writer. + This method does nothing. + + + + + + Defines a lock that supports single writers and multiple readers + + + + ReaderWriterLock is used to synchronize access to a resource. + At any given time, it allows either concurrent read access for + multiple threads, or write access for a single thread. In a + situation where a resource is changed infrequently, a + ReaderWriterLock provides better throughput than a simple + one-at-a-time lock, such as . + + + If a platform does not support a System.Threading.ReaderWriterLock + implementation then all readers and writers are serialized. Therefore + the caller must not rely on multiple simultaneous readers. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Acquires a reader lock + + + + blocks if a different thread has the writer + lock, or if at least one thread is waiting for the writer lock. + + + + + + Decrements the lock count + + + + decrements the lock count. When the count + reaches zero, the lock is released. + + + + + + Acquires the writer lock + + + + This method blocks if another thread has a reader lock or writer lock. + + + + + + Decrements the lock count on the writer lock + + + + ReleaseWriterLock decrements the writer lock count. + When the count reaches zero, the writer lock is released. + + + + + + A that can be and reused + + + + A that can be and reused. + This uses a single buffer for string operations. + + + Nicko Cadell + + + + Create an instance of + + the format provider to use + + + Create an instance of + + + + + + Override Dispose to prevent closing of writer + + flag + + + Override Dispose to prevent closing of writer + + + + + + Reset this string writer so that it can be reused. + + the maximum buffer capacity before it is trimmed + the default size to make the buffer + + + Reset this string writer so that it can be reused. + The internal buffers are cleared and reset. + + + + + + Utility class for system specific information. + + + + Utility class of static methods for system specific information. + + + Nicko Cadell + Gert Driesen + Alexey Solofnenko + + + + Private constructor to prevent instances. + + + + Only static methods are exposed from this type. + + + + + + Initialize default values for private static fields. + + + + Only static methods are exposed from this type. + + + + + + Gets the assembly location path for the specified assembly. + + The assembly to get the location for. + The location of the assembly. + + + This method does not guarantee to return the correct path + to the assembly. If only tries to give an indication as to + where the assembly was loaded from. + + + + + + Gets the fully qualified name of the , including + the name of the assembly from which the was + loaded. + + The to get the fully qualified name for. + The fully qualified name for the . + + + This is equivalent to the Type.AssemblyQualifiedName property, + but this method works on the .NET Compact Framework 1.0 as well as + the full .NET runtime. + + + + + + Gets the short name of the . + + The to get the name for. + The short name of the . + + + The short name of the assembly is the + without the version, culture, or public key. i.e. it is just the + assembly's file name without the extension. + + + Use this rather than Assembly.GetName().Name because that + is not available on the Compact Framework. + + + Because of a FileIOPermission security demand we cannot do + the obvious Assembly.GetName().Name. We are allowed to get + the of the assembly so we + start from there and strip out just the assembly name. + + + + + + Gets the file name portion of the , including the extension. + + The to get the file name for. + The file name of the assembly. + + + Gets the file name portion of the , including the extension. + + + + + + Loads the type specified in the type string. + + A sibling type to use to load the type. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified, it will be loaded from the assembly + containing the specified relative type. If the type is not found in the assembly + then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the + assembly that is directly calling this method. If the type is not found + in the assembly then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + An assembly to load the type from. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the specified + assembly. If the type is not found in the assembly then all the loaded assemblies + will be searched for the type. + + + + + + Generate a new guid + + A new Guid + + + Generate a new guid + + + + + + Create an + + The name of the parameter that caused the exception + The value of the argument that causes this exception + The message that describes the error + the ArgumentOutOfRangeException object + + + Create a new instance of the class + with a specified error message, the parameter name, and the value + of the argument. + + + The Compact Framework does not support the 3 parameter constructor for the + type. This method provides an + implementation that works for all platforms. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Lookup an application setting + + the application settings key to lookup + the value for the key, or null + + + Configuration APIs are not supported under the Compact Framework + + + + + + Convert a path into a fully qualified local file path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + The path specified must be a local file path, a URI is not supported. + + + + + + Creates a new case-insensitive instance of the class with the default initial capacity. + + A new case-insensitive instance of the class with the default initial capacity + + + The new Hashtable instance uses the default load factor, the CaseInsensitiveHashCodeProvider, and the CaseInsensitiveComparer. + + + + + + Gets an empty array of types. + + + + The Type.EmptyTypes field is not available on + the .NET Compact Framework 1.0. + + + + + + Cache the host name for the current machine + + + + + Cache the application friendly name + + + + + Text to output when a null is encountered. + + + + + Text to output when an unsupported feature is requested. + + + + + Start time for the current process. + + + + + Gets the system dependent line terminator. + + + The system dependent line terminator. + + + + Gets the system dependent line terminator. + + + + + + Gets the base directory for this . + + The base directory path for the current . + + + Gets the base directory for this . + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the configuration file for the current . + + The path to the configuration file for the current . + + + The .NET Compact Framework 1.0 does not have a concept of a configuration + file. For this runtime, we use the entry assembly location as the root for + the configuration file name. + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the file that first executed in the current . + + The path to the entry assembly. + + + Gets the path to the file that first executed in the current . + + + + + + Gets the ID of the current thread. + + The ID of the current thread. + + + On the .NET framework, the AppDomain.GetCurrentThreadId method + is used to obtain the thread ID for the current thread. This is the + operating system ID for the thread. + + + On the .NET Compact Framework 1.0 it is not possible to get the + operating system thread ID for the current thread. The native method + GetCurrentThreadId is implemented inline in a header file + and cannot be called. + + + On the .NET Framework 2.0 the Thread.ManagedThreadId is used as this + gives a stable id unrelated to the operating system thread ID which may + change if the runtime is using fibers. + + + + + + Get the host name or machine name for the current machine + + + The hostname or machine name + + + + Get the host name or machine name for the current machine + + + The host name () or + the machine name (Environment.MachineName) for + the current machine, or if neither of these are available + then NOT AVAILABLE is returned. + + + + + + Get this application's friendly name + + + The friendly name of this application as a string + + + + If available the name of the application is retrieved from + the AppDomain using AppDomain.CurrentDomain.FriendlyName. + + + Otherwise the file name of the entry assembly is used. + + + + + + Get the start time for the current process. + + + + This is the time at which the log4net library was loaded into the + AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime + this is not the start time for the current process. + + + The log4net library should be loaded by an application early during its + startup, therefore this start time should be a good approximation for + the actual start time. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating, however this start time + will be set per AppDomain. + + + + + + Text to output when a null is encountered. + + + + Use this value to indicate a null has been encountered while + outputting a string representation of an item. + + + The default value is (null). This value can be overridden by specifying + a value for the log4net.NullText appSetting in the application's + .config file. + + + + + + Text to output when an unsupported feature is requested. + + + + Use this value when an unsupported feature is requested. + + + The default value is NOT AVAILABLE. This value can be overridden by specifying + a value for the log4net.NotAvailableText appSetting in the application's + .config file. + + + + + + Utility class that represents a format string. + + + + Utility class that represents a format string. + + + Nicko Cadell + + + + Initialise the + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + + + Format the string and arguments + + the formatted string + + + + Replaces the format item in a specified with the text equivalent + of the value of a corresponding instance in a specified array. + A specified parameter supplies culture-specific formatting information. + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + A copy of format in which the format items have been replaced by the + equivalent of the corresponding instances of in args. + + + + This method does not throw exceptions. If an exception thrown while formatting the result the + exception and arguments are returned in the result string. + + + + + + Process an error during StringFormat + + + + + Dump the contents of an array into a string builder + + + + + Dump an object to a string + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + Nicko Cadell + + + + The thread local data slot to use to store a PropertiesDictionary. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove a property + + + + + + Clear all properties + + + + Clear all properties + + + + + + Get the PropertiesDictionary for this thread. + + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doing so. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Implementation of Stack for the + + + + Implementation of Stack for the + + + Nicko Cadell + + + + The stack store. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Clears all the contextual information held in this stack. + + + + Clears all the contextual information held in this stack. + Only call this if you think that this tread is being reused after + a previous call execution which may not have completed correctly. + You do not need to use this method if you always guarantee to call + the method of the + returned from even in exceptional circumstances, + for example by using the using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + syntax. + + + + + + Removes the top context from this stack. + + The message in the context that was removed from the top of this stack. + + + Remove the top context from this stack, and return + it to the caller. If this stack is empty then an + empty string (not ) is returned. + + + + + + Pushes a new context message into this stack. + + The new context message. + + An that can be used to clean up the context stack. + + + + Pushes a new context onto this stack. An + is returned that can be used to clean up this stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + { + log.Warn("This should have an ThreadContext Stack message"); + } + + + + + + Gets the current context information for this stack. + + The current context information. + + + + Gets the current context information for this stack. + + Gets the current context information + + + Gets the current context information for this stack. + + + + + + Get a portable version of this object + + the portable instance of this object + + + Get a cross thread portable version of this object + + + + + + The number of messages in the stack + + + The current number of messages in the stack + + + + The current number of messages in the stack. That is + the number of times has been called + minus the number of times has been called. + + + + + + Gets and sets the internal stack used by this + + The internal storage stack + + + This property is provided only to support backward compatability + of the . Tytpically the internal stack should not + be modified. + + + + + + Inner class used to represent a single context frame in the stack. + + + + Inner class used to represent a single context frame in the stack. + + + + + + Constructor + + The message for this context. + The parent context in the chain. + + + Initializes a new instance of the class + with the specified message and parent context. + + + + + + Get the message. + + The message. + + + Get the message. + + + + + + Gets the full text of the context down to the root level. + + + The full text of the context down to the root level. + + + + Gets the full text of the context down to the root level. + + + + + + Struct returned from the method. + + + + This struct implements the and is designed to be used + with the pattern to remove the stack frame at the end of the scope. + + + + + + The ThreadContextStack internal stack + + + + + The depth to trim the stack to when this instance is disposed + + + + + Constructor + + The internal stack used by the ThreadContextStack. + The depth to return the stack to when this object is disposed. + + + Initializes a new instance of the class with + the specified stack and return depth. + + + + + + Returns the stack to the correct depth. + + + + Returns the stack to the correct depth. + + + + + + Implementation of Stacks collection for the + + + + Implementation of Stacks collection for the + + + Nicko Cadell + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Gets the named thread context stack + + + The named stack + + + + Gets the named thread context stack + + + + + + Utility class for transforming strings. + + + + Utility class for transforming strings. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Write a string to an + + the writer to write to + the string to write + The string to replace non XML compliant chars with + + + The test is escaped either using XML escape entities + or using CDATA sections. + + + + + + Replace invalid XML characters in text string + + the XML text input string + the string to use in place of invalid characters + A string that does not contain invalid XML characters. + + + Certain Unicode code points are not allowed in the XML InfoSet, for + details see: http://www.w3.org/TR/REC-xml/#charsets. + + + This method replaces any illegal characters in the input string + with the mask string specified. + + + + + + Count the number of times that the substring occurs in the text + + the text to search + the substring to find + the number of times the substring occurs in the text + + + The substring is assumed to be non repeating within itself. + + + + + + Impersonate a Windows Account + + + + This impersonates a Windows account. + + + How the impersonation is done depends on the value of . + This allows the context to either impersonate a set of user credentials specified + using username, domain name and password or to revert to the process credentials. + + + + + + Default constructor + + + + Default constructor + + + + + + Initialize the SecurityContext based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The security context will try to Logon the specified user account and + capture a primary token for impersonation. + + + The required , + or properties were not specified. + + + + Impersonate the Windows account specified by the and properties. + + caller provided state + + An instance that will revoke the impersonation of this SecurityContext + + + + Depending on the property either + impersonate a user using credentials supplied or revert + to the process credentials. + + + + + + Create a given the userName, domainName and password. + + the user name + the domain name + the password + the for the account specified + + + Uses the Windows API call LogonUser to get a principal token for the account. This + token is used to initialize the WindowsIdentity. + + + + + + Gets or sets the impersonation mode for this security context + + + The impersonation mode for this security context + + + + Impersonate either a user with user credentials or + revert this thread to the credentials of the process. + The value is one of the + enum. + + + The default value is + + + When the mode is set to + the user's credentials are established using the + , and + values. + + + When the mode is set to + no other properties need to be set. If the calling thread is + impersonating then it will be reverted back to the process credentials. + + + + + + Gets or sets the Windows username for this security context + + + The Windows username for this security context + + + + This property must be set if + is set to (the default setting). + + + + + + Gets or sets the Windows domain name for this security context + + + The Windows domain name for this security context + + + + The default value for is the local machine name + taken from the property. + + + This property must be set if + is set to (the default setting). + + + + + + Sets the password for the Windows account specified by the and properties. + + + The password for the Windows account specified by the and properties. + + + + This property must be set if + is set to (the default setting). + + + + + + The impersonation modes for the + + + + See the property for + details. + + + + + + Impersonate a user using the credentials supplied + + + + + Revert this the thread to the credentials of the process + + + + + Adds to + + + + Helper class to expose the + through the interface. + + + + + + Constructor + + the impersonation context being wrapped + + + Constructor + + + + + + Revert the impersonation + + + + Revert the impersonation + + + + + + The log4net Global Context. + + + + The GlobalContext provides a location for global debugging + information to be stored. + + + The global context has a properties map and these properties can + be included in the output of log messages. The + supports selecting and outputing these properties. + + + By default the log4net:HostName property is set to the name of + the current machine. + + + + + GlobalContext.Properties["hostname"] = Environment.MachineName; + + + + Nicko Cadell + + + + Private Constructor. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + The global context properties instance + + + + + The global properties map. + + + The global properties map. + + + + The global properties map. + + + + + + The log4net Logical Thread Context. + + + + The LogicalThreadContext provides a location for specific debugging + information to be stored. + The LogicalThreadContext properties override any or + properties with the same name. + + + The Logical Thread Context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Logical Thread Context provides a diagnostic context for the current call context. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Logical Thread Context is managed on a per basis. + + + Example of using the thread context properties to store a username. + + LogicalThreadContext.Properties["user"] = userName; + log.Info("This log message has a LogicalThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(LogicalThreadContext.Stacks["LDC"].Push("my context message")) + { + log.Info("This log message has a LogicalThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The LogicalThreadContext properties override any + or properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The logical thread stacks. + + + + + + This class is used by client applications to request logger instances. + + + + This class has static methods that are used by a client to request + a logger instance. The method is + used to retrieve a logger. + + + See the interface for more details. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + Returns the named logger if it exists. + + Returns the named logger if it exists. + + + + If the named logger exists (in the default repository) then it + returns a reference to the logger, otherwise it returns null. + + + The fully qualified logger name to look for. + The logger found, or null if no logger could be found. + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the logger doesn't exist in the specified + repository. + + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the repository for the specified assembly) then it + returns a reference to the logger, otherwise it returns + null. + + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger, or null if the logger doesn't exist in the specified + assembly's repository. + + + + Get the currently defined loggers. + + Returns all the currently defined loggers in the default repository. + + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + + The root logger is not included in the returned array. + + All the defined loggers. + + + Get or create a logger. + + Retrieves or creates a named logger. + + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The name of the logger to retrieve. + The logger with the name specified. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Get the logger for the fully qualified name of the type specified. + + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The repository to lookup in. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The assembly to use to lookup the repository. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + Shutdown a logger repository. + + Shuts down the default repository. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + default repository. + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The repository to shutdown. + + + + Shuts down the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The assembly to use to lookup the repository. + + + Reset the configuration of a repository + + Resets all values contained in this repository instance to their defaults. + + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The repository to reset. + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The assembly to use to lookup the repository to reset. + + + Get the logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Get a logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Create a domain + + Creates a repository with the specified repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + Create a logger repository. + + Creates a repository with the specified repository type. + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + + + + Creates a repository with the specified name. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name. + + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Creates a repository for the specified assembly and repository type. + + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Gets the list of currently defined repositories. + + + + Get an array of all the objects that have been created. + + + An array of all the known objects. + + + + Looks up the wrapper object for the logger specified. + + The logger to get the wrapper for. + The wrapper for the logger specified. + + + + Looks up the wrapper objects for the loggers specified. + + The loggers to get the wrappers for. + The wrapper objects for the loggers specified. + + + + Create the objects used by + this manager. + + The logger to wrap. + The wrapper for the logger specified. + + + + The wrapper map to use to hold the objects. + + + + + Implementation of Mapped Diagnostic Contexts. + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + The MDC class is similar to the class except that it is + based on a map instead of a stack. It provides mapped + diagnostic contexts. A Mapped Diagnostic Context, or + MDC in short, is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The MDC is managed on a per thread basis. + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Gets the context value identified by the parameter. + + The key to lookup in the MDC. + The string value held for the key, or a null reference if no corresponding value is found. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + If the parameter does not look up to a + previously defined context then null will be returned. + + + + + + Add an entry to the MDC + + The key to store the value under. + The value to store. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Puts a context value (the parameter) as identified + with the parameter into the current thread's + context map. + + + If a value is already defined for the + specified then the value will be replaced. If the + is specified as null then the key value mapping will be removed. + + + + + + Removes the key value mapping for the key specified. + + The key to remove. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove the specified entry from this thread's MDC + + + + + + Clear all entries in the MDC + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove all the entries from this thread's MDC + + + + + + Implementation of Nested Diagnostic Contexts. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + A Nested Diagnostic Context, or NDC in short, is an instrument + to distinguish interleaved log output from different sources. Log + output is typically interleaved when a server handles multiple + clients near-simultaneously. + + + Interleaved log output can still be meaningful if each log entry + from different contexts had a distinctive stamp. This is where NDCs + come into play. + + + Note that NDCs are managed on a per thread basis. The NDC class + is made up of static methods that operate on the context of the + calling thread. + + + How to push a message into the context + + using(NDC.Push("my context message")) + { + ... all log calls will have 'my context message' included ... + + } // at the end of the using block the message is automatically removed + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Clears all the contextual information held on the current thread. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Clears the stack of NDC data held on the current thread. + + + + + + Creates a clone of the stack of context information. + + A clone of the context info for this thread. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The results of this method can be passed to the + method to allow child threads to inherit the context of their + parent thread. + + + + + + Inherits the contextual information from another thread. + + The context stack to inherit. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This thread will use the context information from the stack + supplied. This can be used to initialize child threads with + the same contextual information as their parent threads. These + contexts will NOT be shared. Any further contexts that + are pushed onto the stack will not be visible to the other. + Call to obtain a stack to pass to + this method. + + + + + + Removes the top context from the stack. + + + The message in the context that was removed from the top + of the stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Remove the top context from the stack, and return + it to the caller. If the stack is empty then an + empty string (not null) is returned. + + + + + + Pushes a new context message. + + The new context message. + + An that can be used to clean up + the context stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Pushes a new context onto the context stack. An + is returned that can be used to clean up the context stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.NDC.Push("NDC_Message")) + { + log.Warn("This should have an NDC message"); + } + + + + + + Removes the context information for this thread. It is + not required to call this method. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This method is not implemented. + + + + + + Forces the stack depth to be at most . + + The maximum depth of the stack + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Forces the stack depth to be at most . + This may truncate the head of the stack. This only affects the + stack in the current thread. Also it does not prevent it from + growing, it only sets the maximum depth at the time of the + call. This can be used to return to a known context depth. + + + + + + Gets the current context depth. + + The current context depth. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The number of context values pushed onto the context stack. + + + Used to record the current depth of the context. This can then + be restored using the method. + + + + + + + The log4net Thread Context. + + + + The ThreadContext provides a location for thread specific debugging + information to be stored. + The ThreadContext properties override any + properties with the same name. + + + The thread context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Thread Context provides a diagnostic context for the current thread. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Thread Context is managed on a per thread basis. + + + Example of using the thread context properties to store a username. + + ThreadContext.Properties["user"] = userName; + log.Info("This log message has a ThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(ThreadContext.Stacks["NDC"].Push("my context message")) + { + log.Info("This log message has a ThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The ThreadContext properties override any + properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The thread local stacks. + + + + + diff --git a/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt b/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt new file mode 100644 index 0000000000..e6275d834b --- /dev/null +++ b/qpid/dotnet/client-010/lib/nunit/nunit-licence.txt @@ -0,0 +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. diff --git a/qpid/dotnet/client-010/lib/nunit/nunit.framework.dll b/qpid/dotnet/client-010/lib/nunit/nunit.framework.dll new file mode 100644 index 0000000000..53666e74c9 Binary files /dev/null and b/qpid/dotnet/client-010/lib/nunit/nunit.framework.dll differ diff --git a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..197c2aa080 --- /dev/null +++ b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Test")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d62cb4f-4353-4eed-9669-3e1bc902081d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj new file mode 100644 index 0000000000..a5d6e2c45f --- /dev/null +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -0,0 +1,61 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {95CB4C90-7C53-44A9-B11C-96235F158ACA} + Library + Properties + test + Qpid Test + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + False + ..\lib\nunit\nunit.framework.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs new file mode 100644 index 0000000000..6ece267e07 --- /dev/null +++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs @@ -0,0 +1,22 @@ + +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); + } + } +} -- cgit v1.2.1 From 7d4317b2ff39b61f529a2e7c187238c1370cae5c Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 8 Sep 2008 16:09:49 +0000 Subject: Qpid-1277: added nant support git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@693146 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/README.txt | 64 +++++++ .../client-010/client/Properties/AssemblyInfo.cs | 8 +- qpid/dotnet/client-010/client/client/Client.cs | 1 - qpid/dotnet/client-010/client/default.build | 25 +++ qpid/dotnet/client-010/client/transport/Binding.cs | 2 +- qpid/dotnet/client-010/client/transport/Method.cs | 2 +- qpid/dotnet/client-010/client/transport/Struct.cs | 2 +- .../client/transport/codec/AbstractEncoder.cs | 13 +- qpid/dotnet/client-010/default.build | 201 +++++++++++++++++++++ qpid/dotnet/client-010/demo/Demo.csproj | 6 - qpid/dotnet/client-010/demo/Form1.Designer.cs | 39 ---- qpid/dotnet/client-010/demo/Form1.cs | 18 -- qpid/dotnet/client-010/demo/Program.cs | 4 +- .../client-010/demo/Properties/AssemblyInfo.cs | 8 +- qpid/dotnet/client-010/demo/default.build | 26 +++ .../client-010/test/Properties/AssemblyInfo.cs | 8 +- qpid/dotnet/client-010/test/default.build | 34 ++++ 17 files changed, 373 insertions(+), 88 deletions(-) create mode 100644 qpid/dotnet/client-010/README.txt create mode 100644 qpid/dotnet/client-010/client/default.build create mode 100644 qpid/dotnet/client-010/default.build delete mode 100644 qpid/dotnet/client-010/demo/Form1.Designer.cs delete mode 100644 qpid/dotnet/client-010/demo/Form1.cs create mode 100644 qpid/dotnet/client-010/demo/default.build create mode 100644 qpid/dotnet/client-010/test/default.build (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/README.txt b/qpid/dotnet/client-010/README.txt new file mode 100644 index 0000000000..bffa156df5 --- /dev/null +++ b/qpid/dotnet/client-010/README.txt @@ -0,0 +1,64 @@ +Info +==== + +AMQP version currently 0.10 + + +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 /dotnet/client-010/gentool: + + $ cd /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 /dotnet/client-010/ + $ nant + + +To build for Mono on Linux (to bin/mono-2.0): + + $ cd /dotnet/client-010/ + $ nant -t:mono-2.0 + +Releasing +========= + +For .NET 2.0 + + $ cd /dotnet/client-010/ + $ nant release-pkg + +Generates ./bin/net-2.0/release/Qpid.NET-net-2.0-yyyyMMdd.zip + +For Mono + + $ cd /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/client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs index e1804b779a..96a79040af 100644 --- a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Qpid Client")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Built from svn revision number: ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apache Software Foundation")] [assembly: AssemblyProduct("Qpid Client")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyCopyright("Apache Software Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 646192c25d..6759c6dbdc 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -28,7 +28,6 @@ namespace org.apache.qpid.client public class Client : ClientInterface { private Connection _conn; - private ClientSession _session; private static readonly Logger _log = Logger.get(typeof (Client)); private const long timeout = 60000; private bool _closed; diff --git a/qpid/dotnet/client-010/client/default.build b/qpid/dotnet/client-010/client/default.build new file mode 100644 index 0000000000..16b1532af9 --- /dev/null +++ b/qpid/dotnet/client-010/client/default.build @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/client/transport/Binding.cs b/qpid/dotnet/client-010/client/transport/Binding.cs index 25884fc772..e07e85990d 100644 --- a/qpid/dotnet/client-010/client/transport/Binding.cs +++ b/qpid/dotnet/client-010/client/transport/Binding.cs @@ -29,6 +29,6 @@ namespace org.apache.qpid.transport { E endpoint(Sender sender); - Receiver receiver(E endpoint) where T : EventArgs; + Receiver receiver(E endpoint) where R : EventArgs; } } \ 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 0f9a84d778..c15343ba73 100644 --- a/qpid/dotnet/client-010/client/transport/Method.cs +++ b/qpid/dotnet/client-010/client/transport/Method.cs @@ -30,7 +30,7 @@ namespace org.apache.qpid.transport /// public abstract class Method : Struct, ProtocolEvent { - public static Method create(int type) + public new static Method create(int type) { return (Method) StructFactory.createInstruction(type); } diff --git a/qpid/dotnet/client-010/client/transport/Struct.cs b/qpid/dotnet/client-010/client/transport/Struct.cs index 718dcbc978..fead22268b 100644 --- a/qpid/dotnet/client-010/client/transport/Struct.cs +++ b/qpid/dotnet/client-010/client/transport/Struct.cs @@ -32,7 +32,7 @@ namespace org.apache.qpid.transport public abstract class Struct : Encodable { - public static Struct create(int type) + public static Struct create(int type) { return StructFactory.create(type); } diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs index a34bd43331..f70eb17a55 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -281,7 +281,7 @@ namespace org.apache.qpid.transport.codec Type klass = value.GetType(); Code type = resolve(klass); - if (type == null) + if (type == Code.VOID) { throw new Exception ("unable to resolve type: " + klass + ", " + value); @@ -294,17 +294,18 @@ namespace org.apache.qpid.transport.codec private static Code resolve(Type klass) { - Code type = ENCODINGS[klass]; - if (type != null) + Code type; + if(ENCODINGS.ContainsKey(klass)) { - return type; + return ENCODINGS[klass]; } + Type sup = klass.BaseType; if (sup != null) { type = resolve(sup); - if (type != null) + if (type != Code.VOID) { return type; } @@ -312,7 +313,7 @@ namespace org.apache.qpid.transport.codec foreach (Type iface in klass.GetInterfaces()) { type = resolve(iface); - if (type != null) + if (type != Code.VOID) { return type; } diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build new file mode 100644 index 0000000000..095b6de2e9 --- /dev/null +++ b/qpid/dotnet/client-010/default.build @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + build.svnversion = ${build.svnversion} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index 541ee246eb..13dacc01be 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -40,12 +40,6 @@ - - Form - - - Form1.cs - diff --git a/qpid/dotnet/client-010/demo/Form1.Designer.cs b/qpid/dotnet/client-010/demo/Form1.Designer.cs deleted file mode 100644 index c6c633a823..0000000000 --- a/qpid/dotnet/client-010/demo/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace demo -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; - } - - #endregion - } -} - diff --git a/qpid/dotnet/client-010/demo/Form1.cs b/qpid/dotnet/client-010/demo/Form1.cs deleted file mode 100644 index 68a240189e..0000000000 --- a/qpid/dotnet/client-010/demo/Form1.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace demo -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/qpid/dotnet/client-010/demo/Program.cs b/qpid/dotnet/client-010/demo/Program.cs index 62730eb9b0..429fe1bf69 100644 --- a/qpid/dotnet/client-010/demo/Program.cs +++ b/qpid/dotnet/client-010/demo/Program.cs @@ -15,9 +15,7 @@ namespace WindowsClient static void Main(string[] args) { XmlConfigurator.Configure(new FileInfo("..\\..\\log.xml")); - // DOMConfigurator.Configure(); - - Console.WriteLine("befing"); + // DOMConfigurator.Configure() Client client = new Client(); Console.WriteLine("Client created"); client.connect("192.168.1.14", 5673, "test", "guest", "guest"); diff --git a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs index e677e91990..eab12ce3c7 100644 --- a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Qpid Demo")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Built from svn revision number: ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apache Software Foundation")] [assembly: AssemblyProduct("Qpid Demo")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyCopyright("Apache Software Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/demo/default.build b/qpid/dotnet/client-010/demo/default.build new file mode 100644 index 0000000000..01cad35665 --- /dev/null +++ b/qpid/dotnet/client-010/demo/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs index 197c2aa080..7de372bb29 100644 --- a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Qpid Test")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Built from svn revision number: ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apache Software Foundation")] [assembly: AssemblyProduct("Qpid Test")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyCopyright("Apache Software Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/test/default.build b/qpid/dotnet/client-010/test/default.build new file mode 100644 index 0000000000..76b1b3ea85 --- /dev/null +++ b/qpid/dotnet/client-010/test/default.build @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From d6cebdfac24c729d0088fca54fc9d19e0fa9f915 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Wed, 10 Sep 2008 11:45:38 +0000 Subject: qpid-1277: removed .back files and updated Composite file git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@693799 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/Composite.tpl.bak | 273 --------------------- .../client-010/gentool/MethodDelegate.tpl.bak | 14 -- qpid/dotnet/client-010/gentool/build.xml.bak | 52 ---- .../client-010/gentool/dotnetgenutil$py.class | Bin 19091 -> 0 bytes 4 files changed, 339 deletions(-) delete mode 100644 qpid/dotnet/client-010/gentool/Composite.tpl.bak delete mode 100644 qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak delete mode 100644 qpid/dotnet/client-010/gentool/build.xml.bak delete mode 100644 qpid/dotnet/client-010/gentool/dotnetgenutil$py.class (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl.bak b/qpid/dotnet/client-010/gentool/Composite.tpl.bak deleted file mode 100644 index 660980c448..0000000000 --- a/qpid/dotnet/client-010/gentool/Composite.tpl.bak +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using org.apache.qpid.transport.codec; -using System.Collections.Generic; -using org.apache.qpid.transport.util; -using org.apache.qpid.transport.network; -using System.IO; - -namespace org.apache.qpid.transport -{ - -${ -from genutil import * - -cls = klass(type)["@name"] - -segments = type["segments"] - -if type.name in ("control", "command"): - override = "override" - base = "Method" - size = 0 - pack = 2 - if segments: - payload = "true" - else: - payload = "false" - if type.name == "control" and cls == "connection": - track = "Frame.L1" - elif cls == "session" and type["@name"] in ("attach", "attached", "detach", "detached"): - track = "Frame.L2" - elif type.name == "command": - track = "Frame.L4" - else: - track = "Frame.L3" -else: - override = "" - base = "Struct" - size = type["@size"] - pack = num(type["@pack"]) - payload = "false" - track = "4" - -PACK_TYPES = { - 1: "byte", - 2: "short", - 4: "int" -} - -typecode = code(type) -} - -public sealed class $name : $base { - - public const int TYPE = $typecode; - - public override int getStructType() { - return TYPE; - } - - public override int getSizeWidth() { - return $size; - } - - public override int getPackWidth() { - return $pack; - } - - public $override bool hasPayload() { - return $payload; - } - - public $override byte EncodedTrack - { - get{ return $track; } - set { throw new NotImplementedException(); } - } - -${ -from dotnetgenutil import * -if pack > 0: - out(" private $(PACK_TYPES[pack]) packing_flags = 0;\n"); - -fields = get_fields(type) -params = get_dotnetparameters(type, fields) -options = get_options(fields) - -for f in fields: - if not f.empty: - out(" private $(f.type) _$(f.name);\n") - -if segments: - out(" private Header _header;\n") - out(" private MemoryStream _body;\n") -} - -${ -if fields: - out(" public $name() {}\n") -} - - public $name($(", ".join(params))) { -${ -for f in fields: - if f.option: continue - out(" $(f.set)($(f.name));\n") - -if segments: - out(" Header = header;\n") - out(" Body = body;\n") - -if options or base == "Method": - out(""" - for (int i=0; i < _options.Length; i++) { - switch (_options[i]) { -""") - - for f in options: - out(" case Option.$(f.option): packing_flags |= $(f.flag_mask(pack)); break;\n") - - if base == "Method": - out(""" case Option.SYNC: Sync = true; break; - case Option.BATCH: Batch = true; break; -""") - out(""" case Option.NONE: break; - default: throw new Exception("invalid option: " + _options[i]); - } - } -""") -} - } - - public $override void dispatch(C context, MethodDelegate mdelegate) { - mdelegate.$(dromedary(name))(context, this); - } - -${ -for f in fields: - if pack > 0: - out(""" - public bool $(f.has)() { - return (packing_flags & $(f.flag_mask(pack))) != 0; - } - - public $name $(f.clear)() { - packing_flags = (byte) (packing_flags & ~$(f.flag_mask(pack))); -${ -if (not f.empty and not (f.default == "null")): - out(" _$(f.name) = $(f.default);") -} - Dirty = true; - return this; - } -""") - - out(""" - public $(f.type) $(f.get)() { -${ -if f.empty: - out(" return $(f.has)();") -else: - out(" return _$(f.name);") -} - } - - public $name $(f.set)($(f.type) value) { -${ -if not f.empty: - out(" _$(f.name) = value;") -} -${ -if pack > 0: - out(" packing_flags |= $(f.flag_mask(pack));") -} - Dirty = true; - return this; - } - - public $name $(f.name)($(f.type) value) { - return $(f.set)(value); - } -""") -} - -${ -if segments: - out(""" public Header Header { - get { return _header;} - set { _header = value;} - } - - public $name header(Header header) { - Header = header; - return this; - } - - public MemoryStream Body - { - get{ return _body;} - set{ _body = value;} - } - - public $name body(MemoryStream body) - { - Body = body; - return this; - } -""") -} - - public override void write(Encoder enc) - { -${ -if pack > 0: - out(" enc.writeUint%s(packing_flags);\n" % (pack*8)); - -for f in fields: - if f.empty: - continue - if pack > 0: - out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") - pre = "" - post = "" - if f.type_node.name == "struct": - pre = "%s.TYPE, " % cname(f.type_node) - elif f.type_node.name == "domain": - post = "" - pre = "(short)" - out(" enc.write$(f.coder)($(pre)_$(f.name)$(post));\n") -} - } - - public override void read(Decoder dec) - { -${ -if pack > 0: - out(" packing_flags = ($(PACK_TYPES[pack])) dec.readUint%s();\n" % (pack*8)); - -for f in fields: - if f.empty: - continue - if pack > 0: - out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") - pre = "" - post = "" - arg = "" - if f.type_node.name == "struct": - pre = "(%s)" % cname(f.type_node) - arg = "%s.TYPE" % cname(f.type_node) - elif f.type_node.name == "domain": - pre = "%sGetter.get(" % cname(f.type_node) - post = ")" - out(" _$(f.name) = $(pre)dec.read$(f.coder)($(arg))$(post);\n") -} - } - - public override Dictionary Fields - { - get{ - Dictionary result = new Dictionary(); - -${ -for f in fields: - if pack > 0: - out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") - out(' result.Add("_$(f.name)", $(f.get)());\n') -} - - return result; - } - } - -} -} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak deleted file mode 100644 index 58a578b556..0000000000 --- a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl.bak +++ /dev/null @@ -1,14 +0,0 @@ -namespace org.apache.qpid.transport -{ - -public abstract class MethodDelegate { - -${ -from genutil import * - -for c in composites: - name = cname(c) - out(" public void $(dromedary(name))(C context, $name mystruct) {}\n") -} -} -} \ No newline at end of file diff --git a/qpid/dotnet/client-010/gentool/build.xml.bak b/qpid/dotnet/client-010/gentool/build.xml.bak deleted file mode 100644 index d0d8d9297f..0000000000 --- a/qpid/dotnet/client-010/gentool/build.xml.bak +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class b/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class deleted file mode 100644 index ddb8855f7c..0000000000 Binary files a/qpid/dotnet/client-010/gentool/dotnetgenutil$py.class and /dev/null differ -- cgit v1.2.1 From 26acdc039853786717e5392f567fc84dcf9db82c Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Wed, 10 Sep 2008 11:59:45 +0000 Subject: qpid-1277: updated Composite to override Head and Body git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@693804 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/Composite.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl b/qpid/dotnet/client-010/gentool/Composite.tpl index 3b8bb00850..6020964019 100644 --- a/qpid/dotnet/client-010/gentool/Composite.tpl +++ b/qpid/dotnet/client-010/gentool/Composite.tpl @@ -183,7 +183,7 @@ if pack > 0: ${ if segments: - out(""" public Header Header { + out(""" public override Header Header { get { return _header;} set { _header = value;} } @@ -193,13 +193,13 @@ if segments: return this; } - public MemoryStream Body + public override MemoryStream Body { get{ return _body;} set{ _body = value;} } - public $name body(MemoryStream body) + public $name body(MemoryStream body) { Body = body; return this; -- cgit v1.2.1 From c2b15bd68f4e6fe060b29cccd93d249c2314bb17 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 11 Sep 2008 11:39:47 +0000 Subject: qpid-1277: added tests and fixed rangeSet + future issue because of the nonvariant nature of C# generics git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@694220 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/transport/Channel.cs | 3 +- .../client-010/client/transport/ChannelDelegate.cs | 24 ++- qpid/dotnet/client-010/client/transport/Future.cs | 4 +- qpid/dotnet/client-010/client/transport/Range.cs | 44 +++--- .../dotnet/client-010/client/transport/RangeSet.cs | 175 ++++++++++----------- qpid/dotnet/client-010/client/transport/Session.cs | 11 +- .../client/transport/network/io/IoReceiver.cs | 3 +- .../client/transport/util/ResultFuture.cs | 8 +- qpid/dotnet/client-010/default.build | 5 + qpid/dotnet/client-010/gentool/Invoker.tpl | 6 +- qpid/dotnet/client-010/log.xml | 26 +++ qpid/dotnet/client-010/test/interop/Admin.cs | 90 +++++++++++ qpid/dotnet/client-010/test/interop/TestCase.cs | 93 +++++++++++ qpid/dotnet/client-010/test/test.config | 10 ++ .../client-010/test/transport/util/UUIDTest.cs | 21 ++- 15 files changed, 385 insertions(+), 138 deletions(-) create mode 100644 qpid/dotnet/client-010/log.xml create mode 100644 qpid/dotnet/client-010/test/interop/Admin.cs create mode 100644 qpid/dotnet/client-010/test/interop/TestCase.cs create mode 100644 qpid/dotnet/client-010/test/test.config (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/Channel.cs b/qpid/dotnet/client-010/client/transport/Channel.cs index d7ccc6eec8..6915c123e7 100644 --- a/qpid/dotnet/client-010/client/transport/Channel.cs +++ b/qpid/dotnet/client-010/client/transport/Channel.cs @@ -21,7 +21,6 @@ using System; using org.apache.qpid.transport.network; using org.apache.qpid.transport.util; -using SessionDelegate=org.apache.qpid.transport.SessionDelegate; namespace org.apache.qpid.transport { @@ -162,7 +161,7 @@ namespace org.apache.qpid.transport method(m); } - public override Future invoke(Method m, Future future) + public override Future invoke(Method m, Future future) { throw new Exception("UnsupportedOperation"); } diff --git a/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs index 5e9fad6e40..34126ddbf4 100644 --- a/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs @@ -20,14 +20,22 @@ */ namespace org.apache.qpid.transport { - - - /// - /// ChannelDelegate - /// - /// - - class ChannelDelegate : MethodDelegate + /// + /// ChannelDelegate + /// + /// + internal class ChannelDelegate : MethodDelegate { + 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/Future.cs b/qpid/dotnet/client-010/client/transport/Future.cs index f636e91914..ddb07f1dda 100644 --- a/qpid/dotnet/client-010/client/transport/Future.cs +++ b/qpid/dotnet/client-010/client/transport/Future.cs @@ -24,9 +24,9 @@ namespace org.apache.qpid.transport /// /// Future /// - public interface Future + public interface Future { - T Result + Struct Result { get; set; } diff --git a/qpid/dotnet/client-010/client/transport/Range.cs b/qpid/dotnet/client-010/client/transport/Range.cs index 37e0761794..a5bc4f0488 100644 --- a/qpid/dotnet/client-010/client/transport/Range.cs +++ b/qpid/dotnet/client-010/client/transport/Range.cs @@ -32,66 +32,66 @@ namespace org.apache.qpid.transport public sealed class Range { - private int lower; - private int upper; + private int _lower; + private int _upper; public Range(int lower, int upper) { - this.lower = lower; - this.upper = upper; + _lower = lower; + _upper = upper; } public int Lower { - get { return lower; } - set { lower = value; } + get { return _lower; } + set { _lower = value; } } public int Upper { - get { return upper; } - set { upper = value; } + get { return _upper; } + set { _upper = value; } } public bool includes(int value) { - return Serial.le(lower, value) && Serial.le(value, upper); + return Serial.le(_lower, value) && Serial.le(value, _upper); } public bool includes(Range range) { - return includes(range.lower) && includes(range.upper); + 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)); + 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)); + 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)); + return new Range(Serial.min(_lower, range._lower), Serial.max(_upper, range._upper)); } public List subtract(Range range) { List result = new List(); - if (includes(range.lower) && Serial.le(lower, range.lower - 1)) + if (includes(range._lower) && Serial.le(_lower, range._lower - 1)) { - result.Add(new Range(lower, range.lower - 1)); + result.Add(new Range(_lower, range._lower - 1)); } - if (includes(range.upper) && Serial.le(range.upper + 1, upper)) + if (includes(range._upper) && Serial.le(range._upper + 1, _upper)) { - result.Add(new Range(range.upper + 1, upper)); + result.Add(new Range(range._upper + 1, _upper)); } if (result.Count == 0 && !range.includes(this)) @@ -104,14 +104,14 @@ namespace org.apache.qpid.transport public Range intersect(Range range) { - int l = Serial.max(lower, range.lower); - int r = Serial.min(upper, range.upper); + 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 + "]"; + 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 d0ee1d4916..0c502541ec 100644 --- a/qpid/dotnet/client-010/client/transport/RangeSet.cs +++ b/qpid/dotnet/client-010/client/transport/RangeSet.cs @@ -27,127 +27,124 @@ using org.apache.qpid.transport.util; namespace org.apache.qpid.transport { - - - /// + /// /// RangeSet - /// - - public sealed class RangeSet : IEnumerable - { - private readonly LinkedList ranges = new LinkedList(); + /// + public sealed class RangeSet : IEnumerable + { + private readonly List _ranges = new List(); - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } - public IEnumerator GetEnumerator() - { - return ranges.GetEnumerator(); - } + public IEnumerator GetEnumerator() + { + return _ranges.GetEnumerator(); + } - public int size() - { - return ranges.Count; - } + public int size() + { + return _ranges.Count; + } - - public Range getFirst() - { - return ranges.First.Value; - } + public Range getFirst() + { + return _ranges[0]; + } - public bool includes(Range range) - { - foreach (Range r in this) + public bool includes(Range range) { - if (r.includes(range)) + foreach (Range r in this) { - return true; + if (r.includes(range)) + { + return true; + } } - } - return false; - } + return false; + } - public bool includes(int n) - { - foreach (Range r in this) + public bool includes(int n) { - if (r.includes(n)) + foreach (Range r in this) { - return true; + if (r.includes(n)) + { + return true; + } } - } - return false; - } + return false; + } - public void add(Range range) - { - foreach (Range r in ranges) + public void add(Range range) { - if (range.touches(r)) + for (int i = 0; i < _ranges.Count; i++) { - ranges.Remove(r); - range = range.span(r); - } - else if (Serial.lt(range.Upper, r.Lower )) - { - ranges.AddBefore(ranges.Find(r), range); - return; + 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); } - ranges.AddLast(range); - } - - public void add(int lower, int upper) - { - add(new Range(lower, upper)); - } - public void add(int value) - { - add(value, value); - } + public void add(int lower, int upper) + { + add(new Range(lower, upper)); + } - public void clear() - { - ranges.Clear(); - } + public void add(int value) + { + add(value, value); + } - public RangeSet copy() - { - RangeSet copy = new RangeSet(); - foreach( Range r in ranges) + public void clear() { - copy.ranges.AddLast(r); - } - return copy; - } + _ranges.Clear(); + } - public String toString() - { - StringBuilder str = new StringBuilder(); - str.Append("{"); - bool first = true; - foreach (Range range in ranges) + public RangeSet copy() { - if (first) + RangeSet copy = new RangeSet(); + foreach (Range r in _ranges) { - first = false; + copy._ranges.Add(r); } - else + return copy; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append("{"); + bool first = true; + foreach (Range range in _ranges) { - str.Append(", "); + if (first) + { + first = false; + } + else + { + str.Append(", "); + } + str.Append(range); } - str.Append(range); + str.Append("}"); + return str.ToString(); } - str.Append("}"); - return str.ToString(); } - } } \ 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 54c5c2c462..81c984bb4d 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading; +using common.org.apache.qpid.transport.util; using org.apache.qpid.transport; using org.apache.qpid.transport.util; using Frame = org.apache.qpid.transport.network.Frame; @@ -77,7 +78,7 @@ namespace org.apache.qpid.transport private int _maxComplete = - 1; private bool _needSync = false; private bool _closed; - private readonly Dictionary> _results = new Dictionary>(); + private readonly Dictionary _results = new Dictionary(); private readonly List _exceptions = new List(); @@ -383,7 +384,7 @@ namespace org.apache.qpid.transport public void result(int command, Struct result) { - Future future; + Future future; lock (_results) { if (_results.ContainsKey(command)) @@ -422,7 +423,7 @@ namespace org.apache.qpid.transport } } - public override Future invoke(Method m, Future future) + public override Future invoke(Method m, Future future) { lock (_commands) { @@ -430,7 +431,7 @@ namespace org.apache.qpid.transport int command = _commandsOut; lock (_results) { - _results.Add(command, (Future) future); + _results.Add(command, future); } invoke(m); } @@ -493,7 +494,7 @@ namespace org.apache.qpid.transport } lock (_results) { - foreach (Future result in _results.Values) + foreach (Future result in _results.Values) { lock (result) { 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 b4544fe072..d71093ea55 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -168,8 +168,7 @@ namespace org.apache.qpid.transport.network.io log.debug("Receiver thread terminating"); } catch (Exception t) - { - Console.WriteLine(t); + { if (ExceptionReading != null) { ExceptionReading(this, new ExceptionArgs(t)); diff --git a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs index 8a38cdb356..11e57ed821 100644 --- a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -5,12 +5,12 @@ using org.apache.qpid.transport.util; namespace common.org.apache.qpid.transport.util { - public class ResultFuture : Future where T : Struct + public class ResultFuture : Future { const long _timeout = 60000; private Struct _result; private Session _session; - private static readonly Logger log = Logger.get(typeof(ResultFuture)); + private static readonly Logger log = Logger.get(typeof(ResultFuture)); public Struct get(long timeout) { @@ -32,9 +32,9 @@ namespace common.org.apache.qpid.transport.util return _result; } - public T Result + public Struct Result { - get { return (T) get(_timeout); } + get { return get(_timeout); } set { lock (this) diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 095b6de2e9..74d53f1f35 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -155,6 +155,11 @@ + + + + + diff --git a/qpid/dotnet/client-010/gentool/Invoker.tpl b/qpid/dotnet/client-010/gentool/Invoker.tpl index f1909d2e29..96f58b49ea 100644 --- a/qpid/dotnet/client-010/gentool/Invoker.tpl +++ b/qpid/dotnet/client-010/gentool/Invoker.tpl @@ -9,7 +9,7 @@ namespace org.apache.qpid.transport public abstract class Invoker { protected abstract void invoke(Method method); - public abstract Future invoke(Method method, Future resultClass); + public abstract Future invoke(Method method, Future resultClass); ${ from dotnetgenutil import * @@ -25,9 +25,9 @@ for c in composites: rname = cname(result["struct"]) else: rname = cname(result, "@type") - jresult = "Future<%s>" % rname + jresult = "Future" jreturn = "return " - jclass = ", new ResultFuture<%s>()" % rname + jclass = ", new ResultFuture()" jinvoke = "invoke" else: jinvoke = "invoke" diff --git a/qpid/dotnet/client-010/log.xml b/qpid/dotnet/client-010/log.xml new file mode 100644 index 0000000000..12365f7eb8 --- /dev/null +++ b/qpid/dotnet/client-010/log.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/test/interop/Admin.cs b/qpid/dotnet/client-010/test/interop/Admin.cs new file mode 100644 index 0000000000..93b24ea505 --- /dev/null +++ b/qpid/dotnet/client-010/test/interop/Admin.cs @@ -0,0 +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 + } + + + } +} diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs new file mode 100644 index 0000000000..02f5a327f6 --- /dev/null +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -0,0 +1,93 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using log4net.Config; +using NUnit.Framework; +using org.apache.qpid.client; + +namespace test.interop +{ + [TestFixture] + + public class TestCase + { + private readonly Dictionary _properties = new Dictionary(); + 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", "192.168.1.14"); + _properties.Add("Port", "5673"); + _properties.Add("VirtualHost", "test"); + //Read the test config file + XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + ".\\test.config"); + while (reader.Read()) + { + XmlNodeType nType = reader.NodeType; + // if node type is an element + if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add")) + { + Console.WriteLine("Element:" + reader.Name.ToString()); + 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 Properties + { + get { return _properties; } + } + + } +} diff --git a/qpid/dotnet/client-010/test/test.config b/qpid/dotnet/client-010/test/test.config new file mode 100644 index 0000000000..dc284f25f1 --- /dev/null +++ b/qpid/dotnet/client-010/test/test.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs index 6ece267e07..c073f1139a 100644 --- a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs @@ -1,4 +1,23 @@ - +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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; -- cgit v1.2.1 From a95b0040821ed7db6cff873f934c5153c0675e6c Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 12 Sep 2008 07:34:44 +0000 Subject: qpid-1277: fixed large messages issue; added more tests git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@694628 13f79535-47bb-0310-9956-ffa450edef68 --- .../client/transport/network/Assembler.cs | 31 ++-- .../client/transport/network/Disassembler.cs | 14 +- .../client/transport/network/IIoSender.cs | 28 ++++ .../client/transport/network/InputHandler.cs | 25 ++- .../client/transport/network/io/IoReceiver.cs | 1 - .../client/transport/network/io/IoSender.cs | 25 +-- qpid/dotnet/client-010/test/interop/Message.cs | 181 +++++++++++++++++++++ qpid/dotnet/client-010/test/interop/TestCase.cs | 8 +- 8 files changed, 264 insertions(+), 49 deletions(-) create mode 100644 qpid/dotnet/client-010/client/transport/network/IIoSender.cs create mode 100644 qpid/dotnet/client-010/test/interop/Message.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/network/Assembler.cs b/qpid/dotnet/client-010/client/transport/network/Assembler.cs index 89bd592f96..65d9061e0a 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -35,7 +35,7 @@ namespace org.apache.qpid.transport.network public class Assembler : NetworkDelegate, Receiver> { private static readonly Logger log = Logger.get(typeof (Assembler)); - private readonly Dictionary> segments; + private readonly Dictionary> segments; private readonly Method[] incomplete; [ThreadStatic] static MSDecoder _decoder; private readonly Object m_objectLock = new object(); @@ -101,7 +101,7 @@ namespace org.apache.qpid.transport.network public Assembler() { - segments = new Dictionary>(); + segments = new Dictionary>(); incomplete = new Method[64*1024]; } @@ -133,27 +133,28 @@ namespace org.apache.qpid.transport.network } else { - List frames; + List frames; if (frame.isFirstFrame()) { - frames = new List(); + frames = new List(); setSegment(frame, frames); } else { frames = getSegment(frame); } - - frames.Add(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 (Frame f in frames) + foreach (byte[] f in frames) { - w.Write(f.Body.ToArray()); + w.Write(f); } assemble(frame, segment); } @@ -219,13 +220,9 @@ namespace org.apache.qpid.transport.network } break; case SegmentType.BODY: - command = incomplete[channel]; - byte[] b = new byte[frame.BodySize]; - MemoryStream body = new MemoryStream(); - segment.Read(b, 0, b.Length); - body.Write(b, 0, b.Length); - body.Seek(0, SeekOrigin.Begin); - command.Body = body; + command = incomplete[channel]; + segment.Seek(0, SeekOrigin.Begin); + command.Body = segment; incomplete[channel] = null; Emit(channel, command); break; @@ -239,12 +236,12 @@ namespace org.apache.qpid.transport.network return (frame.Track + 1)*frame.Channel; } - private List getSegment(Frame frame) + private List getSegment(Frame frame) { return segments[segmentKey(frame)]; } - private void setSegment(Frame frame, List segment) + private void setSegment(Frame frame, List segment) { int key = segmentKey(frame); if (segments.ContainsKey(key)) diff --git a/qpid/dotnet/client-010/client/transport/network/Disassembler.cs b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs index c1e6744f2c..4cf16a98fe 100644 --- a/qpid/dotnet/client-010/client/transport/network/Disassembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs @@ -30,7 +30,7 @@ namespace org.apache.qpid.transport.network /// public sealed class Disassembler : Sender, ProtocolDelegate { - private readonly Sender _sender; + private readonly IIOSender _sender; private readonly int _maxPayload; private readonly MemoryStream _header; private readonly BinaryWriter _writer; @@ -38,7 +38,7 @@ namespace org.apache.qpid.transport.network [ThreadStatic] static MSEncoder _encoder; - public Disassembler(Sender sender, int maxFrame) + public Disassembler(IIOSender sender, int maxFrame) { if (maxFrame <= Frame.HEADER_SIZE || maxFrame >= 64*1024) { @@ -120,8 +120,8 @@ namespace org.apache.qpid.transport.network _writer.Write((byte)0); _writer.Write((byte)0); _sender.send(_header); - _header.Seek(0, SeekOrigin.Begin); - _sender.send(buf); + _header.Seek(0, SeekOrigin.Begin); + _sender.send(buf, size); } } @@ -129,13 +129,13 @@ namespace org.apache.qpid.transport.network { 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; + remaining -= size; byte newflags = flags; if (first) @@ -146,7 +146,7 @@ namespace org.apache.qpid.transport.network if (remaining == 0) { newflags |= Frame.LAST_FRAME; - } + } frame(newflags, typeb, track, mevent.Channel, size, buf); diff --git a/qpid/dotnet/client-010/client/transport/network/IIoSender.cs b/qpid/dotnet/client-010/client/transport/network/IIoSender.cs new file mode 100644 index 0000000000..67a52ef707 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/IIoSender.cs @@ -0,0 +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:Sender + { + 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 244bf5a3ff..f3bffdb821 100644 --- a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs +++ b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs @@ -127,7 +127,11 @@ namespace org.apache.qpid.transport.network public void On_ReceivedBuffer(object sender, ReceivedPayload payload) { MemoryStream buf = payload.Payload; - int remaining = (int)buf.Length; + int remaining = (int) buf.Length; + if( input != null ) + { + remaining += (int) input.Length; + } try { while (remaining > 0) @@ -136,10 +140,9 @@ namespace org.apache.qpid.transport.network { if (input != null) { - remaining += (int) input.Length; - byte[] tmp = new byte[remaining]; - buf.Read(tmp, 0, remaining); - input.Write(tmp, 0, remaining); + 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; } @@ -155,13 +158,19 @@ namespace org.apache.qpid.transport.network } else { + byte[] tmp; if (input == null) { input = new MemoryStream(); + tmp = new byte[remaining]; + } + else + { + // this is a full buffer + tmp = new byte[buf.Length]; } - byte[] tmp = new byte[remaining]; - buf.Read(tmp, 0, remaining); - input.Write(tmp, 0, remaining); + buf.Read(tmp, 0, tmp.Length); + input.Write(tmp, 0, tmp.Length); remaining = 0; } } 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 d71093ea55..e080ee5899 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -21,7 +21,6 @@ using System; using System.IO; using System.Threading; -using TransportException = org.apache.qpid.transport.TransportException; using Logger = org.apache.qpid.transport.util.Logger; 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 38fda3e1e2..810e0b8cf4 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -17,7 +17,6 @@ * under the License. */ using System; -using System.Collections.Generic; using System.IO; using System.Net.Sockets; using System.Threading; @@ -26,7 +25,7 @@ using org.apache.qpid.transport.util; namespace org.apache.qpid.transport.network.io { - public sealed class IoSender : Sender + public sealed class IoSender : IIOSender { private static readonly Logger log = Logger.get(typeof (IoReceiver)); private readonly NetworkStream bufStream; @@ -35,12 +34,12 @@ namespace org.apache.qpid.transport.network.io private readonly CircularBuffer queue; private readonly Thread thread; private readonly int timeout; - private MemoryStream _tobeSent = new MemoryStream(); + private readonly MemoryStream _tobeSent = new MemoryStream(); public IoSender(IoTransport transport, int queueSize, int timeout) { this.timeout = timeout; bufStream = transport.Stream; - queue = new CircularBuffer(2); + queue = new CircularBuffer(queueSize); thread = new Thread(Go); log.debug("Creating IoSender thread"); thread.Name = String.Format("IoSender - {0}", transport.Socket) ; @@ -48,20 +47,24 @@ namespace org.apache.qpid.transport.network.io 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(); - int length = (int)str.Position; - str.Seek(0, SeekOrigin.Begin); - byte[] buf = new byte[length]; - str.Read(buf, 0, length); - _tobeSent.Write(buf, 0, length); + mutClosed.ReleaseMutex(); + byte[] buf = new byte[size]; + str.Read(buf, 0, size); + _tobeSent.Write(buf, 0, size); } public void flush() diff --git a/qpid/dotnet/client-010/test/interop/Message.cs b/qpid/dotnet/client-010/test/interop/Message.cs new file mode 100644 index 0000000000..79c22e0acf --- /dev/null +++ b/qpid/dotnet/client-010/test/interop/Message.cs @@ -0,0 +1,181 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 client.client; +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 : MessageListener + { + 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(MessageTransfer 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 02f5a327f6..9f410a9e9e 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -43,18 +43,16 @@ namespace test.interop // populate default properties _properties.Add("UserName", "guest"); _properties.Add("Password", "guest"); - _properties.Add("Host", "192.168.1.14"); - _properties.Add("Port", "5673"); + _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()) - { - XmlNodeType nType = reader.NodeType; + { // if node type is an element if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add")) { - Console.WriteLine("Element:" + reader.Name.ToString()); if (_properties.ContainsKey(reader.GetAttribute("key"))) { _properties[reader.GetAttribute("key")] = reader.GetAttribute("value"); -- cgit v1.2.1 From b7e83d8a1425cb7b34b1db82e789615def8a2177 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Tue, 16 Sep 2008 07:54:12 +0000 Subject: qpid-1277: fixed small messages issue found when testing wcf git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@695758 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/transport/network/Assembler.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/network/Assembler.cs b/qpid/dotnet/client-010/client/transport/network/Assembler.cs index 65d9061e0a..53a38eff32 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -127,9 +127,13 @@ namespace org.apache.qpid.transport.network { MemoryStream segment; if (frame.isFirstFrame() && frame.isLastFrame()) - { - segment = frame.Body; - assemble(frame, segment); + { + 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 { -- cgit v1.2.1 From 6970fd34c1f6b86608d30dbf77020869d9d72b3c Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Tue, 16 Sep 2008 21:19:44 +0000 Subject: qpid-1277: fixed Date issue git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@696068 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Client.cs | 4 ++-- qpid/dotnet/client-010/client/transport/Session.cs | 8 ++++---- qpid/dotnet/client-010/client/transport/util/ResultFuture.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 6759c6dbdc..f07609380f 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -74,12 +74,12 @@ namespace org.apache.qpid.client ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); lock (CloseOk) { - long start = DateTime.Now.Millisecond; + DateTime start = DateTime.Now; long elapsed = 0; while (!Closed && elapsed < timeout) { Monitor.Wait(CloseOk, (int) (timeout - elapsed)); - elapsed = DateTime.Now.Millisecond - start; + elapsed = DateTime.Now.Subtract(start).Milliseconds; } if (!Closed) { diff --git a/qpid/dotnet/client-010/client/transport/Session.cs b/qpid/dotnet/client-010/client/transport/Session.cs index 81c984bb4d..f97fb44568 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -354,7 +354,7 @@ namespace org.apache.qpid.transport executionSync(Option.SYNC); } - long start = DateTime.Now.Millisecond; + DateTime start = DateTime.Now; long elapsed = 0; while (! Closed && elapsed < timeout && Serial.lt(_maxComplete, point)) @@ -362,7 +362,7 @@ namespace org.apache.qpid.transport log.debug("{0} waiting for[{1}]: {2}, {3}", this, point, _maxComplete, _commands); Monitor.Wait(_commands, (int) (timeout - elapsed)); - elapsed = DateTime.Now.Millisecond - start; + elapsed = DateTime.Now.Subtract(start).Milliseconds; } if (Serial.lt(_maxComplete, point)) @@ -469,13 +469,13 @@ namespace org.apache.qpid.transport sessionDetach(_name); lock (_commands) { - long start = DateTime.Now.Millisecond; + DateTime start = DateTime.Now; long elapsed = 0; while (! Closed && elapsed < _timeout) { Monitor.Wait(_commands, (int) (_timeout - elapsed)); - elapsed = DateTime.Now.Millisecond - start; + elapsed = DateTime.Now.Subtract(start).Milliseconds; } } } diff --git a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs index 11e57ed821..dd10e6a74a 100644 --- a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -16,13 +16,13 @@ namespace common.org.apache.qpid.transport.util { lock (this) { - long start = DateTime.Now.Millisecond; + DateTime start = DateTime.Now; long elapsed = 0; while (! _session.Closed && _timeout - elapsed > 0 && _result == null) { log.debug("{0} waiting for result: {1}", _session, this ); Monitor.Wait(this, (int) (timeout - elapsed)); - elapsed = DateTime.Now.Millisecond - start; + elapsed = DateTime.Now.Subtract( start ).Milliseconds; } } if( _session.Closed ) -- cgit v1.2.1 From 2a56cde99670c1efd1c502a60011ec9deb4d6966 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Wed, 17 Sep 2008 13:47:06 +0000 Subject: QPID-1281: Added wcf support + demos git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@696292 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/wcf/Properties/AssemblyInfo.cs | 36 ++++ qpid/dotnet/client-010/wcf/demo/ConfigDemo.suo | Bin 0 -> 23552 bytes qpid/dotnet/client-010/wcf/demo/Demo.suo | Bin 0 -> 33280 bytes .../wcf/demo/wcfBookingClient/Form1.Designer.cs | 164 +++++++++++++++ .../client-010/wcf/demo/wcfBookingClient/Form1.cs | 74 +++++++ .../wcf/demo/wcfBookingClient/Form1.resx | 123 ++++++++++++ .../wcf/demo/wcfBookingClient/Program.cs | 21 ++ .../wcfBookingClient/Properties/AssemblyInfo.cs | 36 ++++ .../Properties/Resources.Designer.cs | 71 +++++++ .../wcfBookingClient/Properties/Resources.resx | 117 +++++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../wcfBookingClient/Properties/Settings.settings | 7 + .../demo/wcfBookingClient/wcBookingClient.csproj | 103 ++++++++++ .../wcf/demo/wcfBookingServer/Booking.cs | 62 ++++++ .../wcf/demo/wcfBookingServer/IBooking.cs | 43 ++++ .../client-010/wcf/demo/wcfBookingServer/Order.cs | 45 +++++ .../wcf/demo/wcfBookingServer/Program.cs | 98 +++++++++ .../wcfBookingServer/Properties/AssemblyInfo.cs | 36 ++++ .../wcf/demo/wcfBookingServer/Receipt.cs | 46 +++++ .../demo/wcfBookingServer/wcfBookingServer.csproj | 77 ++++++++ .../client-010/wcf/demo/wcfHelloClient/App.config | 35 ++++ .../wcf/demo/wcfHelloClient/HelloClient.cs | 36 ++++ .../wcf/demo/wcfHelloClient/IHelloService.cs | 33 ++++ .../client-010/wcf/demo/wcfHelloClient/Program.cs | 48 +++++ .../demo/wcfHelloClient/Properties/AssemblyInfo.cs | 36 ++++ .../wcf/demo/wcfHelloClient/wcfHelloClient.csproj | 65 ++++++ .../client-010/wcf/demo/wcfHelloServer/App.config | 43 ++++ .../wcf/demo/wcfHelloServer/HelloService.cs | 34 ++++ .../wcf/demo/wcfHelloServer/IHelloService.cs | 32 +++ .../client-010/wcf/demo/wcfHelloServer/Program.cs | 47 +++++ .../demo/wcfHelloServer/Properties/AssemblyInfo.cs | 36 ++++ .../wcf/demo/wcfHelloServer/wcfHelloServer.csproj | 73 +++++++ .../client-010/wcf/demo/wcfRPC/IUpperCase.cs | 31 +++ qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs | 113 +++++++++++ .../wcf/demo/wcfRPC/Properties/AssemblyInfo.cs | 36 ++++ .../demo/wcfRPC/QpidBindingConfigurationElement.cs | 205 +++++++++++++++++++ .../dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs | 33 ++++ .../client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 73 +++++++ .../client-010/wcf/model/CommunicationOperation.cs | 31 +++ qpid/dotnet/client-010/wcf/model/QpidBinding.cs | 185 +++++++++++++++++ .../dotnet/client-010/wcf/model/QpidChannelBase.cs | 167 ++++++++++++++++ .../client-010/wcf/model/QpidChannelFactory.cs | 74 +++++++ .../client-010/wcf/model/QpidChannelListener.cs | 79 ++++++++ .../wcf/model/QpidChannelListenerBase.cs | 111 +++++++++++ .../client-010/wcf/model/QpidInputChannel.cs | 219 +++++++++++++++++++++ .../client-010/wcf/model/QpidInputChannelBase.cs | 101 ++++++++++ .../client-010/wcf/model/QpidOutputChannel.cs | 89 +++++++++ .../client-010/wcf/model/QpidOutputChannelBase.cs | 77 ++++++++ .../wcf/model/QpidTransportBindingElement.cs | 186 +++++++++++++++++ .../client-010/wcf/model/QpidTransportElement.cs | 183 +++++++++++++++++ qpid/dotnet/client-010/wcf/wcf.csproj | 69 +++++++ qpid/dotnet/client-010/wcf/wcf.sln | 50 +++++ qpid/dotnet/client-010/wcf/wcf.suo | Bin 0 -> 91648 bytes 53 files changed, 3819 insertions(+) create mode 100644 qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/ConfigDemo.suo create mode 100644 qpid/dotnet/client-010/wcf/demo/Demo.suo create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs create mode 100644 qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj create mode 100644 qpid/dotnet/client-010/wcf/model/CommunicationOperation.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidBinding.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs create mode 100644 qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs create mode 100644 qpid/dotnet/client-010/wcf/wcf.csproj create mode 100644 qpid/dotnet/client-010/wcf/wcf.sln create mode 100644 qpid/dotnet/client-010/wcf/wcf.suo (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..477c21fd40 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a39d56ec-7d81-48e1-9602-347a3ce6f638")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/ConfigDemo.suo b/qpid/dotnet/client-010/wcf/demo/ConfigDemo.suo new file mode 100644 index 0000000000..baa935693b Binary files /dev/null and b/qpid/dotnet/client-010/wcf/demo/ConfigDemo.suo differ diff --git a/qpid/dotnet/client-010/wcf/demo/Demo.suo b/qpid/dotnet/client-010/wcf/demo/Demo.suo new file mode 100644 index 0000000000..ee4cb5d21e Binary files /dev/null and b/qpid/dotnet/client-010/wcf/demo/Demo.suo differ diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs new file mode 100644 index 0000000000..24ae32cf77 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs @@ -0,0 +1,164 @@ +namespace WindowsFormsBooking +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.button2 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Hotel", + "Taxi", + "Train", + "Cinema", + "Theater", + "Restaurant"}); + this.comboBox1.Location = new System.Drawing.Point(60, 20); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(76, 21); + this.comboBox1.TabIndex = 0; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(23, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Type"; + // + // numericUpDown1 + // + this.numericUpDown1.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericUpDown1.Location = new System.Drawing.Point(60, 49); + this.numericUpDown1.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDown1.Minimum = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(76, 20); + this.numericUpDown1.TabIndex = 2; + this.numericUpDown1.Value = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(23, 56); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(31, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Price"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(142, 20); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(40, 49); + this.button1.TabIndex = 4; + this.button1.Text = "Add"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // richTextBox1 + // + this.richTextBox1.ForeColor = System.Drawing.SystemColors.ControlText; + this.richTextBox1.Location = new System.Drawing.Point(27, 113); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(155, 83); + this.richTextBox1.TabIndex = 5; + this.richTextBox1.Text = ""; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(27, 81); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(155, 29); + this.button2.TabIndex = 6; + this.button2.Text = "Receipt"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(211, 211); + this.Controls.Add(this.button2); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label2); + this.Controls.Add(this.numericUpDown1); + this.Controls.Add(this.label1); + this.Controls.Add(this.comboBox1); + this.Name = "Form1"; + this.Text = "Booking Client"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.Button button2; + } +} + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs new file mode 100644 index 0000000000..e3ce7e0a3f --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs @@ -0,0 +1,74 @@ +using System; +using System.ServiceModel; +using System.Windows.Forms; +using org.apache.qpid.wcf.demo; +using org.apache.qpid.wcf.model; + +namespace WindowsFormsBooking +{ + public partial class Form1 : Form + { + private ChannelFactory _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(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 new file mode 100644 index 0000000000..925d12594b --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs new file mode 100644 index 0000000000..25e2cd2624 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace WindowsFormsBooking +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..5c84747dec --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Booking Client")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Booking Client")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fc8b1e0e-1ca9-46fe-9aae-b1ed046716b8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..ef98621391 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsBooking.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsBooking.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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/wcf/demo/wcfBookingClient/Properties/Resources.resx b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx new file mode 100644 index 0000000000..ffecec851a --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..028322e275 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsBooking.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/wcf/demo/wcfBookingClient/Properties/Settings.settings b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings new file mode 100644 index 0000000000..abf36c5d3d --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj new file mode 100644 index 0000000000..62144a218c --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj @@ -0,0 +1,103 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {4086B3FE-F745-4DCC-952A-682CAE01F4C9} + WinExe + Properties + WindowsFormsBooking + Booking Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + {B34E21C4-A742-4886-8569-1A89490E093E} + wcfBookingServer + + + + + \ 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 new file mode 100644 index 0000000000..8b5e9db760 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs @@ -0,0 +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 +{ + [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] + public class Booking : IBooking + { + private Guid _id; + private List _orders; + + public Booking() + { + _id = Guid.NewGuid(); + _orders = new List(); + } + + 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 new file mode 100644 index 0000000000..80890617aa --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs @@ -0,0 +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 +{ + [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 new file mode 100644 index 0000000000..c6266366c3 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs @@ -0,0 +1,45 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System.Runtime.Serialization; + +namespace org.apache.qpid.wcf.demo +{ + [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 new file mode 100644 index 0000000000..26e22b5103 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs @@ -0,0 +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 +{ + internal class Program + { + private ServiceHost _service; + private ChannelFactory 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(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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..286d8ed354 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Booking Server")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Booking Server")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("12ef158b-ac5f-43b3-99f6-e4a4c096d6f8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs new file mode 100644 index 0000000000..869fdabe21 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs @@ -0,0 +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 +{ + [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 new file mode 100644 index 0000000000..4b5cbdd9e8 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj @@ -0,0 +1,77 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {B34E21C4-A742-4886-8569-1A89490E093E} + Exe + Properties + wcfSession + Booking Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config new file mode 100644 index 0000000000..3237fb8cc0 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000000..0158a0b1ab --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs @@ -0,0 +1,36 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System.ServiceModel; + +namespace org.apache.qpid.wcf.demo +{ + public class HelloClient : ClientBase, 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 new file mode 100644 index 0000000000..5424a931a5 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs @@ -0,0 +1,33 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System.ServiceModel; + +namespace org.apache.qpid.wcf.demo +{ + [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 new file mode 100644 index 0000000000..2d6beebfef --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs @@ -0,0 +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 +{ + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..59c03c642a --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF Hello Client")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF Hello Client")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f7628695-280a-4689-ac6f-1186177f9a25")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj new file mode 100644 index 0000000000..9640114524 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj @@ -0,0 +1,65 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {A24E27DB-A38D-40C9-9879-8390B68C2F06} + Exe + Properties + wcfHelloClient + Qpid WCF Hello Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.0 + + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config new file mode 100644 index 0000000000..60e7e586be --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000000..7ccec54568 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs @@ -0,0 +1,34 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; + +namespace org.apache.qpid.wcf.demo +{ + 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 new file mode 100644 index 0000000000..73bad2ab04 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs @@ -0,0 +1,32 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System.ServiceModel; + +namespace org.apache.qpid.wcf.demo +{ + [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 new file mode 100644 index 0000000000..f010a8b48c --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs @@ -0,0 +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 +{ + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..229fd72767 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF Hello Server")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF Hello Server")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("afa87185-f224-4948-904c-b4f3cd19dadb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj new file mode 100644 index 0000000000..aa75159b54 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj @@ -0,0 +1,73 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} + Exe + Properties + wcfHelloServer + Qpid WCF Hello Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + + + + \ 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 new file mode 100644 index 0000000000..10312c6fe6 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs @@ -0,0 +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 +{ + [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 new file mode 100644 index 0000000000..1c15813155 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs @@ -0,0 +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 +{ + internal class Program + { + private ServiceHost _service; + private ChannelFactory 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(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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..7236da2e5b --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF UpperCase")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF UpperCase")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("14ba3707-3fcc-4033-8bbc-0db65c5424f3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs new file mode 100644 index 0000000000..470fe49734 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/QpidBindingConfigurationElement.cs @@ -0,0 +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 +{ + + /// + /// This configuration element should be imported into the client + /// and server configuration files to provide declarative configuration + /// of a AMQP bound service. + /// + public sealed class QpidBindingConfigurationElement : StandardBindingElement + { + /// + /// Creates a new instance of the QpidBindingConfigurationElement + /// Class initialized with values from the specified configuration. + /// + /// + public QpidBindingConfigurationElement(string configurationName) + : base(configurationName) + { + } + + /// + /// Creates a new instance of the RabbitMQBindingConfigurationElement Class. + /// + 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; + } + + + /// + /// Specifies the host that the binding should connect to. + /// + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// + /// Specifies the broker port number that the binding should connect to. + /// + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + + /// + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// + [ConfigurationProperty("oneWay", DefaultValue = false)] + public bool OneWayOnly + { + get { return ((bool)base["oneWay"]); } + set { base["oneWay"] = value; } + } + + /// + /// Password to use when authenticating with the broker + /// + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// + /// Specifies whether or not WS-AtomicTransactions are supported by the binding + /// + [ConfigurationProperty("transactionFlow", DefaultValue = false)] + public bool TransactionFlowEnabled + { + get { return ((bool)base["transactionFlow"]); } + set { base["transactionFlow"] = value; } + } + + /// + /// The username to use when authenticating with the broker + /// + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + + + /// + /// The virtual host to access. + /// + [ConfigurationProperty("virtualHost", DefaultValue = "test")] + public string VirtualHost + { + get { return ((string)base["virtualHost"]); } + set { base["virtualHost"] = value; } + } + + ///The security realm to use when calling IModel.AccessRequest + [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 new file mode 100644 index 0000000000..955b6132e5 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs @@ -0,0 +1,33 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System.ServiceModel; + +namespace org.apache.qpid.wcf.demo +{ + [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 new file mode 100644 index 0000000000..36d8d62e88 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj @@ -0,0 +1,73 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {C988F456-1025-486F-9BCD-49C0F83B91DB} + Exe + Properties + wcfRPC + Qpid WCF UpperCase + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + \ 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 new file mode 100644 index 0000000000..d32f3b3f40 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/CommunicationOperation.cs @@ -0,0 +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(TimeSpan timeout); + internal delegate TResult CommunicationOperation(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 new file mode 100644 index 0000000000..73b7b92845 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidBinding.cs @@ -0,0 +1,185 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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; + } + + + + /// + /// Gets the scheme used by the binding, soap.amqp + /// + public override string Scheme + { + get { return "soap.amqp"; } + } + + /// + /// Specifies the broker host + /// + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// + /// Specifies the broker port + /// + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// + /// Specifies the username + /// + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// + /// Specifies the password + /// + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// + /// Specifies the virtualhost + /// + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + + /// + /// Gets the AMQP _transport binding element + /// + public QpidTransportBindingElement Transport + { + get { return _transport; } + } + + /// + /// Gets the reliable _session parameters for this binding instance + /// + public ReliableSession ReliableSession + { + get { return new ReliableSession(_session); } + } + + /// + /// Determines whether or not the TransactionFlowBindingElement will + /// be added to the channel stack + /// + public bool TransactionFlow + { + get { return _transactionsEnabled; } + set { _transactionsEnabled = value; } + } + + /// + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// + 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 new file mode 100644 index 0000000000..25789a7955 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelBase.cs @@ -0,0 +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() 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 new file mode 100644 index 0000000000..fd26cbed99 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelFactory.cs @@ -0,0 +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 + { + 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(); + } + + 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 new file mode 100644 index 0000000000..ea795775b4 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelListener.cs @@ -0,0 +1,79 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; +using System.ServiceModel; +using System.ServiceModel.Channels; +using org.apache.qpid.client; + +namespace org.apache.qpid.wcf.model +{ + public sealed class QpidChannelListener : QpidChannelListenerBase + { + + 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 new file mode 100644 index 0000000000..f2bba9316a --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidChannelListenerBase.cs @@ -0,0 +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 : ChannelListenerBase 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 _acceptChannelMethod; + private readonly CommunicationOperation _waitForChannelMethod; + + protected QpidChannelListenerBase(BindingContext context) + { + _context = context; + _bindingElement = context.Binding.Elements.Find(); + _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 new file mode 100644 index 0000000000..0bf50792cb --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs @@ -0,0 +1,219 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 client.client; +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(); + var encoderElem = context.BindingParameters.Find(); + if (encoderElem != null) + { + _encoder = encoderElem.CreateMessageEncoderFactory().Encoder; + } + _session = session; + _queueName = address.Uri.ToString(); + _queue = new BlockingQueue(); + } + + + public override Message Receive(TimeSpan timeout) + { + _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1); + _session.sync(); + MessageTransfer m = _queue.Dequeue(); + 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 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 : MessageListener + { + private static readonly Logger _log = Logger.get(typeof (WCFListener)); + private readonly BlockingQueue _q; + + public WCFListener(BlockingQueue q) + { + _q = q; + } + + public void messageTransfer(MessageTransfer m) + { + _log.debug("message received by listener"); + _q.Enqueue(m); + } + } + + internal class BlockingQueue + { + private int _count; + private readonly Queue _queue = new Queue(); + + public MessageTransfer 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 MessageTransfer Dequeue() + { + lock (_queue) + { + while (_count <= 0) + { + Monitor.Wait(_queue); + } + if (_count > 0) + { + _count--; + return _queue.Dequeue(); + } + return null; + } + } + + public void Enqueue(MessageTransfer 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 new file mode 100644 index 0000000000..94aa459eab --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidInputChannelBase.cs @@ -0,0 +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 _receiveMethod; + private readonly CommunicationOperation _tryReceiveMethod; + private readonly CommunicationOperation _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 new file mode 100644 index 0000000000..b88b20fd19 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs @@ -0,0 +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(); + if (encoderElement != null) + { + _encoder = encoderElement.CreateMessageEncoderFactory().Encoder; + } + _queueName = address.Uri.ToString(); + _session = session; + } + + public override void Send(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 new file mode 100644 index 0000000000..bcf6b4b6b8 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidOutputChannelBase.cs @@ -0,0 +1,77 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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 new file mode 100644 index 0000000000..1c37de45d8 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidTransportBindingElement.cs @@ -0,0 +1,186 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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; + + /// + /// Creates a new instance of the QpidTransportBindingElement Class + /// + 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 BuildChannelFactory(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + return (IChannelFactory) new QpidChannelFactory(context); + } + + public override IChannelListener BuildChannelListener(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + + return (IChannelListener) ((object) new QpidChannelListener(context)); + } + + public override bool CanBuildChannelFactory(BindingContext context) + { + return typeof (TChannel) == typeof (IOutputChannel); + } + + public override bool CanBuildChannelListener(BindingContext context) + { + return typeof (TChannel) == typeof (IInputChannel); + } + + public override BindingElement Clone() + { + return new QpidTransportBindingElement(this); + } + + public override T GetProperty(BindingContext context) + { + return context.GetInnerProperty(); + } + + /// + /// Gets the scheme used by the binding, this is 0.10 as default for now. + /// + public override string Scheme + { + get { return "soap.amqp"; } + } + + + /// + /// Specifies the broker host + /// + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// + /// Specifies the broker port + /// + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// + /// Specifies the username + /// + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// + /// Specifies the password + /// + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// + /// Specifies the virtualhost + /// + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + /// + /// Specifies the connection + /// + 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 new file mode 100644 index 0000000000..8a829e5b13 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/model/QpidTransportElement.cs @@ -0,0 +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); } + } + + + + /// + /// Specifies the broker host name that the binding should connect to. + /// + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// + /// Specifies the broker port number that the binding should connect to. + /// + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + /// + /// Password to use when authenticating with the broker + /// + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// + /// The username to use when authenticating with the broker + /// + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + /// + /// The virtual host to access. + /// + [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 new file mode 100644 index 0000000000..a294f52be2 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/wcf.csproj @@ -0,0 +1,69 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + Library + Properties + WCF + qpidWCFModel + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\client\bin\Debug\Qpid Client.dll + + + + + 3.0 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/wcf.sln b/qpid/dotnet/client-010/wcf/wcf.sln new file mode 100644 index 0000000000..2d80874a23 --- /dev/null +++ b/qpid/dotnet/client-010/wcf/wcf.sln @@ -0,0 +1,50 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcf", "wcf.csproj", "{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}" +EndProject +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 +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {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 + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/qpid/dotnet/client-010/wcf/wcf.suo b/qpid/dotnet/client-010/wcf/wcf.suo new file mode 100644 index 0000000000..8efca1318e Binary files /dev/null and b/qpid/dotnet/client-010/wcf/wcf.suo differ -- cgit v1.2.1 From a22a4d1c8b113a21c5010cbf40b38bb56724fea9 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 25 Sep 2008 10:05:27 +0000 Subject: QPID-1293: Added an IRtdServer based Excel AddIn that allows receiving messages within Excel git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@698914 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/ExcelAddIn.cs | 259 +++++++++++++++++++++ .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 59 +++++ .../addins/ExcelAddIn/Properties/AssemblyInfo.cs | 35 +++ .../ExcelAddInProducer/ExcelAddInProducer.csproj | 53 +++++ .../addins/ExcelAddInProducer/Program.cs | 56 +++++ .../ExcelAddInProducer/Properties/AssemblyInfo.cs | 33 +++ qpid/dotnet/client-010/client/Client.csproj | 1 + qpid/dotnet/client-010/client/client.suo | Bin 130048 -> 204288 bytes 8 files changed, 496 insertions(+) create mode 100644 qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs create mode 100644 qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj create mode 100644 qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs new file mode 100644 index 0000000000..3db0ec287e --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs @@ -0,0 +1,259 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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.Runtime.InteropServices; +using System.Text; +using client.client; +using Microsoft.Office.Interop.Excel; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace ExcelAddIn +{ + [ComVisible(true), ProgId("Qpid")] + public class ExcelAddIn : IRtdServer + { + private IRTDUpdateEvent _onMessage; + private readonly Dictionary _topicMessages = new Dictionary(); + private readonly Dictionary _queueListener = new Dictionary(); + private readonly Dictionary _topicQueueName = new Dictionary(); + private Client _client; + private ClientSession _session; + + #region properties + + public IRTDUpdateEvent OnMessage + { + get { return _onMessage; } + } + + public Dictionary TopicMessages + { + get { return _topicMessages; } + } + + public ClientSession Session + { + get { return _session; } + } + + #endregion + + + #region IRtdServer Members + + /// + /// Called when Excel requests the first RTD topic for the server. + /// Connect to the broker, returns a on success and 0 otherwise + /// + /// + /// + public int ServerStart(IRTDUpdateEvent CallbackObject) + { + _onMessage = CallbackObject; + string host = "localhost"; + string port = "5673"; + string virtualhost = "test"; + string username = "guest"; + string password = "guest"; + 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"]; + } + 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; + } + + /// + /// Called whenever Excel requests a new RTD topic from the RealTimeData server. + /// + /// + /// + /// + /// + 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"; + } + + /// + /// Called whenever Excel no longer requires a specific topic. + /// + /// + 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 pair in _topicMessages) + { + result.SetValue(pair.Key, 0, pair.Key); + string value = gerMessage(pair.Value); + result.SetValue(value, 1, pair.Key); + } + TopicCount = _topicMessages.Count; + return result; + } + + public void ServerTerminate() + { + + } + + #endregion + //END IRTDServer METHODS + + private string gerMessage(MessageTransfer 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(); + return enc.GetString(body); + } + + } + + class QpidListener : MessageListener + { + private readonly ExcelAddIn _excel; + private readonly List _topics = new List(); + + public QpidListener(ExcelAddIn excel) + { + _excel = excel; + } + + public void addTopic(int topic) + { + _topics.Add(topic); + } + + public void messageTransfer(MessageTransfer 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/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj new file mode 100644 index 0000000000..e6f1bd020b --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -0,0 +1,59 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {85EFD719-39F6-4471-90FF-9E621430344B} + Library + Properties + ExcelAddIn + Qpid Excel AddIn + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..3c80ece77c --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Excel AddIn")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Excel AddIn")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3bbd4414-60df-407f-9c64-c14b221167af")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj new file mode 100644 index 0000000000..1d6863332a --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {80F00C3B-EB38-4B3B-9F77-68977A30B155} + Exe + Properties + ExcelAddInProducer + Qpid Excel AddIn Producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..51016f7dc5 --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs @@ -0,0 +1,56 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +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); + + for (int i = 0; i < 100; 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)); + Thread.Sleep(1000); + } + + client.close(); + } + } +} diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..226709ca0b --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Excel AddIn Producer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Excel AddIn Producer")] +[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3416a5c2-eb70-4d77-b401-dfa659bd419e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 0f532bea88..a54e6a4d61 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -172,6 +172,7 @@ + diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index f32ed7f95f..7b9aa32631 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ -- cgit v1.2.1 From f8eca1f86220e065a5d56eff484ef5726a226f8f Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 25 Sep 2008 13:00:34 +0000 Subject: QPID-1293: Added missing config file git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@698953 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config new file mode 100644 index 0000000000..0a49da465f --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file -- cgit v1.2.1 From 4ca1e47bcdc45b47ce44455fcb2c3b955ca44259 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 26 Sep 2008 11:12:43 +0000 Subject: qpid-1277: Implemented SASSL PLAIN authentication git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@699274 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Client.cs | 2 +- .../client/client/ClientConnectionDelegate.cs | 25 ++++++++++++++++++++-- .../client/transport/ConnectionDelegate.cs | 3 +-- 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index f07609380f..be279d5243 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -57,7 +57,7 @@ namespace org.apache.qpid.client { _log.debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, port, virtualHost, username)); - ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this); + ConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); ManualResetEvent negotiationComplete = new ManualResetEvent(false); connectionDelegate.setCondition(negotiationComplete); connectionDelegate.VirtualHost = virtualHost; diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index c38dccce7a..5ed4187b36 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -18,6 +18,9 @@ */ 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; @@ -28,10 +31,14 @@ namespace org.apache.qpid.client { private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate)); private readonly Client _client; + private string _username; + private string _password; - public ClientConnectionDelegate(Client client) + public ClientConnectionDelegate(Client client, string username, string pasword) { _client = client; + _username = username; + _password = pasword; } public override SessionDelegate getSessionDelegate() @@ -44,6 +51,20 @@ namespace org.apache.qpid.client 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 props = new Dictionary(); + context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); + } + public override void closed() { log.debug("Delegate closed"); @@ -61,7 +82,7 @@ namespace org.apache.qpid.client } } - public new void connectionClose(Channel context, ConnectionClose connectionClose) + public override void connectionClose(Channel context, ConnectionClose connectionClose) { base.connectionClose(context, connectionClose); ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode()); diff --git a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs index ae3fb11fdd..1f76840b98 100644 --- a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -68,8 +68,7 @@ namespace org.apache.qpid.transport // Client side //----------------------------------------------- public override void connectionStart(Channel context, ConnectionStart mstruct) - { - // todo SASL + { Dictionary props = new Dictionary(); context.connectionStartOk(props, null, null, "utf8"); } -- cgit v1.2.1 From 17905b9934a32bfc1e66c55c222e72c989db0d3a Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 26 Sep 2008 13:13:40 +0000 Subject: qpid-1277: simplified message interface git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@699304 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/client/client/ClientInterface.cs | 1 - .../client-010/client/client/ClientSession.cs | 24 +++- .../client/client/ClientSessionDelegate.cs | 6 +- qpid/dotnet/client-010/client/client/IMessage.cs | 46 ++++++++ qpid/dotnet/client-010/client/client/Message.cs | 121 +++++++++++++++++++++ .../client/client/MessageListenerInterface.cs | 8 +- qpid/dotnet/client-010/client/transport/Session.cs | 2 - 7 files changed, 193 insertions(+), 15 deletions(-) create mode 100644 qpid/dotnet/client-010/client/client/IMessage.cs create mode 100644 qpid/dotnet/client-010/client/client/Message.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/ClientInterface.cs b/qpid/dotnet/client-010/client/client/ClientInterface.cs index ed95933799..85be5886c6 100644 --- a/qpid/dotnet/client-010/client/client/ClientInterface.cs +++ b/qpid/dotnet/client-010/client/client/ClientInterface.cs @@ -18,7 +18,6 @@ */ using System; -using client.client; namespace org.apache.qpid.client { diff --git a/qpid/dotnet/client-010/client/client/ClientSession.cs b/qpid/dotnet/client-010/client/client/ClientSession.cs index 10f1109031..2f107dc0b2 100644 --- a/qpid/dotnet/client-010/client/client/ClientSession.cs +++ b/qpid/dotnet/client-010/client/client/ClientSession.cs @@ -2,8 +2,10 @@ using System; using System.Collections.Generic; -using client.client; +using System.IO; +using System.Text; using org.apache.qpid.transport; +using org.apache.qpid.transport.util; namespace org.apache.qpid.client { @@ -24,20 +26,34 @@ namespace org.apache.qpid.client public static short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0; public static short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1; - private Dictionary _listeners = new Dictionary(); + private Dictionary _listeners = new Dictionary(); public ClientSession(byte[] name) : base(name) { } - public void attachMessageListener(MessageListener listener, string Destination) + public void attachMessageListener(IMessageListener listener, string Destination) { _listeners.Add(Destination, listener); } - public Dictionary MessageListeners + public Dictionary MessageListeners { get { return _listeners; } } + + public void messageTransfer(String destination, string routingkey, IMessage message) + { + byte[] body = new byte[message.Body.Position]; + message.Body.Seek(0, SeekOrigin.Begin); + message.Body.Read(body, 0, body.Length); + message.MessageProperties.setMessageId(UUID.randomUUID()); + message.DeliveryProperties.setRoutingKey(routingkey); + messageTransfer(destination, + MessageAcceptMode.NONE, + MessageAcquireMode.PRE_ACQUIRED, + message.Header, + body); + } } } \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs index 087f2d2006..1b40e2ba45 100644 --- a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs @@ -16,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -using System; -using client.client; using org.apache.qpid.transport; using org.apache.qpid.transport.util; @@ -34,8 +32,8 @@ namespace org.apache.qpid.client { if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination())) { - MessageListener listener = ((ClientSession) session).MessageListeners[xfr.getDestination()]; - listener.messageTransfer(xfr); + IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()]; + listener.messageTransfer( new Message(xfr)); } else { diff --git a/qpid/dotnet/client-010/client/client/IMessage.cs b/qpid/dotnet/client-010/client/client/IMessage.cs new file mode 100644 index 0000000000..b669867ebb --- /dev/null +++ b/qpid/dotnet/client-010/client/client/IMessage.cs @@ -0,0 +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; +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 ApplicationHeaders { get; set; } + + void appendData(byte[] bytes); + + MemoryStream Body { get; } + + void clearData(); + } +} diff --git a/qpid/dotnet/client-010/client/client/Message.cs b/qpid/dotnet/client-010/client/client/Message.cs new file mode 100644 index 0000000000..934ce60e68 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/Message.cs @@ -0,0 +1,121 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +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()); + } + + public MessageProperties MessageProperties + { + get + { + if (_message.Header != null) + return (MessageProperties) Header.Structs[0]; + return null; + } + set + { + if (_message.Header != null) + { + Header.Structs[0] = value; + } + } + } + + public DeliveryProperties DeliveryProperties + { + get + { + if (Header != null) + return (DeliveryProperties) Header.Structs[1]; + return null; + } + set + { + if (Header != null) + { + Header.Structs[1] = value; + } + } + } + + public Dictionary 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; } + } + } +} diff --git a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs index ac56ff8c99..978248e04c 100644 --- a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs +++ b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -using org.apache.qpid.transport; -namespace client.client + +namespace org.apache.qpid.client { - public interface MessageListener + public interface IMessageListener { /// /// Inform the listener of the message transfer /// /// The message transfer object - void messageTransfer(MessageTransfer xfr); + void messageTransfer(IMessage xfr); } } diff --git a/qpid/dotnet/client-010/client/transport/Session.cs b/qpid/dotnet/client-010/client/transport/Session.cs index f97fb44568..69afb68046 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -22,8 +22,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading; -using common.org.apache.qpid.transport.util; -using org.apache.qpid.transport; using org.apache.qpid.transport.util; using Frame = org.apache.qpid.transport.network.Frame; using Logger = org.apache.qpid.transport.util.Logger; -- cgit v1.2.1 From 87d810f8c6b26b256a8be6403946b07ab4f47867 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 26 Sep 2008 13:14:56 +0000 Subject: QPID-1293: Changed for using new message API + added generic message processor git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@699306 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/ExcelAddIn.cs | 56 +++++++++++++++++----- .../addins/ExcelAddInProducer/Program.cs | 13 +++-- 2 files changed, 50 insertions(+), 19 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs index 3db0ec287e..baed00b03a 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs @@ -23,25 +23,36 @@ using System; using System.Collections.Generic; using System.Configuration; using System.IO; +using System.Reflection; using System.Runtime.InteropServices; using System.Text; -using client.client; using Microsoft.Office.Interop.Excel; using org.apache.qpid.client; using org.apache.qpid.transport; namespace ExcelAddIn { + public delegate string ProcessMessage(IMessage m); + + /// + /// This interface must be implemented so to use a user defined message processor + /// + public interface MessageProcessor + { + string ProcessMessage(IMessage m); + } + [ComVisible(true), ProgId("Qpid")] public class ExcelAddIn : IRtdServer { private IRTDUpdateEvent _onMessage; - private readonly Dictionary _topicMessages = new Dictionary(); + private readonly Dictionary _topicMessages = new Dictionary(); private readonly Dictionary _queueListener = new Dictionary(); private readonly Dictionary _topicQueueName = new Dictionary(); private Client _client; - private ClientSession _session; - + private ClientSession _session; + private ProcessMessage _messageProcessor; + #region properties public IRTDUpdateEvent OnMessage @@ -49,7 +60,7 @@ namespace ExcelAddIn get { return _onMessage; } } - public Dictionary TopicMessages + public Dictionary TopicMessages { get { return _topicMessages; } } @@ -78,6 +89,8 @@ namespace ExcelAddIn string virtualhost = "test"; string username = "guest"; string password = "guest"; + _messageProcessor = getMessage; + if( ConfigurationManager.AppSettings["Host"] != null ) { host = ConfigurationManager.AppSettings["Host"]; @@ -98,6 +111,22 @@ namespace ExcelAddIn { 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 @@ -195,11 +224,11 @@ namespace ExcelAddIn public Array RefreshData(ref int TopicCount) { - Array result = new object[2, _topicMessages.Count]; - foreach (KeyValuePair pair in _topicMessages) + Array result = new object[2, _topicMessages.Count]; + foreach (KeyValuePair pair in _topicMessages) { result.SetValue(pair.Key, 0, pair.Key); - string value = gerMessage(pair.Value); + string value = _messageProcessor(pair.Value); result.SetValue(value, 1, pair.Key); } TopicCount = _topicMessages.Count; @@ -214,18 +243,21 @@ namespace ExcelAddIn #endregion //END IRTDServer METHODS - private string gerMessage(MessageTransfer m) + 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(); - return enc.GetString(body); + res = enc.GetString(body); + res = res + " price: " + m.ApplicationHeaders["price"]; + return res; } } - class QpidListener : MessageListener + class QpidListener : IMessageListener { private readonly ExcelAddIn _excel; private readonly List _topics = new List(); @@ -240,7 +272,7 @@ namespace ExcelAddIn _topics.Add(topic); } - public void messageTransfer(MessageTransfer m) + public void messageTransfer(IMessage m) { foreach (int i in _topics) { diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs index 51016f7dc5..9c9edcb249 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs @@ -22,8 +22,6 @@ using System; using System.Text; using System.Threading; using org.apache.qpid.client; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; namespace ExcelAddInProducer { @@ -40,13 +38,14 @@ namespace ExcelAddInProducer 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++) { - 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)); + message.clearData(); + message.appendData( Encoding.UTF8.GetBytes("test: " + i)); + message.ApplicationHeaders["price"] = i; + ssn.messageTransfer("amq.direct", "queue1", message); Thread.Sleep(1000); } -- cgit v1.2.1 From c24d35355273da642c86c6649f6728a6ee8fe783 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Tue, 30 Sep 2008 12:54:47 +0000 Subject: qpid-1277: Added examples git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@700439 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/Client.csproj | 2 + .../client-010/client/client/ClientSession.cs | 36 +++++- qpid/dotnet/client-010/client/client/IMessage.cs | 2 + qpid/dotnet/client-010/client/client/Message.cs | 5 + qpid/dotnet/client-010/client/transport/Session.cs | 10 ++ qpid/dotnet/client-010/default.build | 61 +++++++-- qpid/dotnet/client-010/demo/Program.cs | 5 +- .../direct/example-direct-Listener/Listener.cs | 112 +++++++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../direct/example-direct-Listener/default.build | 26 ++++ .../example-direct-Listener.csproj | 53 ++++++++ .../direct/example-direct-producer/Producer.cs | 87 +++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../direct/example-direct-producer/default.build | 26 ++++ .../example-direct-producer.csproj | 53 ++++++++ .../fanout/example-fanout-Listener/Listener.cs | 121 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../fanout/example-fanout-Listener/default.build | 26 ++++ .../example-fanout-Listener.csproj | 53 ++++++++ .../fanout/example-fanout-Producer/Producer.cs | 84 +++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../fanout/example-fanout-Producer/default.build | 26 ++++ .../example-fanout-Producer.csproj | 53 ++++++++ .../pub-sub/example-pub-sub-Listener/Listener.cs | 138 +++++++++++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../pub-sub/example-pub-sub-Listener/default.build | 26 ++++ .../example-pub-sub-Listener.csproj | 53 ++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../pub-sub/example-pub-sub-Publisher/Publisher.cs | 93 ++++++++++++++ .../example-pub-sub-Publisher/default.build | 26 ++++ .../example-pub-sub-Publisher.csproj | 53 ++++++++ .../example-request-response-Client/Client.cs | 137 ++++++++++++++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../example-request-response-Client/default.build | 26 ++++ .../example-request-response-Client.csproj | 53 ++++++++ .../Properties/AssemblyInfo.cs | 33 +++++ .../example-request-response-Server/Server.cs | 136 ++++++++++++++++++++ .../example-request-response-Server/default.build | 26 ++++ .../example-request-response-Server.csproj | 53 ++++++++ qpid/dotnet/client-010/test/Test.csproj | 3 + qpid/dotnet/client-010/test/interop/Message.cs | 6 +- qpid/dotnet/client-010/test/test.config | 2 +- 42 files changed, 1912 insertions(+), 24 deletions(-) create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build create mode 100644 qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build create mode 100644 qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build create mode 100644 qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index a54e6a4d61..35d8fae114 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -44,6 +44,8 @@ + + diff --git a/qpid/dotnet/client-010/client/client/ClientSession.cs b/qpid/dotnet/client-010/client/client/ClientSession.cs index 2f107dc0b2..ccd906f854 100644 --- a/qpid/dotnet/client-010/client/client/ClientSession.cs +++ b/qpid/dotnet/client-010/client/client/ClientSession.cs @@ -43,17 +43,47 @@ namespace org.apache.qpid.client } public void messageTransfer(String destination, string routingkey, IMessage message) - { + { + message.DeliveryProperties.setRoutingKey(routingkey); + messageTransfer(destination, message); + } + + public void messageTransfer(String destination, IMessage message) + { byte[] body = new byte[message.Body.Position]; message.Body.Seek(0, SeekOrigin.Begin); message.Body.Read(body, 0, body.Length); message.MessageProperties.setMessageId(UUID.randomUUID()); - message.DeliveryProperties.setRoutingKey(routingkey); messageTransfer(destination, MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, message.Header, - body); + body); + } + + public void queueDeclare(String queue) + { + queueDeclare(queue, null, null); } + + public void queueDeclare(String queue, params Option[] options) + { + queueDeclare(queue, null, null, options); + } + + public void exchangeBind(String queue, String exchange, String bindingKey) + { + exchangeBind(queue, exchange, bindingKey, null); + } + + public void messageSubscribe(String queue) + { + messageSubscribe(queue, queue, MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + messageSetFlowMode(queue, MessageFlowMode.WINDOW); + messageFlow(queue, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + messageFlow(queue, MessageCreditUnit.MESSAGE, 10000); + } + } } \ 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 b669867ebb..10b92de7ff 100644 --- a/qpid/dotnet/client-010/client/client/IMessage.cs +++ b/qpid/dotnet/client-010/client/client/IMessage.cs @@ -41,6 +41,8 @@ namespace org.apache.qpid.client 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 934ce60e68..3e18b4d7b7 100644 --- a/qpid/dotnet/client-010/client/client/Message.cs +++ b/qpid/dotnet/client-010/client/client/Message.cs @@ -117,5 +117,10 @@ namespace org.apache.qpid.client { get { return _message.Id; } } + + public string Destination + { + get{ return _message.getDestination();} + } } } diff --git a/qpid/dotnet/client-010/client/transport/Session.cs b/qpid/dotnet/client-010/client/transport/Session.cs index 69afb68046..5de379ab45 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -21,6 +21,7 @@ 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; @@ -98,6 +99,15 @@ namespace org.apache.qpid.transport } } + public string Name + { + get + { + ASCIIEncoding enc = new ASCIIEncoding(); + return enc.GetString(_name); + } + } + public Session(byte[] name) { _name = name; diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 74d53f1f35..99d8e239a3 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -19,9 +19,21 @@ - + + + + + + + + + + + + + @@ -150,11 +162,16 @@ + + + + + - + @@ -180,22 +197,40 @@ - + + - + + - - - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/demo/Program.cs b/qpid/dotnet/client-010/demo/Program.cs index 429fe1bf69..4affadb9df 100644 --- a/qpid/dotnet/client-010/demo/Program.cs +++ b/qpid/dotnet/client-010/demo/Program.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Text; using System.Threading; -using client.client; using log4net.Config; using org.apache.qpid.client; using org.apache.qpid.transport; @@ -64,7 +63,7 @@ namespace WindowsClient } } - class MyListener : MessageListener + class MyListener : IMessageListener { private readonly Object _wl; private ClientSession _session; @@ -77,7 +76,7 @@ namespace WindowsClient _count = 0; } - public void messageTransfer(MessageTransfer m) + public void messageTransfer(IMessage m) { BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; 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 new file mode 100644 index 0000000000..dd044e8aed --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Listener.cs @@ -0,0 +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 +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..07db227255 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-direct-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-direct-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6a24bfe4-4714-4d2a-acf4-96cf9a678a06")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build new file mode 100644 index 0000000000..f684a60990 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..17675cb479 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} + Exe + Properties + example_direct_Listener + example-direct-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..c9f1a475a4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Producer.cs @@ -0,0 +1,87 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; +using System.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.direct +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e72701e44b --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-direct-producer")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-direct-producer")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("006144c2-5e45-4543-8e16-c09cd4309ed7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build new file mode 100644 index 0000000000..58ac97b0d0 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..deafad1728 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/example-direct-producer.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {96FCB250-8142-40EE-9BDD-CA839EE21021} + Exe + Properties + example_direct_producer + example-direct-producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..4d3da690a9 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Listener.cs @@ -0,0 +1,121 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +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 +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..9e8adf557f --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-fanout-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-fanout-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("68686ef9-aa0a-4334-9c52-d7e6fc507bec")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build new file mode 100644 index 0000000000..cbd5113ae1 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..27b785e081 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/example-fanout-Listener.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} + Exe + Properties + example_fanout_Listener + example-fanout-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..f2818a4099 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Producer.cs @@ -0,0 +1,84 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; +using System.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.fanout +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d35f3522d2 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-fanout-Producer")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-fanout-Producer")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("01c0ba10-2f23-409b-9adc-bc514a13131a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build new file mode 100644 index 0000000000..0eec886470 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..ebafee7f1a --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/example-fanout-Producer.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {4513BF94-D54A-42FE-8506-FE2CD57B2C51} + Exe + Properties + example_fanout_Producer + example-fanout-Producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..0f09307cd4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Listener.cs @@ -0,0 +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 +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..f6ff3a3c82 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-pub-sub-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-pub-sub-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("74ab02ae-95d1-4bad-a7cf-9964005b9b05")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build new file mode 100644 index 0000000000..564e099f55 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..df58bfa6c4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/example-pub-sub-Listener.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} + Exe + Properties + example_pub_sub_Listener + example-pub-sub-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..209db5d17e --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-pub-sub-Publisher")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-pub-sub-Publisher")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f6d282a0-9dc5-46cf-a4cd-44ae402d667f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 new file mode 100644 index 0000000000..6c78eb5193 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Publisher.cs @@ -0,0 +1,93 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; +using System.Text; +using org.apache.qpid.client; + +namespace org.apache.qpid.example.pubsub +{ + /// + /// 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. + /// + /// + 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/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build new file mode 100644 index 0000000000..c85b2672a4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..ecdf2a5d44 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/example-pub-sub-Publisher.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {F8857634-A134-44E7-A953-F2B22688C599} + Exe + Properties + example_pub_sub_Publisher + example-pub-sub-Publisher + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 new file mode 100644 index 0000000000..1d361199f1 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs @@ -0,0 +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 +{ + /// + /// 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. + /// + /// + 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/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d1ac2473de --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-request-response-Client")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-request-response-Client")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("08bf6aed-bf79-4d16-9a28-6363d5322cdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build new file mode 100644 index 0000000000..760419b325 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..2d32dd6b66 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/example-request-response-Client.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {1BC63815-4029-4039-9207-35E7E06ECC99} + Exe + Properties + example_request_response_Client + example-request-response-Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ae96a64eb0 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-request-response-Server")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-request-response-Server")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ef3456e2-7c19-47aa-8dd6-aeaa88c5c4ad")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 new file mode 100644 index 0000000000..2ce493626f --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Server.cs @@ -0,0 +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 +{ + /// + /// 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. + /// + /// + 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/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build new file mode 100644 index 0000000000..d17410a7a9 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000000..080b2458b8 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/example-request-response-Server.csproj @@ -0,0 +1,53 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {922FBA9C-E483-4AEF-ABE8-AC87421E829B} + Exe + Properties + example_request_response_Server + example-request-response-Server + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 a5d6e2c45f..841e2385a0 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -41,7 +41,10 @@ + + + diff --git a/qpid/dotnet/client-010/test/interop/Message.cs b/qpid/dotnet/client-010/test/interop/Message.cs index 79c22e0acf..3267af9c0c 100644 --- a/qpid/dotnet/client-010/test/interop/Message.cs +++ b/qpid/dotnet/client-010/test/interop/Message.cs @@ -19,10 +19,8 @@ * */ using System; -using System.IO; using System.Text; using System.Threading; -using client.client; using NUnit.Framework; using org.apache.qpid.client; using org.apache.qpid.transport; @@ -139,7 +137,7 @@ namespace test.interop - private class MyListener : MessageListener + private class MyListener : IMessageListener { private static readonly Logger _log = Logger.get(typeof (MyListener)); private readonly Object _wl; @@ -152,7 +150,7 @@ namespace test.interop _count = count; } - public void messageTransfer(MessageTransfer m) + 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); diff --git a/qpid/dotnet/client-010/test/test.config b/qpid/dotnet/client-010/test/test.config index dc284f25f1..0499eddfbc 100644 --- a/qpid/dotnet/client-010/test/test.config +++ b/qpid/dotnet/client-010/test/test.config @@ -2,7 +2,7 @@ - + -- cgit v1.2.1 From 16abe32b572646be5e0a6a0b21cde553fa56bd67 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 2 Oct 2008 12:34:45 +0000 Subject: qpid-1277: fixed header conversion issues + added test git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@701107 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client.suo | Bin 204288 -> 517120 bytes .../client/transport/codec/AbstractDecoder.cs | 10 +-- .../client/transport/codec/AbstractEncoder.cs | 10 +-- .../client-010/client/transport/codec/MSDecoder.cs | 2 +- .../client-010/client/transport/codec/MSEncoder.cs | 2 +- .../client/transport/util/ByteEncoder.cs | 8 +- .../client/transport/util/CircularBuffer.cs | 2 +- qpid/dotnet/client-010/test/Test.csproj | 1 + .../client-010/test/interop/ApplicationHeaders.cs | 83 +++++++++++++++++++++ qpid/dotnet/client-010/test/interop/TestCase.cs | 28 ++++++- 10 files changed, 128 insertions(+), 18 deletions(-) create mode 100644 qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index 7b9aa32631..a78207b590 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs index eeb08ce2ae..44aecb0933 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs @@ -341,17 +341,17 @@ namespace org.apache.qpid.transport.codec case Code.INT32: return (int) readUint32(); - case Code.FLOAT: - return (float) 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 (double) readUint64(); + case Code.DOUBLE: + return BitConverter.Int64BitsToDouble(readUint64()); case Code.UUID: return readUuid(); case Code.STR8: diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs index f70eb17a55..c89b96462e 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; -using org.apache.qpid.transport.codec; using org.apache.qpid.transport.util; namespace org.apache.qpid.transport.codec @@ -482,7 +481,8 @@ namespace org.apache.qpid.transport.codec put((Byte) value); break; case Code.CHAR: - put((byte) value); + byte[] b = BitConverter.GetBytes((char) value); + put(b[0]); break; case Code.BOOLEAN: if ((bool) value) @@ -516,18 +516,18 @@ namespace org.apache.qpid.transport.codec break; case Code.FLOAT: - writeUint32((long) value); + writeUint32(BitConverter.DoubleToInt64Bits((float) value) >> 32); break; case Code.BIN64: case Code.UINT64: - case Code.INT64: + case Code.INT64: case Code.DATETIME: writeUint64((long) value); break; case Code.DOUBLE: - writeUint64((long) value); + writeUint64( BitConverter.DoubleToInt64Bits((double) value)); break; case Code.UUID: diff --git a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs index a4f2a24801..cc8971d38b 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs @@ -76,7 +76,7 @@ namespace org.apache.qpid.transport.codec public override long readUint64() { - return (long) ByteEncoder.GetBigEndian((Double) reader.ReadInt64()); + return (long) ByteEncoder.GetBigEndian(reader.ReadInt64()); } } } \ No newline at end of file diff --git a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs index bb78aa8680..b2ccbb89ae 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs @@ -90,7 +90,7 @@ namespace org.apache.qpid.transport.codec public override void writeUint64(long l) { - _writer.Write(ByteEncoder.GetBigEndian((Double) l)); + _writer.Write(ByteEncoder.GetBigEndian(l)); } protected override int beginSize8() diff --git a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs index 75526eb432..fc5cc7127a 100644 --- a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -63,7 +63,7 @@ namespace org.apache.qpid.transport.util /// /// Value to encode. /// Big-endian encoded value. - public static Double GetBigEndian(Double value) + public static long GetBigEndian(long value) { if (BitConverter.IsLittleEndian) { @@ -131,7 +131,7 @@ namespace org.apache.qpid.transport.util /// /// Value to encode. /// Little-endian encoded value. - public static Double GetLittleEndian(Double value) + public static Double GetLittleEndian(long value) { if (BitConverter.IsLittleEndian) { @@ -187,11 +187,11 @@ namespace org.apache.qpid.transport.util /// /// to swap. /// Byte order swapped value. - private static Double swapByteOrder(Double value) + private static long swapByteOrder(long value) { Byte[] buffer = BitConverter.GetBytes(value); Array.Reverse(buffer, 0, buffer.Length); - return BitConverter.ToDouble(buffer, 0); + return BitConverter.ToInt64(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 13bdc8caf1..3c08a7162f 100644 --- a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -24,7 +24,7 @@ using System.Threading; namespace common.org.apache.qpid.transport.util { - internal class CircularBuffer + public class CircularBuffer { private readonly T[] buffer; private Int32 nrp, nwp; diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index 841e2385a0..e46c9768cc 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -42,6 +42,7 @@ + diff --git a/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs new file mode 100644 index 0000000000..9e27673a49 --- /dev/null +++ b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs @@ -0,0 +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 buff = new CircularBuffer(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/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs index 9f410a9e9e..16a5522726 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -22,10 +22,14 @@ 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 { @@ -85,7 +89,29 @@ namespace test.interop public Dictionary Properties { get { return _properties; } - } + } + + + public class SyncListener : IMessageListener + { + private static readonly Logger _log = Logger.get(typeof(SyncListener)); + private readonly CircularBuffer _buffer; + private readonly RangeSet _range = new RangeSet(); + private readonly ClientSession _session; + public SyncListener(ClientSession session, CircularBuffer buffer) + { + _buffer = buffer; + _session = session; + } + + public void messageTransfer(IMessage m) + { + _range.clear(); + _range.add(m.Id); + _session.messageAccept(_range); + _buffer.Enqueue(m); + } + } } } -- cgit v1.2.1 From 07a09ede55091f2a7b6fc344506b9af714f12425 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 2 Oct 2008 15:38:43 +0000 Subject: qpid-1277: added unit tests git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@701160 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client.suo | Bin 517120 -> 566784 bytes .../client/transport/util/ByteEncoder.cs | 64 ++++++------- .../client-010/client/transport/util/Functions.cs | 1 - .../client/transport/util/ResultFuture.cs | 4 +- qpid/dotnet/client-010/test/Test.csproj | 4 + .../test/transport/util/ByteEncoderTest.cs | 106 +++++++++++++++++++++ .../test/transport/util/CircularBufferTest.cs | 89 +++++++++++++++++ .../test/transport/util/ResultFutureTest.cs | 103 ++++++++++++++++++++ .../client-010/test/transport/util/SerialTest.cs | 75 +++++++++++++++ 9 files changed, 408 insertions(+), 38 deletions(-) create mode 100644 qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs create mode 100644 qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs create mode 100644 qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs create mode 100644 qpid/dotnet/client-010/test/transport/util/SerialTest.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index a78207b590..22e8b25895 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ diff --git a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs index fc5cc7127a..ac493a9b62 100644 --- a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -1,6 +1,24 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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.util { @@ -18,10 +36,7 @@ namespace org.apache.qpid.transport.util { return swapByteOrder(value); } - else - { - return value; - } + return value; } /// @@ -35,10 +50,7 @@ namespace org.apache.qpid.transport.util { return swapByteOrder(value); } - else - { - return value; - } + return value; } /// @@ -52,10 +64,7 @@ namespace org.apache.qpid.transport.util { return swapByteOrder(value); } - else - { - return value; - } + return value; } /// @@ -69,10 +78,7 @@ namespace org.apache.qpid.transport.util { return swapByteOrder(value); } - else - { - return value; - } + return value; } /// @@ -86,10 +92,7 @@ namespace org.apache.qpid.transport.util { return value; } - else - { - return swapByteOrder(value); - } + return swapByteOrder(value); } /// @@ -103,10 +106,7 @@ namespace org.apache.qpid.transport.util { return value; } - else - { - return swapByteOrder(value); - } + return swapByteOrder(value); } /// @@ -120,10 +120,7 @@ namespace org.apache.qpid.transport.util { return value; } - else - { - return swapByteOrder(value); - } + return swapByteOrder(value); } /// @@ -131,16 +128,13 @@ namespace org.apache.qpid.transport.util /// /// Value to encode. /// Little-endian encoded value. - public static Double GetLittleEndian(long value) + public static long GetLittleEndian(long value) { if (BitConverter.IsLittleEndian) { return value; } - else - { - return swapByteOrder(value); - } + return swapByteOrder(value); } /// diff --git a/qpid/dotnet/client-010/client/transport/util/Functions.cs b/qpid/dotnet/client-010/client/transport/util/Functions.cs index 0ced53c335..f5777d8ee9 100644 --- a/qpid/dotnet/client-010/client/transport/util/Functions.cs +++ b/qpid/dotnet/client-010/client/transport/util/Functions.cs @@ -18,7 +18,6 @@ * under the License. * */ -using System; namespace org.apache.qpid.transport.util { diff --git a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs index dd10e6a74a..d3e12d4ca4 100644 --- a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -18,11 +18,11 @@ namespace common.org.apache.qpid.transport.util { DateTime start = DateTime.Now; long elapsed = 0; - while (! _session.Closed && _timeout - elapsed > 0 && _result == null) + while (! _session.Closed && timeout - elapsed > 0 && _result == null) { log.debug("{0} waiting for result: {1}", _session, this ); Monitor.Wait(this, (int) (timeout - elapsed)); - elapsed = DateTime.Now.Subtract( start ).Milliseconds; + elapsed = (long) (DateTime.Now.Subtract(start)).TotalMilliseconds; } } if( _session.Closed ) diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index e46c9768cc..a947a43a8d 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -46,6 +46,10 @@ + + + + diff --git a/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs new file mode 100644 index 0000000000..383970ec79 --- /dev/null +++ b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs @@ -0,0 +1,106 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +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 new file mode 100644 index 0000000000..03ac7831c1 --- /dev/null +++ b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs @@ -0,0 +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 _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(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(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 new file mode 100644 index 0000000000..6b6397168f --- /dev/null +++ b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs @@ -0,0 +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 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 new file mode 100644 index 0000000000..04a838c13b --- /dev/null +++ b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs @@ -0,0 +1,75 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using 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); + } + } +} -- cgit v1.2.1 From 7561e292a40ad8cc07ed666a08edde1f480f498b Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 10 Oct 2008 12:06:07 +0000 Subject: QPID-1346: Added .net perftest git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@703430 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/Client.csproj | 1 - qpid/dotnet/client-010/client/client.sln | 82 ++- qpid/dotnet/client-010/client/client.suo | Bin 566784 -> 585728 bytes .../dotnet/client-010/client/transport/Receiver.cs | 1 - qpid/dotnet/client-010/client/transport/Result.cs | 35 -- .../client-010/client/transport/SessionDelegate.cs | 2 - .../client/transport/util/CircularBuffer.cs | 8 +- qpid/dotnet/client-010/default.build | 10 + qpid/dotnet/client-010/lib/plossum/C5-License.txt | 27 + qpid/dotnet/client-010/lib/plossum/C5.dll | Bin 0 -> 274432 bytes .../client-010/lib/plossum/Plossum CommandLine.dll | Bin 0 -> 98304 bytes qpid/dotnet/client-010/lib/plossum/license.txt | 28 + qpid/dotnet/client-010/perftest/PerfTest.cs | 684 +++++++++++++++++++++ .../client-010/perftest/Properties/AssemblyInfo.cs | 33 + qpid/dotnet/client-010/perftest/README.txt | 38 ++ qpid/dotnet/client-010/perftest/default.build | 29 + qpid/dotnet/client-010/perftest/perftest.csproj | 61 ++ 17 files changed, 990 insertions(+), 49 deletions(-) delete mode 100644 qpid/dotnet/client-010/client/transport/Result.cs create mode 100644 qpid/dotnet/client-010/lib/plossum/C5-License.txt create mode 100644 qpid/dotnet/client-010/lib/plossum/C5.dll create mode 100644 qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll create mode 100644 qpid/dotnet/client-010/lib/plossum/license.txt create mode 100644 qpid/dotnet/client-010/perftest/PerfTest.cs create mode 100644 qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/perftest/README.txt create mode 100644 qpid/dotnet/client-010/perftest/default.build create mode 100644 qpid/dotnet/client-010/perftest/perftest.csproj (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 35d8fae114..38f1dac737 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -189,7 +189,6 @@ - diff --git a/qpid/dotnet/client-010/client/client.sln b/qpid/dotnet/client-010/client/client.sln index 5b4a732545..f6688b7a09 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -3,9 +3,33 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 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}") = "MessagePRocessor", "..\addins\MessagePRocessor\MessagePRocessor.csproj", "{244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}" +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}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" +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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,14 +41,62 @@ Global {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 - {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 {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 + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index 22e8b25895..1ccb5725ef 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ diff --git a/qpid/dotnet/client-010/client/transport/Receiver.cs b/qpid/dotnet/client-010/client/transport/Receiver.cs index be28d4ab6e..7b61d7f684 100644 --- a/qpid/dotnet/client-010/client/transport/Receiver.cs +++ b/qpid/dotnet/client-010/client/transport/Receiver.cs @@ -20,7 +20,6 @@ */ using System; -using org.apache.qpid.transport; namespace org.apache.qpid.transport { diff --git a/qpid/dotnet/client-010/client/transport/Result.cs b/qpid/dotnet/client-010/client/transport/Result.cs deleted file mode 100644 index bde1a2f98c..0000000000 --- a/qpid/dotnet/client-010/client/transport/Result.cs +++ /dev/null @@ -1,35 +0,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; -namespace org.apache.qpid.transport -{ - - - /// Result - /// - /// - /// Rafael H. Schloming - /// - - public abstract class Result:Struct - { - } -} \ 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 daae528eb0..e4b58b20ff 100644 --- a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs @@ -19,8 +19,6 @@ * */ -using System; - namespace org.apache.qpid.transport { /// diff --git a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs index 3c08a7162f..05c26bcc49 100644 --- a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -105,10 +105,8 @@ namespace common.org.apache.qpid.transport.util buffer[i] = t; i += add; if (i < 0) i += len; - nwp = i; - countValue = nwp - nrp; - if (countValue == 0) - countValue += len; + nwp = i; + updateCount(); } private void updateCount() @@ -125,7 +123,7 @@ namespace common.org.apache.qpid.transport.util i += add; if (i < 0) i += len; nrp = i; - countValue = nwp - nrp; + countValue--; return (temp); } diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 99d8e239a3..1e49cb31a2 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -38,6 +38,11 @@ + + + + + @@ -171,6 +176,11 @@ + + + + + diff --git a/qpid/dotnet/client-010/lib/plossum/C5-License.txt b/qpid/dotnet/client-010/lib/plossum/C5-License.txt new file mode 100644 index 0000000000..e1c0876081 --- /dev/null +++ b/qpid/dotnet/client-010/lib/plossum/C5-License.txt @@ -0,0 +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. diff --git a/qpid/dotnet/client-010/lib/plossum/C5.dll b/qpid/dotnet/client-010/lib/plossum/C5.dll new file mode 100644 index 0000000000..08362849c9 Binary files /dev/null and b/qpid/dotnet/client-010/lib/plossum/C5.dll differ diff --git a/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll b/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll new file mode 100644 index 0000000000..d3aad9485d Binary files /dev/null and b/qpid/dotnet/client-010/lib/plossum/Plossum CommandLine.dll differ diff --git a/qpid/dotnet/client-010/lib/plossum/license.txt b/qpid/dotnet/client-010/lib/plossum/license.txt new file mode 100644 index 0000000000..714c2d8821 --- /dev/null +++ b/qpid/dotnet/client-010/lib/plossum/license.txt @@ -0,0 +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. diff --git a/qpid/dotnet/client-010/perftest/PerfTest.cs b/qpid/dotnet/client-010/perftest/PerfTest.cs new file mode 100644 index 0000000000..97a609ba32 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/PerfTest.cs @@ -0,0 +1,684 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using common.org.apache.qpid.transport.util; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; +using Plossum.CommandLine; + +namespace PerfTest +{ + [CommandLineManager(ApplicationName = "Qpid Perf Tests", Copyright = "Apache Software Foundation")] + public class Options + { + [CommandLineOption(Description = "Displays this help text")] public bool Help; + + [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] public Boolean Setup; + + [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] public Boolean Control; + + [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] public Boolean Publish; + + [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] public Boolean Subscribe; + + [CommandLineOption(Description = "Test mode: [shared|fanout|topic]", MinOccurs = 0)] + public string Mode + { + get { return _mMode; } + set + { + if (! value.Equals("shared") && ! value.Equals("fanout") && ! value.Equals("topic")) + throw new InvalidOptionValueException( + "The mode must not be shared|fanout|topic", false); + _mMode = value; + } + } + + private string _mMode = "shared"; + + [CommandLineOption(Description = "Specifies the broler name", MinOccurs = 0)] + public string Broker + { + get { return _broker; } + set + { + if (String.IsNullOrEmpty(value)) + throw new InvalidOptionValueException( + "The broker name must not be empty", false); + _broker = value; + } + } + + private string _broker = "localhost"; + + [CommandLineOption(Description = "Specifies the port name", MinOccurs = 0)] + public int Port + { + get { return _port; } + set { _port = value; } + } + + private int _port = 5672; + + #region Publisher + + [CommandLineOption(Description = "Create N publishers.", MinOccurs = 0)] + public int Pubs + { + get { return _pubs; } + set { _pubs = value; } + } + + private int _pubs = 1; + + [CommandLineOption(Description = "Each publisher sends N messages.", MinOccurs = 0)] + public double Count + { + get { return _count; } + set { _count = value; } + } + + private double _count = 5000; + + [CommandLineOption(Description = "Size of messages in bytes.", MinOccurs = 0)] + public long Size + { + get { return _size; } + set { _size = value; } + } + + private long _size = 1024; + + [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] public Boolean Confirm = true; + + [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] public Boolean Durable; + + [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] public Boolean UniqueData; + + [CommandLineOption(Description = "Wait for confirmation of each message before sending the next one.", + MinOccurs = 0)] public Boolean SyncPub; + + [CommandLineOption(Description = ">=0 delay between msg publish.", MinOccurs = 0)] + public double IntervalPub + { + get { return _interval_pub; } + set { _interval_pub = value; } + } + + private double _interval_pub; + + #endregion + + #region Subscriber + + [CommandLineOption(Description = "Create N subscribers.", MinOccurs = 0)] + public int Subs + { + get { return _subs; } + set { _subs = value; } + } + + private int _subs = 1; + + [CommandLineOption(Description = "N>0: Subscriber acks batches of N.\n N==0: Subscriber uses unconfirmed mode", + MinOccurs = 0)] + public int SubAck + { + get { return _suback; } + set { _suback = value; } + } + + private int _suback; + + [CommandLineOption(Description = ">=0 delay between msg consume", MinOccurs = 0)] + public double IntervalSub + { + get { return _interval_sub; } + set { _interval_sub = value; } + } + + private double _interval_sub; + + #endregion + + [CommandLineOption(Description = "Create N queues.", MinOccurs = 0)] + public int Queues + { + get { return _qt; } + set { _qt = value; } + } + + private int _qt = 1; + + [CommandLineOption(Description = "Desired number of iterations of the test.", MinOccurs = 0)] + public int Iterations + { + get { return _iterations; } + set { _iterations = value; } + } + + private int _iterations = 1; + + [CommandLineOption(Description = "If non-zero, the transaction batch size.", MinOccurs = 0)] + public int Tx + { + get { return _tx; } + set { _tx = value; } + } + + private int _tx; + + [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] public Boolean + QueueDurable; + + [CommandLineOption(Description = "Queue policy: count to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxCount + { + get { return _queueMaxCount; } + set { _queueMaxCount = value; } + } + + private double _queueMaxCount; + + [CommandLineOption(Description = "Queue policy: accumulated size to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxSize + { + get { return _queueMaxSize; } + set { _queueMaxSize = value; } + } + + private double _queueMaxSize; + + public double SubQuota + { + get { return _subQuota; } + set { _subQuota = value; } + } + + private double _subQuota; + } + + internal interface Startable + { + void Start(); + } + + public abstract class PerfTestClient : Startable + { + private readonly Client _connection; + private readonly ClientSession _session; + private readonly Options _options; + + public ClientSession Session + { + get { return _session; } + } + + public Options Options + { + get { return _options; } + } + + protected PerfTestClient(Options options) + { + _options = options; + _connection = new Client(); + _connection.connect(options.Broker, options.Port, "test", "guest", "guest"); + _session = _connection.createSession(50000); + } + + public abstract void Start(); + } + + public class SetupTest : PerfTestClient + { + public SetupTest(Options options) + : base(options) + { + } + + private void queueInit(String name, Boolean durable, Dictionary arguments) + { + Session.queueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); + Session.queuePurge(name); + Session.exchangeBind(name, "amq.direct", name); + Session.sync(); + } + + public override void Start() + { + queueInit("pub_start", false, null); + queueInit("pub_done", false, null); + queueInit("sub_ready", false, null); + queueInit("sub_done", false, null); + if (Options.Mode.Equals("shared")) + { + Dictionary settings = new Dictionary(); + if (Options.QueueMaxCount > 0) + settings.Add("qpid.max_count", Options.QueueMaxCount); + if (Options.QueueMaxSize > 0) + settings.Add("qpid.max_size", Options.QueueMaxSize); + for (int i = 0; i < Options.Queues; ++i) + { + string qname = "perftest" + i; + queueInit(qname, Options.Durable || Options.QueueDurable, settings); + } + } + } + } + + public class SubscribeThread : PerfTestClient + { + private readonly string _queue; + + public SubscribeThread(Options options, string key, string exchange) + : base(options) + { + _queue = "perftest" + (new UUID(10, 10)).ToString(); + Session.queueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, + Options.Durable ? Option.DURABLE : Option.NONE); + Session.exchangeBind(_queue, exchange, key); + } + + public SubscribeThread(Options options, string key) + : base(options) + { + _queue = key; + } + + public override void Start() + { + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "message_queue" + IMessageListener listener = new SyncListener(buffer); + string dest = "dest" + UUID.randomUUID().ToString(); + Session.attachMessageListener(listener, dest); + Session.messageSubscribe(_queue, dest, + Options.Tx > 0 || Options.SubAck > 0 + ? MessageAcceptMode.EXPLICIT + : MessageAcceptMode.NONE, + MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + Session.messageSetFlowMode(dest, MessageFlowMode.WINDOW); + Session.messageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + + // Notify controller we are ready. + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey("sub_ready"); + + message.appendData(Encoding.UTF8.GetBytes("ready")); + Session.messageTransfer("amq.direct", message); + + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + + + for (int j = 0; j < Options.Iterations; ++j) + { + + //need to allocate some more credit + Session.messageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); + + RangeSet range = new RangeSet(); + IMessage msg; + DateTime start = DateTime.Now; + for (long i = 0; i < Options.SubQuota; ++i) + { + msg = buffer.Dequeue(); + if (Options.Tx > 0 && ((i + 1)%Options.Tx == 0)) + { + Session.txCommit(); + Session.sync(); + } + if (Options.IntervalSub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + range.add(msg.Id); + } + if (Options.Tx > 0 || Options.SubAck > 0) + Session.messageAccept(range); + range.clear(); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("sub_done"); + message.clearData(); + message.appendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class SyncListener : IMessageListener + { + private readonly CircularBuffer _buffer; + + public SyncListener(CircularBuffer buffer) + { + _buffer = buffer; + } + + public void messageTransfer(IMessage m) + { + _buffer.Enqueue(m); + } + } + + + public class PublishThread : PerfTestClient + { + private readonly string _exchange; + private readonly string _key; + + public PublishThread(Options options, string key, string exchange) + : base(options) + { + _key = key; + _exchange = exchange; + } + + + public override void Start() + { + byte[] data = new byte[Options.Size]; + // randomly populate data + Random r = new Random(34); + r.NextBytes(data); + IMessage message = new Message(); + message.appendData(data); + + message.DeliveryProperties.setRoutingKey(_key); + + if (Options.Durable) + message.DeliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); + + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "pub_start" + IMessageListener listener = new SyncListener(buffer); + string localQueue = "localQueue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", "pub_start"); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + buffer.Dequeue(); + + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + for (long i = 0; i < Options.Count; ++i) + { + Session.messageTransfer(_exchange, message); + + if (Options.SyncPub) + { + Session.sync(); + } + if (Options.Tx > 0 && (i + 1)%Options.Tx == 0) + { + Session.txSelect(); + Session.sync(); + } + if (Options.IntervalPub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + } + Session.sync(); + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("pub_done"); + message.clearData(); + double time = end.Subtract(start).TotalMilliseconds; + byte[] rate = BitConverter.GetBytes( Options.Count / time ); + message.appendData(rate); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class Controller : PerfTestClient + { + public Controller(Options options) + : base(options) + { + } + + private void process(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + for (int i = 0; i < size; ++i) + { + buffer.Dequeue(); + } + } + + private double processRate(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + double rate = 0; + RangeSet range = new RangeSet(); + for (int i = 0; i < size; ++i) + { + IMessage m = buffer.Dequeue(); + range.add(m.Id); + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + rate += BitConverter.ToDouble(body,0); + } + Session.messageAccept(range); + return rate; + } + + private void send(int size, string queue, string data) + { + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey(queue); + message.appendData(Encoding.UTF8.GetBytes(data)); + for (int i = 0; i < size; ++i) + { + Session.messageTransfer("amq.direct", message); + } + } + + public override void Start() + { + process(Options.Subs, "sub_ready"); + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + send(Options.Pubs, "pub_start", "start"); // Start publishers + double pubrate = processRate(Options.Pubs, "pub_done"); + double subrate = processRate(Options.Subs, "sub_done"); + DateTime end = DateTime.Now; + + double transfers = (Options.Pubs*Options.Count) + (Options.Subs*Options.SubQuota); + double time = end.Subtract(start).TotalSeconds; + double txrate = transfers/time; + double mbytes = (txrate*Options.Size) / (1024 * 1024) ; + + Console.WriteLine("Total: " + transfers + " transfers of " + Options.Size + " bytes in " + + time + " seconds.\n" + + "Publish transfers/sec: " + pubrate * 1000 + "\n" + + "Subscribe transfers/sec: " + subrate * 1000 + "\n" + + "Total transfers/sec: " + txrate + "\n" + + "Total Mbytes/sec: " + mbytes); + Console.WriteLine("done"); + } + + } + } + + + public class PerfTest + { + private static int Main(string[] args) + { + Options options = new Options(); + CommandLineParser parser = new CommandLineParser(options); + parser.Parse(); + if (parser.HasErrors) + { + Console.WriteLine(parser.UsageInfo.GetErrorsAsString(78)); + return -1; + } + if (options.Help) + { + Console.WriteLine(parser.UsageInfo.GetOptionsAsString(78)); + return 0; + } + bool singleProcess = + (!options.Setup && !options.Control && !options.Publish && !options.Subscribe); + if (singleProcess) + { + options.Setup = options.Control = options.Publish = true; + options.Subscribe = true; + } + + + string exchange = "amq.direct"; + switch (options.Mode) + { + case "shared": + options.SubQuota = (options.Pubs*options.Count)/options.Subs; + break; + case "fanout": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.fanout"; + break; + case "topic": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.topic"; + break; + } + + if (options.Setup) + { + SetupTest setup = new SetupTest(options); + setup.Start(); // Set up queues + } + + Thread contT = null; + if ( options.Control) + { + Controller c = new Controller(options); + contT = new Thread(c.Start); + contT.Start(); + } + + Thread[] publishers = null; + Thread[] subscribers = null; + + // Start pubs/subs for each queue/topic. + for (int i = 0; i < options.Queues; ++i) + { + string key = "perftest" + i; // Queue or topic name. + if (options.Publish) + { + int n = singleProcess ? options.Pubs : 1; + publishers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + PublishThread pt = new PublishThread(options, key, exchange); + publishers[i] = new Thread(pt.Start); + publishers[i].Start(); + } + } + if ( options.Subscribe) + { + int n = singleProcess ? options.Subs : 1; + subscribers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + SubscribeThread st; + if (options.Mode.Equals("shared")) + st = new SubscribeThread(options, key); + else + st = new SubscribeThread(options, key, exchange); + subscribers[i] = new Thread(st.Start); + subscribers[i].Start(); + } + } + } + + if (options.Control) + { + contT.Join(); + } + + + // Wait for started threads. + if (options.Publish) + { + foreach (Thread t in publishers) + { + t.Join(); + } + } + + if (options.Subscribe) + { + foreach (Thread t in subscribers) + { + t.Join(); + } + } + + + return 0; + } + } +} diff --git a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..4ca588786e --- /dev/null +++ b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("perftest")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("perftest")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("11b542db-0d57-4a67-8b92-24ac1d4ed4cf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/perftest/README.txt b/qpid/dotnet/client-010/perftest/README.txt new file mode 100644 index 0000000000..fadde27693 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/README.txt @@ -0,0 +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 +and wait for it to complete. The remaining process should run concurrently: +Run -Pubs times: Perftest.exe -Publish +Run -Subs times: Perftest.exe -Subscribe +Run once: Perftest.exe -Control +Note the 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/default.build b/qpid/dotnet/client-010/perftest/default.build new file mode 100644 index 0000000000..a126a8bc86 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/default.build @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj new file mode 100644 index 0000000000..8f82f195b6 --- /dev/null +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -0,0 +1,61 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} + Exe + Properties + perftest + perftest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\plossum\C5.dll + + + False + ..\lib\plossum\Plossum CommandLine.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ No newline at end of file -- cgit v1.2.1 From 93ee9da6ee837784d31456343c0553188f0e3439 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 10 Oct 2008 13:44:19 +0000 Subject: QPID-1346: Updated build script git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@703477 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/default.build | 2 ++ 1 file changed, 2 insertions(+) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 1e49cb31a2..ee3e9387f9 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -161,6 +161,8 @@ + + -- cgit v1.2.1 From ea476363bc00e42de3b1e39f2c6d4a2ed6cb677f Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 13 Oct 2008 14:20:08 +0000 Subject: qpid-1277: updated build for setting body default value. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@704129 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/Composite.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl b/qpid/dotnet/client-010/gentool/Composite.tpl index 6020964019..44f3c1bc44 100644 --- a/qpid/dotnet/client-010/gentool/Composite.tpl +++ b/qpid/dotnet/client-010/gentool/Composite.tpl @@ -90,7 +90,7 @@ for f in fields: if segments: out(" private Header _header;\n") - out(" private MemoryStream _body;\n") + out(" private MemoryStream _body = new MemoryStream();\n") } ${ -- cgit v1.2.1 From b5306d0b1fad54f7094df8e8ee4c26c2a1a748b8 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 17 Oct 2008 12:51:51 +0000 Subject: qpid-1371: added .net cc support + cc .net interop support git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@705588 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/examples/direct/verify | 15 ++++ qpid/dotnet/client-010/examples/direct/verify.in | 14 +++ .../client-010/examples/direct/verify_cpp_dotnet | 10 +++ .../examples/direct/verify_cpp_dotnet.in | 14 +++ .../client-010/examples/direct/verify_dotnet_cpp | 10 +++ .../examples/direct/verify_dotnet_cpp.in | 15 ++++ .../client-010/examples/direct/verify_dotnet_java | 15 ++++ .../examples/direct/verify_dotnet_java.in | 20 +++++ .../examples/direct/verify_dotnet_python | 10 +++ .../examples/direct/verify_dotnet_python.in | 14 +++ .../client-010/examples/direct/verify_java_dotnet | 15 ++++ .../examples/direct/verify_java_dotnet.in | 29 +++++++ .../examples/direct/verify_python_dotnet | 10 +++ .../examples/direct/verify_python_dotnet.in | 14 +++ qpid/dotnet/client-010/examples/fanout/verify | 15 ++++ qpid/dotnet/client-010/examples/fanout/verify.in | 14 +++ .../client-010/examples/fanout/verify_cpp_dotnet | 11 +++ .../examples/fanout/verify_cpp_dotnet.in | 14 +++ .../client-010/examples/fanout/verify_dotnet_cpp | 12 +++ .../examples/fanout/verify_dotnet_cpp.in | 15 ++++ .../client-010/examples/fanout/verify_dotnet_java | 16 ++++ .../examples/fanout/verify_dotnet_java.in | 19 +++++ .../examples/fanout/verify_dotnet_python | 11 +++ .../examples/fanout/verify_dotnet_python.in | 14 +++ .../client-010/examples/fanout/verify_java_dotnet | 16 ++++ .../examples/fanout/verify_java_dotnet.in | 29 +++++++ .../examples/fanout/verify_python_dotnet | 11 +++ qpid/dotnet/client-010/examples/pub-sub/verify | 15 ++++ qpid/dotnet/client-010/examples/pub-sub/verify.in | 95 +++++++++++++++++++++ .../client-010/examples/pub-sub/verify_cpp_dotnet | 12 +++ .../examples/pub-sub/verify_cpp_dotnet.in | 55 ++++++++++++ .../client-010/examples/pub-sub/verify_dotnet_cpp | 11 +++ .../examples/pub-sub/verify_dotnet_cpp.in | 99 ++++++++++++++++++++++ .../client-010/examples/pub-sub/verify_dotnet_java | 15 ++++ .../examples/pub-sub/verify_dotnet_java.in | 95 +++++++++++++++++++++ .../examples/pub-sub/verify_dotnet_python | 11 +++ .../examples/pub-sub/verify_dotnet_python.in | 95 +++++++++++++++++++++ .../client-010/examples/pub-sub/verify_java_dotnet | 15 ++++ .../examples/pub-sub/verify_java_dotnet.in | 95 +++++++++++++++++++++ .../examples/pub-sub/verify_python_dotnet | 11 +++ .../client-010/examples/request-response/verify | 15 ++++ .../client-010/examples/request-response/verify.in | 16 ++++ .../examples/request-response/verify_cpp_dotnet | 12 +++ .../examples/request-response/verify_cpp_dotnet.in | 17 ++++ .../examples/request-response/verify_dotnet_cpp | 12 +++ .../examples/request-response/verify_dotnet_cpp.in | 18 ++++ .../examples/request-response/verify_dotnet_java | 16 ++++ .../request-response/verify_dotnet_java.in | 21 +++++ .../examples/request-response/verify_dotnet_python | 12 +++ .../request-response/verify_dotnet_python.in | 17 ++++ .../examples/request-response/verify_java_dotnet | 15 ++++ .../request-response/verify_java_dotnet.in | 36 ++++++++ .../examples/request-response/verify_python_dotnet | 12 +++ qpid/dotnet/client-010/test/interop/TestCase.cs | 4 +- 54 files changed, 1247 insertions(+), 2 deletions(-) create mode 100644 qpid/dotnet/client-010/examples/direct/verify create mode 100644 qpid/dotnet/client-010/examples/direct/verify.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet create mode 100644 qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_java create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_python create mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_java_dotnet create mode 100644 qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/direct/verify_python_dotnet create mode 100644 qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify create mode 100644 qpid/dotnet/client-010/examples/fanout/verify.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_java create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_python create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_java_dotnet create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_python_dotnet create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet create mode 100644 qpid/dotnet/client-010/examples/request-response/verify create mode 100644 qpid/dotnet/client-010/examples/request-response/verify.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_java create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_python create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_java_dotnet create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_python_dotnet (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/examples/direct/verify b/qpid/dotnet/client-010/examples/direct/verify new file mode 100644 index 0000000000..cd53687176 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/direct + +direct_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 +} + +direct_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 +} + +clients $cpp/declare_queues direct_producer_dotnet direct_listener_dotnet +outputs $cpp/declare_queues.out ./direct_producer_dotnet.out ./direct_listener_dotnet.out \ No newline at end of file diff --git a/qpid/dotnet/client-010/examples/direct/verify.in b/qpid/dotnet/client-010/examples/direct/verify.in new file mode 100644 index 0000000000..f57d931663 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify.in @@ -0,0 +1,14 @@ +==== declare_queues.out +==== direct_producer_dotnet.out +==== direct_listener_dotnet.out +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet new file mode 100644 index 0000000000..86fb7dddd4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet @@ -0,0 +1,10 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/direct + +direct_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 +} + +clients $cpp/declare_queues $cpp/direct_producer direct_listener_dotnet +outputs $cpp/declare_queues.out $cpp/direct_producer.out ./direct_listener_dotnet.out \ No newline at end of file diff --git a/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet.in new file mode 100644 index 0000000000..b3543cefe5 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet.in @@ -0,0 +1,14 @@ +==== declare_queues.out +==== direct_producer.out +==== direct_listener_dotnet.out +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp new file mode 100644 index 0000000000..fe86159fcc --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp @@ -0,0 +1,10 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/direct + +direct_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 +} + +clients $cpp/declare_queues direct_producer_dotnet $cpp/listener +outputs $cpp/declare_queues.out ./direct_producer_dotnet.out $cpp/listener.out \ No newline at end of file diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp.in b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp.in new file mode 100644 index 0000000000..fcb6cd66de --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp.in @@ -0,0 +1,15 @@ +==== declare_queues.out +==== direct_producer_dotnet.out +==== listener.out +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! +Shutting down listener for message_queue diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java new file mode 100644 index 0000000000..528f3eb664 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/direct + +direct_consumer_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Consumer +} + +direct_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 +} + +clients $cpp/declare_queues direct_producer_dotnet direct_consumer_java +outputs $cpp/declare_queues.out ./direct_producer_dotnet.out ./direct_consumer_java.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in new file mode 100644 index 0000000000..cd87551305 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in @@ -0,0 +1,20 @@ +==== declare_queues.out +==== direct_producer_dotnet.out +==== direct_consumer_java.out +Consumer: Setting an ExceptionListener on the connection as sample uses a MessageConsumer +Consumer: Creating a non-transacted, auto-acknowledged session +Consumer: Creating a MessageConsumer +Consumer: Starting connection so MessageConsumer can receive messages +Consumer: Received message: Message 0 +Consumer: Received message: Message 1 +Consumer: Received message: Message 2 +Consumer: Received message: Message 3 +Consumer: Received message: Message 4 +Consumer: Received message: Message 5 +Consumer: Received message: Message 6 +Consumer: Received message: Message 7 +Consumer: Received message: Message 8 +Consumer: Received message: Message 9 +Consumer: Received final message That's all, folks! +Consumer: Closing connection +Consumer: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python new file mode 100644 index 0000000000..0c70465bc5 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python @@ -0,0 +1,10 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/direct + +direct_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 +} + +clients $py/declare_queues.py direct_producer_dotnet $py/direct_consumer.py +outputs $py/declare_queues.py.out ./direct_producer_dotnet.out $py/direct_consumer.py.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in new file mode 100644 index 0000000000..7059b3079c --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in @@ -0,0 +1,14 @@ +==== declare_queues.py.out +==== direct_producer_dotnet.out +==== direct_consumer.py.out +Message 0 +Message 1 +Message 2 +Message 3 +Message 4 +Message 5 +Message 6 +Message 7 +Message 8 +Message 9 +That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet new file mode 100644 index 0000000000..50eb73f9f5 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/direct + +direct_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 +} + +direct_producer_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Producer +} + +clients $cpp/declare_queues direct_producer_java direct_listener_dotnet +outputs $cpp/declare_queues.out ./direct_producer_java.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in new file mode 100644 index 0000000000..23628b89de --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in @@ -0,0 +1,29 @@ +==== declare_queues.out +==== direct_producer_java.out +Producer: Creating a non-transacted, auto-acknowledged session +Producer: Creating a Message Producer +Producer: Creating a TestMessage to send to the destination +Producer: Sending message: 1 +Producer: Sending message: 2 +Producer: Sending message: 3 +Producer: Sending message: 4 +Producer: Sending message: 5 +Producer: Sending message: 6 +Producer: Sending message: 7 +Producer: Sending message: 8 +Producer: Sending message: 9 +Producer: Sending message: 10 +Producer: Closing connection +Producer: Closing JNDI context +==== direct_listener_dotnet.out +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: Message 10 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet new file mode 100644 index 0000000000..086b31caf4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet @@ -0,0 +1,10 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/direct + +direct_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 +} + +clients $py/declare_queues.py $py/direct_producer.py direct_listener_dotnet +outputs $py/declare_queues.py.out $py/direct_producer.py.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in new file mode 100644 index 0000000000..6fc2eeb18f --- /dev/null +++ b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in @@ -0,0 +1,14 @@ +==== declare_queues.py.out +==== direct_producer.py.out +==== direct_listener_dotnet.out +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify b/qpid/dotnet/client-010/examples/fanout/verify new file mode 100644 index 0000000000..b53d440895 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +fanout_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 +} + +fanout_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 +} + +background "Listening" fanout_listener_dotnet +clients fanout_producer_dotnet +outputs ./fanout_listener_dotnet.out ./fanout_producer_dotnet.out diff --git a/qpid/dotnet/client-010/examples/fanout/verify.in b/qpid/dotnet/client-010/examples/fanout/verify.in new file mode 100644 index 0000000000..37a4a4aaa8 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify.in @@ -0,0 +1,14 @@ +==== fanout_listener_dotnet.out +Listening +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! +==== fanout_producer_dotnet.out diff --git a/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet new file mode 100644 index 0000000000..b9b0d94857 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/fanout + +fanout_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 +} + +background "Listening" fanout_listener_dotnet +clients $cpp/fanout_producer +outputs $cpp/fanout_producer.out "./fanout_listener_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet.in b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet.in new file mode 100644 index 0000000000..0a72d8fd3c --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet.in @@ -0,0 +1,14 @@ +==== fanout_producer.out +==== fanout_listener_dotnet.out | remove_uuid +Listening +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp new file mode 100644 index 0000000000..1b27ea8653 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/fanout + +fanout_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 +} + + +background "Listening" $cpp/listener +clients fanout_producer_dotnet +outputs ./fanout_producer_dotnet.out "$cpp/listener.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp.in b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp.in new file mode 100644 index 0000000000..588559938f --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp.in @@ -0,0 +1,15 @@ +==== fanout_producer_dotnet.out +==== listener.out | remove_uuid +Listening +Message: Message 0 +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: That's all, folks! +Shutting down listener for diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java new file mode 100644 index 0000000000..88576814d7 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java @@ -0,0 +1,16 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +fanout_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 +} + + +fanout_listener_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Listener $1 +} + +background "can receive messages" fanout_listener_java fanoutQueue1 +clients fanout_producer_dotnet +outputs ./fanout_producer_dotnet.out "./fanout_listener_java.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in new file mode 100644 index 0000000000..06d3a6e66b --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in @@ -0,0 +1,19 @@ +==== fanout_producer_dotnet.out +==== fanout_listener_java.out | remove_uuid +Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer +Listener: Creating a non-transacted, auto-acknowledged session +Listener: Creating a MessageConsumer +Listener: Starting connection so MessageConsumer can receive messages +Listener: Received message: Message 0 +Listener: Received message: Message 1 +Listener: Received message: Message 2 +Listener: Received message: Message 3 +Listener: Received message: Message 4 +Listener: Received message: Message 5 +Listener: Received message: Message 6 +Listener: Received message: Message 7 +Listener: Received message: Message 8 +Listener: Received message: Message 9 +Listener: Received final message That's all, folks! +Listener: Closing connection +Listener: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python new file mode 100644 index 0000000000..a09b26ca6a --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/fanout + +fanout_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 +} + +background "Subscribed" $py/fanout_consumer.py +clients fanout_producer_dotnet +outputs ./fanout_producer_dotnet.out "$py/fanout_consumer.py.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in new file mode 100644 index 0000000000..e9959c2e25 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in @@ -0,0 +1,14 @@ +==== fanout_producer_dotnet.out +==== fanout_consumer.py.out | remove_uuid +Subscribed to queue +Message 0 +Message 1 +Message 2 +Message 3 +Message 4 +Message 5 +Message 6 +Message 7 +Message 8 +Message 9 +That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet new file mode 100644 index 0000000000..d72954de0e --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet @@ -0,0 +1,16 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +fanout_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 +} + + +fanout_producer_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Producer +} + +background "Listening" fanout_listener_dotnet +clients fanout_producer_java +outputs fanout_producer_java.out "./fanout_listener_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in new file mode 100644 index 0000000000..acf1b61221 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in @@ -0,0 +1,29 @@ +==== fanout_producer_java.out +Producer: Creating a non-transacted, auto-acknowledged session +Producer: Creating a Message Producer +Producer: Creating a TestMessage to send to the destination +Producer: Sending message: 1 +Producer: Sending message: 2 +Producer: Sending message: 3 +Producer: Sending message: 4 +Producer: Sending message: 5 +Producer: Sending message: 6 +Producer: Sending message: 7 +Producer: Sending message: 8 +Producer: Sending message: 9 +Producer: Sending message: 10 +Producer: Closing connection +Producer: Closing JNDI context +==== fanout_listener_dotnet.out | remove_uuid +Listening +Message: Message 1 +Message: Message 2 +Message: Message 3 +Message: Message 4 +Message: Message 5 +Message: Message 6 +Message: Message 7 +Message: Message 8 +Message: Message 9 +Message: Message 10 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet new file mode 100644 index 0000000000..ac472c0f72 --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/fanout + +fanout_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 +} + +background "Listening" fanout_listener_dotnet +clients $py/fanout_producer.py +outputs $py/fanout_producer.py.out "./fanout_listener_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify b/qpid/dotnet/client-010/examples/pub-sub/verify new file mode 100644 index 0000000000..8e4e7516ab --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +pubsub_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 +} + +pubsub_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 +} + +background "Listening for messages ..." pubsub_listener_dotnet +clients pubsub_producer_dotnet +outputs pubsub_producer_dotnet.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify.in b/qpid/dotnet/client-010/examples/pub-sub/verify.in new file mode 100644 index 0000000000..6a5adc4d89 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify.in @@ -0,0 +1,95 @@ +==== pubsub_producer_dotnet.out +==== pubsub_listener_dotnet.out | remove_uuid | sort +Declaring queue: europe +Declaring queue: news +Declaring queue: usa +Declaring queue: weather +Listening for messages ... +Message: Message 0 from europe +Message: Message 0 from europe +Message: Message 0 from news +Message: Message 0 from news +Message: Message 0 from usa +Message: Message 0 from usa +Message: Message 0 from weather +Message: Message 0 from weather +Message: Message 1 from europe +Message: Message 1 from europe +Message: Message 1 from news +Message: Message 1 from news +Message: Message 1 from usa +Message: Message 1 from usa +Message: Message 1 from weather +Message: Message 1 from weather +Message: Message 2 from europe +Message: Message 2 from europe +Message: Message 2 from news +Message: Message 2 from news +Message: Message 2 from usa +Message: Message 2 from usa +Message: Message 2 from weather +Message: Message 2 from weather +Message: Message 3 from europe +Message: Message 3 from europe +Message: Message 3 from news +Message: Message 3 from news +Message: Message 3 from usa +Message: Message 3 from usa +Message: Message 3 from weather +Message: Message 3 from weather +Message: Message 4 from europe +Message: Message 4 from europe +Message: Message 4 from news +Message: Message 4 from news +Message: Message 4 from usa +Message: Message 4 from usa +Message: Message 4 from weather +Message: Message 4 from weather +Message: Message 5 from europe +Message: Message 5 from europe +Message: Message 5 from news +Message: Message 5 from news +Message: Message 5 from usa +Message: Message 5 from usa +Message: Message 5 from weather +Message: Message 5 from weather +Message: Message 6 from europe +Message: Message 6 from europe +Message: Message 6 from news +Message: Message 6 from news +Message: Message 6 from usa +Message: Message 6 from usa +Message: Message 6 from weather +Message: Message 6 from weather +Message: Message 7 from europe +Message: Message 7 from europe +Message: Message 7 from news +Message: Message 7 from news +Message: Message 7 from usa +Message: Message 7 from usa +Message: Message 7 from weather +Message: Message 7 from weather +Message: Message 8 from europe +Message: Message 8 from europe +Message: Message 8 from news +Message: Message 8 from news +Message: Message 8 from usa +Message: Message 8 from usa +Message: Message 8 from weather +Message: Message 8 from weather +Message: Message 9 from europe +Message: Message 9 from europe +Message: Message 9 from news +Message: Message 9 from news +Message: Message 9 from usa +Message: Message 9 from usa +Message: Message 9 from weather +Message: Message 9 from weather +Message: That's all, folks! from europe +Message: That's all, folks! from news +Message: That's all, folks! from usa +Message: That's all, folks! from weather +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet new file mode 100644 index 0000000000..86d60578ad --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/pub-sub + +pubsub_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 +} + + +background "Listening for messages ..." pubsub_listener_dotnet +clients $cpp/topic_publisher +outputs $cpp/topic_publisher.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet.in b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet.in new file mode 100644 index 0000000000..4e058f7645 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet.in @@ -0,0 +1,55 @@ +==== topic_publisher.out +==== pubsub_listener_dotnet.out | remove_uuid | sort +Declaring queue: europe +Declaring queue: news +Declaring queue: usa +Declaring queue: weather +Listening for messages ... +Message: Message 0 from europe +Message: Message 0 from europe +Message: Message 0 from news +Message: Message 0 from news +Message: Message 0 from usa +Message: Message 0 from usa +Message: Message 0 from weather +Message: Message 0 from weather +Message: Message 1 from europe +Message: Message 1 from europe +Message: Message 1 from news +Message: Message 1 from news +Message: Message 1 from usa +Message: Message 1 from usa +Message: Message 1 from weather +Message: Message 1 from weather +Message: Message 2 from europe +Message: Message 2 from europe +Message: Message 2 from news +Message: Message 2 from news +Message: Message 2 from usa +Message: Message 2 from usa +Message: Message 2 from weather +Message: Message 2 from weather +Message: Message 3 from europe +Message: Message 3 from europe +Message: Message 3 from news +Message: Message 3 from news +Message: Message 3 from usa +Message: Message 3 from usa +Message: Message 3 from weather +Message: Message 3 from weather +Message: Message 4 from europe +Message: Message 4 from europe +Message: Message 4 from news +Message: Message 4 from news +Message: Message 4 from usa +Message: Message 4 from usa +Message: Message 4 from weather +Message: Message 4 from weather +Message: That's all, folks! from europe +Message: That's all, folks! from news +Message: That's all, folks! from usa +Message: That's all, folks! from weather +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp new file mode 100644 index 0000000000..66d0f5ba52 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/pub-sub + +pubsub_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 +} + +background "Listening" $cpp/topic_listener +clients pubsub_producer_dotnet +outputs pubsub_producer_dotnet.out "$cpp/topic_listener.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp.in b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp.in new file mode 100644 index 0000000000..64ac27846d --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp.in @@ -0,0 +1,99 @@ +==== pubsub_producer_dotnet.out +==== topic_listener.out | remove_uuid | sort +Declaring queue: europe +Declaring queue: news +Declaring queue: usa +Declaring queue: weather +Listening for messages ... +Message: Message 0 from europe +Message: Message 0 from europe +Message: Message 0 from news +Message: Message 0 from news +Message: Message 0 from usa +Message: Message 0 from usa +Message: Message 0 from weather +Message: Message 0 from weather +Message: Message 1 from europe +Message: Message 1 from europe +Message: Message 1 from news +Message: Message 1 from news +Message: Message 1 from usa +Message: Message 1 from usa +Message: Message 1 from weather +Message: Message 1 from weather +Message: Message 2 from europe +Message: Message 2 from europe +Message: Message 2 from news +Message: Message 2 from news +Message: Message 2 from usa +Message: Message 2 from usa +Message: Message 2 from weather +Message: Message 2 from weather +Message: Message 3 from europe +Message: Message 3 from europe +Message: Message 3 from news +Message: Message 3 from news +Message: Message 3 from usa +Message: Message 3 from usa +Message: Message 3 from weather +Message: Message 3 from weather +Message: Message 4 from europe +Message: Message 4 from europe +Message: Message 4 from news +Message: Message 4 from news +Message: Message 4 from usa +Message: Message 4 from usa +Message: Message 4 from weather +Message: Message 4 from weather +Message: Message 5 from europe +Message: Message 5 from europe +Message: Message 5 from news +Message: Message 5 from news +Message: Message 5 from usa +Message: Message 5 from usa +Message: Message 5 from weather +Message: Message 5 from weather +Message: Message 6 from europe +Message: Message 6 from europe +Message: Message 6 from news +Message: Message 6 from news +Message: Message 6 from usa +Message: Message 6 from usa +Message: Message 6 from weather +Message: Message 6 from weather +Message: Message 7 from europe +Message: Message 7 from europe +Message: Message 7 from news +Message: Message 7 from news +Message: Message 7 from usa +Message: Message 7 from usa +Message: Message 7 from weather +Message: Message 7 from weather +Message: Message 8 from europe +Message: Message 8 from europe +Message: Message 8 from news +Message: Message 8 from news +Message: Message 8 from usa +Message: Message 8 from usa +Message: Message 8 from weather +Message: Message 8 from weather +Message: Message 9 from europe +Message: Message 9 from europe +Message: Message 9 from news +Message: Message 9 from news +Message: Message 9 from usa +Message: Message 9 from usa +Message: Message 9 from weather +Message: Message 9 from weather +Message: That's all, folks! from europe +Message: That's all, folks! from news +Message: That's all, folks! from usa +Message: That's all, folks! from weather +Shutting down listener for europe +Shutting down listener for news +Shutting down listener for usa +Shutting down listener for weather +Subscribing to queue europe +Subscribing to queue news +Subscribing to queue usa +Subscribing to queue weather diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java new file mode 100644 index 0000000000..0b90416a7e --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +topic_listener_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Listener +} + +pubsub_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 +} + +background "can receive messages" topic_listener_java +clients pubsub_producer_dotnet +outputs pubsub_producer_dotnet.out "topic_listener_java.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in new file mode 100644 index 0000000000..5db02e64b1 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in @@ -0,0 +1,95 @@ +==== pubsub_producer_dotnet.out +==== topic_listener_java.out | remove_uuid | sort +Listener: Closing connection +Listener: Closing JNDI context +Listener: Creating a Message Subscriber for topic europe +Listener: Creating a Message Subscriber for topic news +Listener: Creating a Message Subscriber for topic usa +Listener: Creating a Message Subscriber for topic weather +Listener: Creating a non-transacted, auto-acknowledged session +Listener: Received message for topic: europe: Message 0 +Listener: Received message for topic: europe: Message 0 +Listener: Received message for topic: europe: Message 1 +Listener: Received message for topic: europe: Message 1 +Listener: Received message for topic: europe: Message 2 +Listener: Received message for topic: europe: Message 2 +Listener: Received message for topic: europe: Message 3 +Listener: Received message for topic: europe: Message 3 +Listener: Received message for topic: europe: Message 4 +Listener: Received message for topic: europe: Message 4 +Listener: Received message for topic: europe: Message 5 +Listener: Received message for topic: europe: Message 5 +Listener: Received message for topic: europe: Message 6 +Listener: Received message for topic: europe: Message 6 +Listener: Received message for topic: europe: Message 7 +Listener: Received message for topic: europe: Message 7 +Listener: Received message for topic: europe: Message 8 +Listener: Received message for topic: europe: Message 8 +Listener: Received message for topic: europe: Message 9 +Listener: Received message for topic: europe: Message 9 +Listener: Received message for topic: news: Message 0 +Listener: Received message for topic: news: Message 0 +Listener: Received message for topic: news: Message 1 +Listener: Received message for topic: news: Message 1 +Listener: Received message for topic: news: Message 2 +Listener: Received message for topic: news: Message 2 +Listener: Received message for topic: news: Message 3 +Listener: Received message for topic: news: Message 3 +Listener: Received message for topic: news: Message 4 +Listener: Received message for topic: news: Message 4 +Listener: Received message for topic: news: Message 5 +Listener: Received message for topic: news: Message 5 +Listener: Received message for topic: news: Message 6 +Listener: Received message for topic: news: Message 6 +Listener: Received message for topic: news: Message 7 +Listener: Received message for topic: news: Message 7 +Listener: Received message for topic: news: Message 8 +Listener: Received message for topic: news: Message 8 +Listener: Received message for topic: news: Message 9 +Listener: Received message for topic: news: Message 9 +Listener: Received message for topic: usa: Message 0 +Listener: Received message for topic: usa: Message 0 +Listener: Received message for topic: usa: Message 1 +Listener: Received message for topic: usa: Message 1 +Listener: Received message for topic: usa: Message 2 +Listener: Received message for topic: usa: Message 2 +Listener: Received message for topic: usa: Message 3 +Listener: Received message for topic: usa: Message 3 +Listener: Received message for topic: usa: Message 4 +Listener: Received message for topic: usa: Message 4 +Listener: Received message for topic: usa: Message 5 +Listener: Received message for topic: usa: Message 5 +Listener: Received message for topic: usa: Message 6 +Listener: Received message for topic: usa: Message 6 +Listener: Received message for topic: usa: Message 7 +Listener: Received message for topic: usa: Message 7 +Listener: Received message for topic: usa: Message 8 +Listener: Received message for topic: usa: Message 8 +Listener: Received message for topic: usa: Message 9 +Listener: Received message for topic: usa: Message 9 +Listener: Received message for topic: weather: Message 0 +Listener: Received message for topic: weather: Message 0 +Listener: Received message for topic: weather: Message 1 +Listener: Received message for topic: weather: Message 1 +Listener: Received message for topic: weather: Message 2 +Listener: Received message for topic: weather: Message 2 +Listener: Received message for topic: weather: Message 3 +Listener: Received message for topic: weather: Message 3 +Listener: Received message for topic: weather: Message 4 +Listener: Received message for topic: weather: Message 4 +Listener: Received message for topic: weather: Message 5 +Listener: Received message for topic: weather: Message 5 +Listener: Received message for topic: weather: Message 6 +Listener: Received message for topic: weather: Message 6 +Listener: Received message for topic: weather: Message 7 +Listener: Received message for topic: weather: Message 7 +Listener: Received message for topic: weather: Message 8 +Listener: Received message for topic: weather: Message 8 +Listener: Received message for topic: weather: Message 9 +Listener: Received message for topic: weather: Message 9 +Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber +Listener: Shutting down listener for europe +Listener: Shutting down listener for news +Listener: Shutting down listener for usa +Listener: Shutting down listener for weather +Listener: Starting connection so TopicSubscriber can receive messages diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python new file mode 100644 index 0000000000..dd62dbcbeb --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/pubsub + +pubsub_producer_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 +} + +background "Queues created" $py/topic_subscriber.py +clients pubsub_producer_dotnet +outputs ./pubsub_producer_dotnet.out "$py/topic_subscriber.py.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in new file mode 100644 index 0000000000..130efa2b0e --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in @@ -0,0 +1,95 @@ +==== pubsub_producer_dotnet.out +==== topic_subscriber.py.out | remove_uuid | sort +Message 0 +Message 0 +Message 0 +Message 0 +Message 0 +Message 0 +Message 0 +Message 0 +Message 1 +Message 1 +Message 1 +Message 1 +Message 1 +Message 1 +Message 1 +Message 1 +Message 2 +Message 2 +Message 2 +Message 2 +Message 2 +Message 2 +Message 2 +Message 2 +Message 3 +Message 3 +Message 3 +Message 3 +Message 3 +Message 3 +Message 3 +Message 3 +Message 4 +Message 4 +Message 4 +Message 4 +Message 4 +Message 4 +Message 4 +Message 4 +Message 5 +Message 5 +Message 5 +Message 5 +Message 5 +Message 5 +Message 5 +Message 5 +Message 6 +Message 6 +Message 6 +Message 6 +Message 6 +Message 6 +Message 6 +Message 6 +Message 7 +Message 7 +Message 7 +Message 7 +Message 7 +Message 7 +Message 7 +Message 7 +Message 8 +Message 8 +Message 8 +Message 8 +Message 8 +Message 8 +Message 8 +Message 8 +Message 9 +Message 9 +Message 9 +Message 9 +Message 9 +Message 9 +Message 9 +Message 9 +Messages on 'europe' queue: +Messages on 'news' queue: +Messages on 'usa' queue: +Messages on 'weather' queue: +Queues created - please start the topic producer +Subscribing local queue 'local_europe' to europe-' +Subscribing local queue 'local_news' to news-' +Subscribing local queue 'local_usa' to usa-' +Subscribing local queue 'local_weather' to weather-' +That's all, folks! +That's all, folks! +That's all, folks! +That's all, folks! diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet new file mode 100644 index 0000000000..52069957c5 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +pubsub_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 +} + +topic_publisher_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Publisher +} + +background "Listening for messages ..." pubsub_listener_dotnet +clients topic_publisher_java +outputs topic_publisher_java.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in new file mode 100644 index 0000000000..1b37f711c4 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in @@ -0,0 +1,95 @@ +==== topic_publisher_java.out +Publisher: Creating a non-transacted, auto-acknowledged session +Publisher: Creating a TestMessage to send to the topics +Publisher: Creating a Message Publisher for topic usa.weather +Publisher: Sending message 1 +Publisher: Sending message 2 +Publisher: Sending message 3 +Publisher: Sending message 4 +Publisher: Sending message 5 +Publisher: Sending message 6 +Publisher: Creating a Message Publisher for topic usa.news +Publisher: Sending message 1 +Publisher: Sending message 2 +Publisher: Sending message 3 +Publisher: Sending message 4 +Publisher: Sending message 5 +Publisher: Sending message 6 +Publisher: Creating a Message Publisher for topic europe.weather +Publisher: Sending message 1 +Publisher: Sending message 2 +Publisher: Sending message 3 +Publisher: Sending message 4 +Publisher: Sending message 5 +Publisher: Sending message 6 +Publisher: Creating a Message Publisher for topic europe.news +Publisher: Sending message 1 +Publisher: Sending message 2 +Publisher: Sending message 3 +Publisher: Sending message 4 +Publisher: Sending message 5 +Publisher: Sending message 6 +Publisher: Closing connection +Publisher: Closing JNDI context +==== pubsub_listener_dotnet.out | remove_uuid | sort +Declaring queue: europe +Declaring queue: news +Declaring queue: usa +Declaring queue: weather +Listening for messages ... +Message: message 1 from europe +Message: message 1 from europe +Message: message 1 from news +Message: message 1 from news +Message: message 1 from usa +Message: message 1 from usa +Message: message 1 from weather +Message: message 1 from weather +Message: message 2 from europe +Message: message 2 from europe +Message: message 2 from news +Message: message 2 from news +Message: message 2 from usa +Message: message 2 from usa +Message: message 2 from weather +Message: message 2 from weather +Message: message 3 from europe +Message: message 3 from europe +Message: message 3 from news +Message: message 3 from news +Message: message 3 from usa +Message: message 3 from usa +Message: message 3 from weather +Message: message 3 from weather +Message: message 4 from europe +Message: message 4 from europe +Message: message 4 from news +Message: message 4 from news +Message: message 4 from usa +Message: message 4 from usa +Message: message 4 from weather +Message: message 4 from weather +Message: message 5 from europe +Message: message 5 from europe +Message: message 5 from news +Message: message 5 from news +Message: message 5 from usa +Message: message 5 from usa +Message: message 5 from weather +Message: message 5 from weather +Message: message 6 from europe +Message: message 6 from europe +Message: message 6 from news +Message: message 6 from news +Message: message 6 from usa +Message: message 6 from usa +Message: message 6 from weather +Message: message 6 from weather +Message: That's all, folks! from europe +Message: That's all, folks! from news +Message: That's all, folks! from usa +Message: That's all, folks! from weather +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet new file mode 100644 index 0000000000..0366e3a9ac --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet @@ -0,0 +1,11 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/pubsub + +pubsub_listener_dotnet() +{ +mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 +} + +background "Listening for messages ..." pubsub_listener_dotnet +clients $py/topic_publisher.py +outputs $py/topic_publisher.py.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/request-response/verify b/qpid/dotnet/client-010/examples/request-response/verify new file mode 100644 index 0000000000..1ee4f25c18 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +server_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 +} + +client_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 +} + +background "Waiting for requests" server_dotnet +clients client_dotnet +outputs ./server_dotnet.out ./client_dotnet.out diff --git a/qpid/dotnet/client-010/examples/request-response/verify.in b/qpid/dotnet/client-010/examples/request-response/verify.in new file mode 100644 index 0000000000..5357591289 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify.in @@ -0,0 +1,16 @@ +==== server_dotnet.out +Waiting for requests +Request: Twas brillig, and the slithy toves +Request: Did gire and gymble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. +Request: That's all, folks! +==== client_dotnet.out +Activating response queue listener for: clientSystem.Byte[] +Waiting for all responses to arrive ... +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GIRE AND GYMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +Shutting down listener for clientSystem.Byte[] +Response: THAT'S ALL, FOLKS! diff --git a/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet new file mode 100644 index 0000000000..3cc0370ada --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/request-response + +client_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 +} + +background "Waiting" $cpp/server +clients client_dotnet +kill %% +outputs ./client_dotnet.out "$cpp/server.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet.in b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet.in new file mode 100644 index 0000000000..0f4b5341b2 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet.in @@ -0,0 +1,17 @@ +==== client_dotnet.out +Activating response queue listener for: clientSystem.Byte[] +Waiting for all responses to arrive ... +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GIRE AND GYMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +Shutting down listener for clientSystem.Byte[] +Response: THAT'S ALL, FOLKS! +==== server.out | remove_uuid +Activating request queue listener for: request +Waiting for requests +Request: Twas brillig, and the slithy toves (clientSystem.Byte[]) +Request: Did gire and gymble in the wabe. (clientSystem.Byte[]) +Request: All mimsy were the borogroves, (clientSystem.Byte[]) +Request: And the mome raths outgrabe. (clientSystem.Byte[]) +Request: That's all, folks! (clientSystem.Byte[]) diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp new file mode 100644 index 0000000000..81b86a0b41 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +cpp=$CPP/request-response + +server_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 +} + +background "Waiting for requests" server_dotnet +clients $cpp/client +kill %% +outputs "$cpp/client.out | remove_uuid" ./server_dotnet.out diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp.in b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp.in new file mode 100644 index 0000000000..849fad39c6 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp.in @@ -0,0 +1,18 @@ +==== client.out | remove_uuid +Activating response queue listener for: client +Request: Twas brillig, and the slithy toves +Request: Did gire and gymble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. +Waiting for all responses to arrive ... +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GIRE AND GYMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +Shutting down listener for client +==== server_dotnet.out +Waiting for requests +Request: Twas brillig, and the slithy toves +Request: Did gire and gymble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java new file mode 100644 index 0000000000..56477c623a --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java @@ -0,0 +1,16 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +server_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 +} + +client_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Client +} + +background "Waiting for requests" server_dotnet +clients client_java +kill %% +outputs ./server_dotnet.out "client_java.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in new file mode 100644 index 0000000000..96e8b8a255 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in @@ -0,0 +1,21 @@ +==== server_dotnet.out +Waiting for requests +Request: Twas brillig, and the slithy toves +Request: Did gire and gymble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. +==== client_java.out | remove_uuid +Client: Setting an ExceptionListener on the connection as sample uses a MessageConsumer +Client: Creating a non-transacted, auto-acknowledged session +Client: Creating a QueueRequestor +Client: Starting connection +Client: Request Content= Twas brillig, and the slithy toves +Client: Response Content= TWAS BRILLIG, AND THE SLITHY TOVES +Client: Request Content= Did gire and gymble in the wabe. +Client: Response Content= DID GIRE AND GYMBLE IN THE WABE. +Client: Request Content= All mimsy were the borogroves, +Client: Response Content= ALL MIMSY WERE THE BOROGROVES, +Client: Request Content= And the mome raths outgrabe. +Client: Response Content= AND THE MOME RATHS OUTGRABE. +Client: Closing connection +Client: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python new file mode 100644 index 0000000000..8ae2f41361 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/request-response + +server_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 +} + +background "Waiting for requests" server_dotnet +clients $py/client.py +kill %% +outputs "$py/client.py.out | remove_uuid" "server_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in new file mode 100644 index 0000000000..4455f4e133 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in @@ -0,0 +1,17 @@ +==== client.py.out | remove_uuid +Request: Twas brillig, and the slithy toves +Request: Did gyre and gimble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. +Messages on queue: reply_to: +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GYRE AND GIMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +No more messages! +==== server_dotnet.out | remove_uuid +Waiting for requests +Request: Twas brillig, and the slithy toves +Request: Did gyre and gimble in the wabe. +Request: All mimsy were the borogroves, +Request: And the mome raths outgrabe. diff --git a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet new file mode 100644 index 0000000000..6950a6a4ec --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet @@ -0,0 +1,15 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify + +server_java() +{ +java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Server +} + +client_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 +} +background "can receive messages" server_java +clients client_dotnet +kill %% +outputs "server_java.out | remove_uuid" ./client_dotnet.out diff --git a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in new file mode 100644 index 0000000000..16b1853f37 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in @@ -0,0 +1,36 @@ +==== server_java.out | remove_uuid +Server: Setting an ExceptionListener on the connection as sample uses a MessageConsumer +Server: Creating a non-transacted, auto-acknowledged session +Server: Creating a MessageConsumer +Server: Creating a MessageProducer +Server: Starting connection so MessageConsumer can receive messages +Server: Receiving the message +Server: Activating response queue listener +Server: Response = TWAS BRILLIG, AND THE SLITHY TOVES + +Server: Receiving the message +Server: Activating response queue listener +Server: Response = DID GIRE AND GYMBLE IN THE WABE. + +Server: Receiving the message +Server: Activating response queue listener +Server: Response = ALL MIMSY WERE THE BOROGROVES, + +Server: Receiving the message +Server: Activating response queue listener +Server: Response = AND THE MOME RATHS OUTGRABE. + +Server: Receiving the message +Server: Activating response queue listener +Server: Response = THAT'S ALL, FOLKS! + +Server: Receiving the message +==== client_dotnet.out +Activating response queue listener for: clientSystem.Byte[] +Waiting for all responses to arrive ... +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GIRE AND GYMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +Shutting down listener for clientSystem.Byte[] +Response: THAT'S ALL, FOLKS! diff --git a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet new file mode 100644 index 0000000000..f1b5d662bd --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet @@ -0,0 +1,12 @@ +# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify +py=$PYTHON_EXAMPLES/request-response + +client_dotnet() +{ +mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 +} + +background "Request server running" $py/server.py +clients client_dotnet +kill %% +outputs "client_dotnet.out | remove_uuid" "$py/server.py.out | remove_uuid" diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs index 16a5522726..8877de50cb 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -43,7 +43,7 @@ namespace test.interop [TestFixtureSetUp] public void Init() { - XmlConfigurator.Configure(new FileInfo(".\\log.xml")); + XmlConfigurator.Configure(new FileInfo("/log.xml")); // populate default properties _properties.Add("UserName", "guest"); _properties.Add("Password", "guest"); @@ -51,7 +51,7 @@ namespace test.interop _properties.Add("Port", "5672"); _properties.Add("VirtualHost", "test"); //Read the test config file - XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + ".\\test.config"); + XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + "/test.config"); while (reader.Read()) { // if node type is an element -- cgit v1.2.1 From 21261b26539a4b55ab8ce9620c2e986ec30d1963 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 17 Oct 2008 14:47:08 +0000 Subject: qpid-1372: added handling of empty message properties. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@705630 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/transport/network/Assembler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/network/Assembler.cs b/qpid/dotnet/client-010/client/transport/network/Assembler.cs index 53a38eff32..6f81c8edee 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -211,8 +211,7 @@ namespace org.apache.qpid.transport.network case SegmentType.HEADER: command = incomplete[channel]; List structs = new List(); - //while (decoder.hasRemaining()) - for (int i = 0; i < 2; i++ ) + while (decoder.hasRemaining()) { structs.Add(decoder.readStruct32()); } -- cgit v1.2.1 From e8b912389729d6af79ab99bd555afa28acf277bc Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Fri, 17 Oct 2008 15:18:09 +0000 Subject: qpid-1372: added handling of empty message properties at the header level git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@705641 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Message.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Message.cs b/qpid/dotnet/client-010/client/client/Message.cs index 3e18b4d7b7..567ca5cae7 100644 --- a/qpid/dotnet/client-010/client/client/Message.cs +++ b/qpid/dotnet/client-010/client/client/Message.cs @@ -44,7 +44,7 @@ namespace org.apache.qpid.client { get { - if (_message.Header != null) + if (_message.Header != null && Header.Structs.Length > 1) return (MessageProperties) Header.Structs[0]; return null; } @@ -62,7 +62,12 @@ namespace org.apache.qpid.client get { if (Header != null) - return (DeliveryProperties) Header.Structs[1]; + { + if( Header.Structs.Length > 1 ) + return (DeliveryProperties)Header.Structs[1]; + return (DeliveryProperties)Header.Structs[0]; + } + return null; } set -- cgit v1.2.1 From 69b8c3402b83d702eb2a0e70cdec14d93089c00f Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 20 Oct 2008 08:27:13 +0000 Subject: qpid-1371: added python/dotnet .in files git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@706147 13f79535-47bb-0310-9956-ffa450edef68 --- .../examples/direct/verify_python_dotnet.in | 20 ++++---- .../examples/fanout/verify_python_dotnet.in | 14 ++++++ .../examples/pub-sub/verify_python_dotnet.in | 55 ++++++++++++++++++++++ .../request-response/verify_python_dotnet.in | 12 +++++ 4 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in create mode 100644 qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in index 6fc2eeb18f..a556e7ad86 100644 --- a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in +++ b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in @@ -1,14 +1,14 @@ ==== declare_queues.py.out ==== direct_producer.py.out ==== direct_listener_dotnet.out -Message: Message 0 -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 +Message: message 0 +Message: message 1 +Message: message 2 +Message: message 3 +Message: message 4 +Message: message 5 +Message: message 6 +Message: message 7 +Message: message 8 +Message: message 9 Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in new file mode 100644 index 0000000000..b489c63a2c --- /dev/null +++ b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in @@ -0,0 +1,14 @@ +==== fanout_producer.py.out +==== fanout_listener_dotnet.out | remove_uuid +Listening +Message: message 0 +Message: message 1 +Message: message 2 +Message: message 3 +Message: message 4 +Message: message 5 +Message: message 6 +Message: message 7 +Message: message 8 +Message: message 9 +Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in new file mode 100644 index 0000000000..ac1b681b32 --- /dev/null +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in @@ -0,0 +1,55 @@ +==== topic_publisher.py.out +==== pubsub_listener_dotnet.out | remove_uuid | sort +Declaring queue: europe +Declaring queue: news +Declaring queue: usa +Declaring queue: weather +Listening for messages ... +Message: europe.news 0 from europe +Message: europe.news 0 from news +Message: europe.news 1 from europe +Message: europe.news 1 from news +Message: europe.news 2 from europe +Message: europe.news 2 from news +Message: europe.news 3 from europe +Message: europe.news 3 from news +Message: europe.news 4 from europe +Message: europe.news 4 from news +Message: europe.weather 0 from europe +Message: europe.weather 0 from weather +Message: europe.weather 1 from europe +Message: europe.weather 1 from weather +Message: europe.weather 2 from europe +Message: europe.weather 2 from weather +Message: europe.weather 3 from europe +Message: europe.weather 3 from weather +Message: europe.weather 4 from europe +Message: europe.weather 4 from weather +Message: That's all, folks! from europe +Message: That's all, folks! from news +Message: That's all, folks! from usa +Message: That's all, folks! from weather +Message: usa.news 0 from news +Message: usa.news 0 from usa +Message: usa.news 1 from news +Message: usa.news 1 from usa +Message: usa.news 2 from news +Message: usa.news 2 from usa +Message: usa.news 3 from news +Message: usa.news 3 from usa +Message: usa.news 4 from news +Message: usa.news 4 from usa +Message: usa.weather 0 from usa +Message: usa.weather 0 from weather +Message: usa.weather 1 from usa +Message: usa.weather 1 from weather +Message: usa.weather 2 from usa +Message: usa.weather 2 from weather +Message: usa.weather 3 from usa +Message: usa.weather 3 from weather +Message: usa.weather 4 from usa +Message: usa.weather 4 from weather +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control +Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in new file mode 100644 index 0000000000..d982a61a04 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in @@ -0,0 +1,12 @@ +==== client_dotnet.out | remove_uuid +Activating response queue listener for: clientSystem.Byte[] +Waiting for all responses to arrive ... +Response: TWAS BRILLIG, AND THE SLITHY TOVES +Response: DID GIRE AND GYMBLE IN THE WABE. +Response: ALL MIMSY WERE THE BOROGROVES, +Response: AND THE MOME RATHS OUTGRABE. +Shutting down listener for clientSystem.Byte[] +Response: THAT'S ALL, FOLKS! +==== server.py.out | remove_uuid +Request server running - run your client now. +(Times out after 100 seconds ...) -- cgit v1.2.1 From 0ff4ce941d519aaa9851ca0f9b45246fb72fc5fd Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Thu, 23 Oct 2008 14:38:56 +0000 Subject: Qpid-1392: Add SSL support git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@707381 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Client.cs | 37 +++- .../client/transport/network/io/IIoTransport.cs | 57 ++++++ .../client/transport/network/io/IoSSLTransport.cs | 194 +++++++++++++++++++++ .../client/transport/network/io/IoSender.cs | 5 +- .../client/transport/network/io/IoTransport.cs | 6 +- 5 files changed, 292 insertions(+), 7 deletions(-) create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index be279d5243..4871a1c3d9 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -52,7 +52,16 @@ namespace org.apache.qpid.client } #region Interface ClientInterface - + + /// + /// Establishes a connection with a broker using the provided user auths + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password 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, @@ -67,6 +76,32 @@ namespace org.apache.qpid.client negotiationComplete.WaitOne(); } + /// + /// Establishes a connection with a broker using SSL + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + /// Name of the SSL server + /// Path to the X509 certificate to be used for client authentication + /// If true connection will not be established if the broker is not trusted + 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() { diff --git a/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs b/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs new file mode 100644 index 0000000000..aab017dad1 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs @@ -0,0 +1,57 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +using System.IO; +using System.Net.Sockets; + +namespace org.apache.qpid.transport.network.io +{ + public interface IIoTransport + { + Connection Connection + { + get; + set; + } + + Receiver> 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/IoSSLTransport.cs b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs new file mode 100644 index 0000000000..8c5f161a35 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs @@ -0,0 +1,194 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +using System; +using System.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> 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> 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 810e0b8cf4..924d871dd2 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -18,7 +18,6 @@ */ using System; using System.IO; -using System.Net.Sockets; using System.Threading; using common.org.apache.qpid.transport.util; using org.apache.qpid.transport.util; @@ -28,14 +27,14 @@ namespace org.apache.qpid.transport.network.io public sealed class IoSender : IIOSender { private static readonly Logger log = Logger.get(typeof (IoReceiver)); - private readonly NetworkStream bufStream; + private readonly Stream bufStream; private bool closed; private readonly Mutex mutClosed = new Mutex(); private readonly CircularBuffer queue; private readonly Thread thread; private readonly int timeout; private readonly MemoryStream _tobeSent = new MemoryStream(); - public IoSender(IoTransport transport, int queueSize, int timeout) + public IoSender(IIoTransport transport, int queueSize, int timeout) { this.timeout = timeout; bufStream = transport.Stream; 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 f2ebab67c9..3a2397870d 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs @@ -31,7 +31,7 @@ namespace org.apache.qpid.transport.network.io /// SO_RCVBUF - qpid.readBufferSize /// SO_SNDBUF - qpid.writeBufferSize /// - public sealed class IoTransport + public sealed class IoTransport : IIoTransport { // constants private const int DEFAULT_READ_WRITE_BUFFER_SIZE = 64*1024; @@ -39,7 +39,7 @@ namespace org.apache.qpid.transport.network.io private const int QUEUE_SIZE = 1000; // props private static readonly Logger log = Logger.get(typeof (IoTransport)); - private NetworkStream m_stream; + private Stream m_stream; private IoSender m_sender; private Receiver> m_receiver; private TcpClient m_socket; @@ -92,7 +92,7 @@ namespace org.apache.qpid.transport.network.io } - public NetworkStream Stream + public Stream Stream { get { return m_stream; } set { m_stream = value; } -- cgit v1.2.1 From 79b34abf468ba9d190a24562e335f128df0e1d0e Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Wed, 12 Nov 2008 14:25:03 +0000 Subject: Qpid-1146: Added doc + samples git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@713378 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/Excel.exe.config | 2 + .../client-010/addins/ExcelAddIn/ExcelAddIn.cs | 3 +- .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 11 ++++- .../addins/ExcelAddIn/Properties/AssemblyInfo.cs | 8 +-- .../ExcelAddInMessageProcessor.csproj | 57 ++++++++++++++++++++++ .../addins/ExcelAddInMessageProcessor/Processor.cs | 44 +++++++++++++++++ .../Properties/AssemblyInfo.cs | 35 +++++++++++++ .../ExcelAddInProducer/ExcelAddInProducer.csproj | 1 + .../ExcelAddInProducer/Properties/AssemblyInfo.cs | 8 +-- qpid/dotnet/client-010/addins/README.txt | 29 +++++++++++ 10 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs create mode 100644 qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/client-010/addins/README.txt (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config index 0a49da465f..69e5bc36d6 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config @@ -6,5 +6,7 @@ + \ 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 baed00b03a..d77f3761a8 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs @@ -250,8 +250,7 @@ namespace ExcelAddIn byte[] body = new byte[m.Body.Length - m.Body.Position]; reader.Read(body, 0, body.Length); ASCIIEncoding enc = new ASCIIEncoding(); - res = enc.GetString(body); - res = res + " price: " + m.ApplicationHeaders["price"]; + res = enc.GetString(body); return res; } diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj index e6f1bd020b..048b0ab6ec 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -11,6 +11,11 @@ Qpid Excel AddIn + + + + + 2.0 true @@ -21,6 +26,7 @@ prompt 4 true + bin\Debug\Qpid Excel AddIn.XML pdbonly @@ -48,6 +54,9 @@ Client + + + + \ 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 new file mode 100644 index 0000000000..0b2d27519f --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs @@ -0,0 +1,44 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1279348645 --- /dev/null +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ExcelAddInMessageProcessor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("ExcelAddInMessageProcessor")] +[assembly: AssemblyCopyright("Copyright Apache Software Foundation 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d20b2d75-7b8b-4f7d-8a81-40a4cce94195")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj index 1d6863332a..d60a63451b 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -33,6 +33,7 @@ + diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs index 226709ca0b..f83025483c 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Qpid Excel AddIn Producer")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Built from svn revision number: ")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Apache Software Foundation")] [assembly: AssemblyProduct("Qpid Excel AddIn Producer")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] +[assembly: AssemblyCopyright("Apache Software Foundation")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/README.txt b/qpid/dotnet/client-010/addins/README.txt new file mode 100644 index 0000000000..486a708910 --- /dev/null +++ b/qpid/dotnet/client-010/addins/README.txt @@ -0,0 +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: + + +- 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 -- cgit v1.2.1 From 7d0e6db06c4d383416787fb2496cf96873b87af8 Mon Sep 17 00:00:00 2001 From: "Carl C. Trieloff" Date: Mon, 1 Dec 2008 16:46:54 +0000 Subject: Updated license files, readme, etc... Also made it possible to distribute client0-10 stand alone from a licencing stand point git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@722123 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/LICENSE.txt | 757 +++++++++++++++++++++++++++++++++++++ qpid/dotnet/client-010/NOTICE.txt | 32 ++ qpid/dotnet/client-010/README.txt | 5 +- 3 files changed, 793 insertions(+), 1 deletion(-) create mode 100644 qpid/dotnet/client-010/LICENSE.txt create mode 100644 qpid/dotnet/client-010/NOTICE.txt (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/LICENSE.txt b/qpid/dotnet/client-010/LICENSE.txt new file mode 100644 index 0000000000..981d2f83c3 --- /dev/null +++ b/qpid/dotnet/client-010/LICENSE.txt @@ -0,0 +1,757 @@ + + 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. + + +========================================================================= +== Saxon XSLT License == +========================================================================= + +Mozilla Public License Version 1.0 + +1. Definitions. + + 1.1. "Contributor" means each entity that creates or contributes + to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Code, prior Modifications used by a Contributor, and the + Modifications made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications + or the combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism + generally accepted in the software development community for the + electronic transfer of data. + + 1.5. "Executable" means Covered Code in any form other than + Source Code. + + 1.6. "Initial Developer" means the individual or entity + identified as the Initial Developer in the Source Code notice required by + Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code + or portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.9. "Modifications" means any addition to or deletion from + the substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original + Code or previous Modifications. + + 1.10. "Original Code" means Source Code of computer software + code which is described in the Source Code notice required by Exhibit + A as Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.11. "Source Code" means the preferred form of the Covered + Code for making modifications to it, including all modules it contains, + plus any associated interface definition files, scripts used to control + compilation and installation of an Executable, or a list of source code + differential comparisons against either the Original Code or another well + known, available Covered Code of the Contributor's choice. The Source + Code can be in a compressed or archival form, provided the appropriate + decompression or de-archiving software is widely available for no charge. + + 1.12. "You" means an individual or a legal entity exercising + rights under, and complying with all of the terms of, this License or a + future version of this License issued under Section 6.1. For legal + entities, "You" includes any entity which controls, is controlled by, + or is under common control with You. For purposes of this definition, + "control" means (a) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or otherwise, + or (b) ownership of fifty percent (50%) or more of the outstanding shares + or beneficial ownership of such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + + + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + + (a) to use, reproduce, modify, display, perform, sublicense + and distribute the Original Code (or portions thereof) with or + without Modifications, or as part of a Larger Work; and + + (b) under patents now or hereafter owned or controlled by + Initial Developer, to make, have made, use and sell ("Utilize") the + Original Code (or portions thereof), but solely to the extent that + any such patent is reasonably necessary to enable You to Utilize the + Original Code (or portions thereof) and not to any greater extent + that may be necessary to Utilize further Modifications or + combinations. + + 2.2. Contributor Grant. + + + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + + (a) to use, reproduce, modify, display, perform, sublicense and + distribute the Modifications created by such Contributor (or portions + thereof) either on an unmodified basis, with other Modifications, as + Covered Code or as part of a Larger Work; and + + (b) under patents now or hereafter owned or controlled by + Contributor, to Utilize the Contributor Version (or portions thereof), + but solely to the extent that any such patent is reasonably necessary to + enable You to Utilize the Contributor Version (or portions thereof), and + not to any greater extent that may be necessary to Utilize further + Modifications or combinations. + +3. Distribution Obligations. + + 3.1. Application of License. + + + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version of + this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this License + or the recipients' rights hereunder. However, You may include an + additional document offering the additional rights described in Section + 3.5. + + 3.2. Availability of Source Code. + + + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License either + on the same media as an Executable version or via an accepted Electronic + Distribution Mechanism to anyone to whom you made an Executable version + available; and if made available via Electronic Distribution Mechanism, + must remain available for at least twelve (12) months after the date it + initially became available, or at least six (6) months after a subsequent + version of that particular Modification has been made available to such + recipients. You are responsible for ensuring that the Source Code version + remains available even if the Electronic Distribution Mechanism is + maintained by a third party. + + 3.3. Description of Modifications. + + + You must cause all Covered Code to which you contribute to contain a + file documenting the changes You made to create that Covered Code and the + date of any change. You must include a prominent statement that the + Modification is derived, directly or indirectly, from Original Code + provided by the Initial Developer and including the name of the Initial + Developer in (a) the Source Code, and (b) in any notice in an Executable + version or related documentation in which You describe the origin or + ownership of the Covered Code. + + 3.4. Intellectual Property Matters + + (a) Third Party Claims. + + + If You have knowledge that a party claims an intellectual + property right in particular functionality or code (or its + utilization under this License), you must include a text file with + the source code distribution titled "LEGAL" which describes the + claim and the party making the claim in sufficient detail that a + recipient will know whom to contact. If you obtain such knowledge + after You make Your Modification available as described in Section + 3.2, You shall promptly modify the LEGAL file in all copies + You make available thereafter and shall take other steps (such as + notifying appropriate mailing lists or newsgroups) reasonably + calculated to inform those who received the Covered Code that new + knowledge has been obtained. + + (b) Contributor APIs. + + + If Your Modification is an application programming interface and + You own or control patents which are reasonably necessary to + implement that API, you must also include this information in the + LEGAL file. + + 3.5. Required Notices. + + + You must duplicate the notice in Exhibit A in each file of the + Source Code, and this License in any documentation for the Source Code, + where You describe recipients' rights relating to Covered Code. If You + created one or more Modification(s), You may add your name as a + Contributor to the notice described in Exhibit A. If it is not + possible to put such notice in a particular Source Code file due to its + structure, then you must include such notice in a location (such as a + relevant directory file) where a user would be likely to look for such a + notice. You may choose to offer, and to charge a fee for, warranty, + support, indemnity or liability obligations to one or more recipients of + Covered Code. However, You may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You must make it + absolutely clear than any such warranty, support, indemnity or liability + obligation is offered by You alone, and You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, support, + indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + + + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered + Code, and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, including + a description of how and where You have fulfilled the obligations of + Section 3.2. The notice must be conspicuously included in any + notice in an Executable version, related documentation or collateral in + which You describe recipients' rights relating to the Covered Code. You + may distribute the Executable version of Covered Code under a license of + Your choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License and + that the license for the Executable version does not attempt to limit or + alter the recipient's rights in the Source Code version from the rights + set forth in this License. If You distribute the Executable version under + a different license You must make it absolutely clear that any terms + which differ from this License are offered by You alone, not by the + Initial Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of any such terms You + offer. + + 3.7. Larger Works. + + + You may create a Larger Work by combining Covered Code with other + code not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to statute or + regulation then You must: (a) comply with the terms of this License to + the maximum extent possible; and (b) describe the limitations and the + code they affect. Such description must be included in the LEGAL file + described in Section 3.4 and must be included with all + distributions of the Source Code. Except to the extent prohibited by + statute or regulation, such description must be sufficiently detailed for + a recipient of ordinary skill + to be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached + the notice in Exhibit A, and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + + + Netscape Communications Corporation ("Netscape") may publish + revised and/or new versions of the License from time to time. Each + version will be given a distinguishing version number. + + 6.2. Effect of New Versions. + + + Once Covered Code has been published under a particular version of + the License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms of + any subsequent version of the License published by Netscape. No one other + than Netscape has the right to modify the terms applicable to Covered + Code created under this License. + + 6.3. Derivative Works. + + + If you create or use a modified version of this License (which you + may only do in order to apply it to code which is not already Covered + Code governed by this License), you must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "NPL" + or any confusingly similar phrase do not appear anywhere in your license + and (b) otherwise make it clear that your version of the license contains + terms which differ from the Mozilla Public License and Netscape Public + License. (Filling in the name of the Initial Developer, Original Code or + Contributor in the notice described in Exhibit A shall not of + themselves be deemed to be modifications of this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, + MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE + RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH + YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY + NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY + CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE + IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall survive + any termination of this License. Provisions which, by their nature, must + remain in effect beyond the termination of this License shall survive. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING + NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY + OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF + ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY + INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER + INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED + OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL + NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH + PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH + LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION + OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION + MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 + C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" + and "commercial computer software documentation," as such terms are + used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 + and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all + U.S. Government End Users acquire Covered Code with only those rights set + forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter + hereof. If any provision of this License is held to be unenforceable, + such provision shall be reformed only to the extent necessary to make it + enforceable. This License shall be governed by California law provisions + (except to the extent applicable law, if any, provides otherwise), + excluding its conflict-of-law provisions. With respect to disputes in + which at least one party is a citizen of, or an entity chartered or + registered to do business in, the United States of America: (a) unless + otherwise agreed in writing, all disputes relating to this License + (excepting any dispute relating to intellectual property rights) shall be + subject to final and binding arbitration, with the losing party paying + all costs of arbitration; (b) any arbitration relating to this Agreement + shall be held in Santa Clara County, California, under the auspices of + JAMS/EndDispute; and (c) any litigation relating to this Agreement shall + be subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys fees and + expenses. The application of the United Nations Convention on Contracts + for the International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall be + construed against the drafter shall not apply to this License. + +12. RESPONSIBILITY FOR CLAIMS. + + Except in cases where another Contributor has failed to comply with + Section 3.4, You are responsible for damages arising, directly or + indirectly, out of Your utilization of rights under this License, based + on the number of copies of Covered Code you made available, the revenues + you received from utilizing such rights, and other relevant factors. You + agree to work with affected parties to distribute responsibility on an + equitable basis. + +EXHIBIT A. + + "The contents of this file are subject to the Mozilla Public License + Version 1.0 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations under + the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is + ________________________. Portions created by ______________________ are + Copyright (C) ______ _______________________. All Rights Reserved. + + Contributor(s): ______________________________________." + + +========================================================================= +== Nunit License == +========================================================================= +Copyright (c) 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov +Copyright (c) 2000-2002 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 in the product documentation would be + appreciated but is not required. + + 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. + +========================================================================= +== Mentalis Security LibraryLicense == +========================================================================= + +Source Code License + +Copyright © 2002-2007, The Mentalis.org Team +All rights reserved. +http://www.mentalis.org/ + +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. + +- Neither the name of the Mentalis.org Team, 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. + +========================================================================= +== AMQP License == +========================================================================= + + Copyright Notice + ================ + (c) Copyright JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc., + iMatix Corporation, IONA\ufffd Technologies, Red Hat, Inc., + TWIST Process Innovations, and 29West Inc. 2006. All rights reserved. + + License + ======= + JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc., iMatix + Corporation, IONA\ufffd Technologies, Red Hat, Inc., TWIST Process Innovations, and + 29West Inc. (collectively, the "Authors") each hereby grants to you a worldwide, + perpetual, royalty-free, nontransferable, nonexclusive license to + (i) copy, display, and implement the Advanced Messaging Queue Protocol + ("AMQP") Specification and (ii) the Licensed Claims that are held by + the Authors, all for the purpose of implementing the Advanced Messaging + Queue Protocol Specification. Your license and any rights under this + Agreement will terminate immediately without notice from + any Author if you bring any claim, suit, demand, or action related to + the Advanced Messaging Queue Protocol Specification against any Author. + Upon termination, you shall destroy all copies of the Advanced Messaging + Queue Protocol Specification in your possession or control. + + As used hereunder, "Licensed Claims" means those claims of a patent or + patent application, throughout the world, excluding design patents and + design registrations, owned or controlled, or that can be sublicensed + without fee and in compliance with the requirements of this + Agreement, by an Author or its affiliates now or at any + future time and which would necessarily be infringed by implementation + of the Advanced Messaging Queue Protocol Specification. A claim is + necessarily infringed hereunder only when it is not possible to avoid + infringing it because there is no plausible non-infringing alternative + for implementing the required portions of the Advanced Messaging Queue + Protocol Specification. Notwithstanding the foregoing, Licensed Claims + shall not include any claims other than as set forth above even if + contained in the same patent as Licensed Claims; or that read solely + on any implementations of any portion of the Advanced Messaging Queue + Protocol Specification that are not required by the Advanced Messaging + Queue Protocol Specification, or that, if licensed, would require a + payment of royalties by the licensor to unaffiliated third parties. + Moreover, Licensed Claims shall not include (i) any enabling technologies + that may be necessary to make or use any Licensed Product but are not + themselves expressly set forth in the Advanced Messaging Queue Protocol + Specification (e.g., semiconductor manufacturing technology, compiler + technology, object oriented technology, networking technology, operating + system technology, and the like); or (ii) the implementation of other + published standards developed elsewhere and merely referred to in the + body of the Advanced Messaging Queue Protocol Specification, or + (iii) any Licensed Product and any combinations thereof the purpose or + function of which is not required for compliance with the Advanced + Messaging Queue Protocol Specification. For purposes of this definition, + the Advanced Messaging Queue Protocol Specification shall be deemed to + include both architectural and interconnection requirements essential + for interoperability and may also include supporting source code artifacts + where such architectural, interconnection requirements and source code + artifacts are expressly identified as being required or documentation to + achieve compliance with the Advanced Messaging Queue Protocol Specification. + + As used hereunder, "Licensed Products" means only those specific portions + of products (hardware, software or combinations thereof) that implement + and are compliant with all relevant portions of the Advanced Messaging + Queue Protocol Specification. + + The following disclaimers, which you hereby also acknowledge as to any + use you may make of the Advanced Messaging Queue Protocol Specification: + + THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION IS PROVIDED "AS IS," + AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE + CONTENTS OF THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION ARE + SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF THE ADVANCED + MESSAGING QUEUE PROTOCOL SPECIFICATION WILL NOT INFRINGE ANY THIRD PARTY + PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + + THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, + INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY + USE, IMPLEMENTATION OR DISTRIBUTION OF THE ADVANCED MESSAGING QUEUE + PROTOCOL SPECIFICATION. + + The name and trademarks of the Authors may NOT be used in any manner, + including advertising or publicity pertaining to the Advanced Messaging + Queue Protocol Specification or its contents without specific, written + prior permission. Title to copyright in the Advanced Messaging Queue + Protocol Specification will at all times remain with the Authors. + + No other rights are granted by implication, estoppel or otherwise. + + Upon termination of your license or rights under this Agreement, you + shall destroy all copies of the Advanced Messaging Queue Protocol + Specification in your possession or control. + + Trademarks + ========== + "JPMorgan", "JPMorgan Chase", "Chase", the JPMorgan Chase logo and the + Octagon Symbol are trademarks of JPMorgan Chase & Co. + + IMATIX and the iMatix logo are trademarks of iMatix Corporation sprl. + + IONA, IONA Technologies, and the IONA logos are trademarks of IONA + Technologies PLC and/or its subsidiaries. + + LINUX is a trademark of Linus Torvalds. RED HAT and JBOSS are registered + trademarks of Red Hat, Inc. in the US and other countries. + + Java, all Java-based trademarks and OpenOffice.org are trademarks of + Sun Microsystems, Inc. in the United States, other countries, or both. + + Other company, product, or service names may be trademarks or service + marks of others. + + Links to full AMQP specification: + ================================= + http://www.envoytech.org/spec/amq/ + http://www.iona.com/opensource/amqp/ + http://www.redhat.com/solutions/specifications/amqp/ + http://www.twiststandards.org/tiki-index.php?page=AMQ + http://www.imatix.com/amqp diff --git a/qpid/dotnet/client-010/NOTICE.txt b/qpid/dotnet/client-010/NOTICE.txt new file mode 100644 index 0000000000..0b22ed3ab2 --- /dev/null +++ b/qpid/dotnet/client-010/NOTICE.txt @@ -0,0 +1,32 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Ant distribution. == +========================================================================= + +Apache Qpid.NET +Copyright 2006 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + +This product also includes software developed by: + + - The SAXON XSLT Processor from Michael Kay distributed under the Mozilla + Public License v1.0, which is available for download at + http://saxon.sourceforge.net/ + + - The nunit library, Copyright © 2002 James W. Newkirk, Michael C. Two, + Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig. Available + under terms based on the zlib/libpng licence. Available from + http://www.nunit.org/ + + - The Mentalis Security Library, Copyright © 2002-2006, , The Mentalis.org Team + under tterms based on the BSD license (http://www.mentalis.org/site/license.qpx). + Available from http://www.mentalis.org/soft/projects/seclib/ + +This product includes software, Apache Log4Net +(http://logging.apache.org/log4net) +License: Apache 2.0 License (http://www.apache.org/licenses/LICENSE-2.0) + + diff --git a/qpid/dotnet/client-010/README.txt b/qpid/dotnet/client-010/README.txt index bffa156df5..54875f4356 100644 --- a/qpid/dotnet/client-010/README.txt +++ b/qpid/dotnet/client-010/README.txt @@ -1,7 +1,10 @@ Info ==== -AMQP version currently 0.10 +AMQP 0.10 Native .NET client supporting WCF and xcel + +This client is self contained, all dependancies are in this +directory. Setup -- cgit v1.2.1 From dbc70e44078a4841deee2223d0034c9a5ea3962f Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Wed, 10 Dec 2008 06:36:05 +0000 Subject: updated jython path git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@725007 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/build.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/build.xml b/qpid/dotnet/client-010/gentool/build.xml index 8d9622dcda..dc8e51acfb 100644 --- a/qpid/dotnet/client-010/gentool/build.xml +++ b/qpid/dotnet/client-010/gentool/build.xml @@ -37,13 +37,13 @@ - + - + -- cgit v1.2.1 From c582d9467083d47806454f71be04da345170aa6b Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Dec 2008 00:50:51 +0000 Subject: Fixed the license headers for the following files git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@727872 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 157 +- .../addins/ExcelAddIn/Properties/AssemblyInfo.cs | 91 +- .../ExcelAddInMessageProcessor.csproj | 135 +- .../Properties/AssemblyInfo.cs | 91 +- .../ExcelAddInProducer/ExcelAddInProducer.csproj | 129 +- .../ExcelAddInProducer/Properties/AssemblyInfo.cs | 87 +- qpid/dotnet/client-010/client/Client.csproj | 445 +- .../client-010/client/Properties/AssemblyInfo.cs | 91 +- .../client-010/client/client/ClientSession.cs | 199 +- .../client/transport/util/ResultFuture.cs | 139 +- qpid/dotnet/client-010/demo/Demo.csproj | 177 +- qpid/dotnet/client-010/demo/Program.cs | 213 +- .../client-010/demo/Properties/AssemblyInfo.cs | 87 +- .../demo/Properties/Resources.Designer.cs | 163 +- .../demo/Properties/Settings.Designer.cs | 81 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-direct-Listener.csproj | 127 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-direct-producer.csproj | 127 +- qpid/dotnet/client-010/examples/direct/verify | 24 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-fanout-Listener.csproj | 127 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-fanout-Producer.csproj | 127 +- qpid/dotnet/client-010/examples/fanout/verify | 21 + .../Properties/AssemblyInfo.cs | 87 +- .../example-pub-sub-Listener.csproj | 127 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-pub-sub-Publisher.csproj | 127 +- qpid/dotnet/client-010/examples/pub-sub/verify | 21 + .../Properties/AssemblyInfo.cs | 87 +- .../example-request-response-Client.csproj | 127 +- .../Properties/AssemblyInfo.cs | 87 +- .../example-request-response-Server.csproj | 127 +- .../client-010/examples/request-response/verify | 21 + qpid/dotnet/client-010/gentool/codegen | 23 +- qpid/dotnet/client-010/gentool/dotnetgenutil.py | 525 +- qpid/dotnet/client-010/lib/log4net/log4net.xml | 57331 ++++++++++--------- qpid/dotnet/client-010/log.xml | 72 +- qpid/dotnet/client-010/perftest/PerfTest.cs | 1389 +- .../client-010/perftest/Properties/AssemblyInfo.cs | 87 +- qpid/dotnet/client-010/perftest/perftest.csproj | 143 +- .../client-010/test/Properties/AssemblyInfo.cs | 91 +- qpid/dotnet/client-010/test/Test.csproj | 159 +- .../client-010/wcf/Properties/AssemblyInfo.cs | 93 +- .../wcf/demo/wcfBookingClient/Form1.Designer.cs | 349 +- .../client-010/wcf/demo/wcfBookingClient/Form1.cs | 169 +- .../wcf/demo/wcfBookingClient/Program.cs | 63 +- .../wcfBookingClient/Properties/AssemblyInfo.cs | 93 +- .../Properties/Resources.Designer.cs | 163 +- .../Properties/Settings.Designer.cs | 81 +- .../demo/wcfBookingClient/wcBookingClient.csproj | 227 +- .../wcfBookingServer/Properties/AssemblyInfo.cs | 93 +- .../demo/wcfBookingServer/wcfBookingServer.csproj | 175 +- .../demo/wcfHelloClient/Properties/AssemblyInfo.cs | 93 +- .../wcf/demo/wcfHelloClient/wcfHelloClient.csproj | 151 +- .../demo/wcfHelloServer/Properties/AssemblyInfo.cs | 93 +- .../wcf/demo/wcfHelloServer/wcfHelloServer.csproj | 167 +- .../wcf/demo/wcfRPC/Properties/AssemblyInfo.cs | 93 +- .../client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 167 +- qpid/dotnet/client-010/wcf/wcf.csproj | 159 +- 61 files changed, 33807 insertions(+), 32526 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj index 048b0ab6ec..6f44a998cb 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -1,68 +1,89 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {85EFD719-39F6-4471-90FF-9E621430344B} - Library - Properties - ExcelAddIn - Qpid Excel AddIn - - - - - - - 2.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - bin\Debug\Qpid Excel AddIn.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {85EFD719-39F6-4471-90FF-9E621430344B} + Library + Properties + ExcelAddIn + Qpid Excel AddIn + + + + + + + 2.0 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + bin\Debug\Qpid Excel AddIn.XML + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + + + + diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs index 4b52fb9a40..db5fa500bc 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs @@ -1,35 +1,56 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid Excel AddIn")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid Excel AddIn")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3bbd4414-60df-407f-9c64-c14b221167af")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Excel AddIn")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Excel AddIn")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3bbd4414-60df-407f-9c64-c14b221167af")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj index c9f8ac71ef..f29cb88c11 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj @@ -1,57 +1,78 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {C2AE83A3-D5D1-469D-8611-A4738B9997CF} - Library - Properties - ExcelAddInMessageProcessor - ExcelAddInMessageProcessor - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - {85EFD719-39F6-4471-90FF-9E621430344B} - ExcelAddIn - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {C2AE83A3-D5D1-469D-8611-A4738B9997CF} + Library + Properties + ExcelAddInMessageProcessor + ExcelAddInMessageProcessor + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + {85EFD719-39F6-4471-90FF-9E621430344B} + ExcelAddIn + + + + + diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs index 1279348645..f6bef8ac1d 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs @@ -1,35 +1,56 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ExcelAddInMessageProcessor")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("ExcelAddInMessageProcessor")] -[assembly: AssemblyCopyright("Copyright Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d20b2d75-7b8b-4f7d-8a81-40a4cce94195")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ExcelAddInMessageProcessor")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("ExcelAddInMessageProcessor")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d20b2d75-7b8b-4f7d-8a81-40a4cce94195")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj index d60a63451b..c0e4a03b90 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -1,54 +1,75 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {80F00C3B-EB38-4B3B-9F77-68977A30B155} - Exe - Properties - ExcelAddInProducer - Qpid Excel AddIn Producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {80F00C3B-EB38-4B3B-9F77-68977A30B155} + Exe + Properties + ExcelAddInProducer + Qpid Excel AddIn Producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs index f83025483c..edac96cfc4 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid Excel AddIn Producer")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid Excel AddIn Producer")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3416a5c2-eb70-4d77-b401-dfa659bd419e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Excel AddIn Producer")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Excel AddIn Producer")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3416a5c2-eb70-4d77-b401-dfa659bd419e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 38f1dac737..9e5e5bbe5a 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -1,212 +1,233 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {B911FFD7-754F-4735-A188-218D5065BE79} - Library - Properties - client - Qpid Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {B911FFD7-754F-4735-A188-218D5065BE79} + Library + Properties + client + Qpid Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs index 96a79040af..5ab0be9a99 100644 --- a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs @@ -1,35 +1,56 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid Client")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid Client")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("dac7ef42-e9c8-45a5-8050-1301b6f8160e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Client")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Client")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("dac7ef42-e9c8-45a5-8050-1301b6f8160e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/client/ClientSession.cs b/qpid/dotnet/client-010/client/client/ClientSession.cs index ccd906f854..2dbc27ecd9 100644 --- a/qpid/dotnet/client-010/client/client/ClientSession.cs +++ b/qpid/dotnet/client-010/client/client/ClientSession.cs @@ -1,89 +1,110 @@ - - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; - -namespace org.apache.qpid.client -{ - /// Implements a Qpid Sesion. - public class ClientSession : Session - { - public static short TRANSFER_ACQUIRE_MODE_NO_ACQUIRE = 1; - public static short TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE = 0; - public static short TRANSFER_CONFIRM_MODE_REQUIRED = 0; - public static short TRANSFER_CONFIRM_MODE_NOT_REQUIRED = 1; - public static short MESSAGE_FLOW_MODE_CREDIT = 0; - public static short MESSAGE_FLOW_MODE_WINDOW = 1; - public static short MESSAGE_FLOW_UNIT_MESSAGE = 0; - public static short MESSAGE_FLOW_UNIT_BYTE = 1; - public static long MESSAGE_FLOW_MAX_BYTES = 0xFFFFFFFF; - public static short MESSAGE_REJECT_CODE_GENERIC = 0; - public static short MESSAGE_REJECT_CODE_IMMEDIATE_DELIVERY_FAILED = 1; - public static short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0; - public static short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1; - - private Dictionary _listeners = new Dictionary(); - - public ClientSession(byte[] name) : base(name) - { - } - - public void attachMessageListener(IMessageListener listener, string Destination) - { - _listeners.Add(Destination, listener); - } - - public Dictionary MessageListeners - { - get { return _listeners; } - } - - public void messageTransfer(String destination, string routingkey, IMessage message) - { - message.DeliveryProperties.setRoutingKey(routingkey); - messageTransfer(destination, message); - } - - public void messageTransfer(String destination, IMessage message) - { - byte[] body = new byte[message.Body.Position]; - message.Body.Seek(0, SeekOrigin.Begin); - message.Body.Read(body, 0, body.Length); - message.MessageProperties.setMessageId(UUID.randomUUID()); - messageTransfer(destination, - MessageAcceptMode.NONE, - MessageAcquireMode.PRE_ACQUIRED, - message.Header, - body); - } - - public void queueDeclare(String queue) - { - queueDeclare(queue, null, null); - } - - public void queueDeclare(String queue, params Option[] options) - { - queueDeclare(queue, null, null, options); - } - - public void exchangeBind(String queue, String exchange, String bindingKey) - { - exchangeBind(queue, exchange, bindingKey, null); - } - - public void messageSubscribe(String queue) - { - messageSubscribe(queue, queue, MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); - // issue credits - messageSetFlowMode(queue, MessageFlowMode.WINDOW); - messageFlow(queue, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - messageFlow(queue, MessageCreditUnit.MESSAGE, 10000); - } - - } -} \ No newline at end of file +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.client +{ + /// Implements a Qpid Sesion. + public class ClientSession : Session + { + public static short TRANSFER_ACQUIRE_MODE_NO_ACQUIRE = 1; + public static short TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE = 0; + public static short TRANSFER_CONFIRM_MODE_REQUIRED = 0; + public static short TRANSFER_CONFIRM_MODE_NOT_REQUIRED = 1; + public static short MESSAGE_FLOW_MODE_CREDIT = 0; + public static short MESSAGE_FLOW_MODE_WINDOW = 1; + public static short MESSAGE_FLOW_UNIT_MESSAGE = 0; + public static short MESSAGE_FLOW_UNIT_BYTE = 1; + public static long MESSAGE_FLOW_MAX_BYTES = 0xFFFFFFFF; + public static short MESSAGE_REJECT_CODE_GENERIC = 0; + public static short MESSAGE_REJECT_CODE_IMMEDIATE_DELIVERY_FAILED = 1; + public static short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0; + public static short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1; + + private Dictionary _listeners = new Dictionary(); + + public ClientSession(byte[] name) : base(name) + { + } + + public void attachMessageListener(IMessageListener listener, string Destination) + { + _listeners.Add(Destination, listener); + } + + public Dictionary MessageListeners + { + get { return _listeners; } + } + + public void messageTransfer(String destination, string routingkey, IMessage message) + { + message.DeliveryProperties.setRoutingKey(routingkey); + messageTransfer(destination, message); + } + + public void messageTransfer(String destination, IMessage message) + { + byte[] body = new byte[message.Body.Position]; + message.Body.Seek(0, SeekOrigin.Begin); + message.Body.Read(body, 0, body.Length); + message.MessageProperties.setMessageId(UUID.randomUUID()); + messageTransfer(destination, + MessageAcceptMode.NONE, + MessageAcquireMode.PRE_ACQUIRED, + message.Header, + body); + } + + public void queueDeclare(String queue) + { + queueDeclare(queue, null, null); + } + + public void queueDeclare(String queue, params Option[] options) + { + queueDeclare(queue, null, null, options); + } + + public void exchangeBind(String queue, String exchange, String bindingKey) + { + exchangeBind(queue, exchange, bindingKey, null); + } + + public void messageSubscribe(String queue) + { + messageSubscribe(queue, queue, MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + messageSetFlowMode(queue, MessageFlowMode.WINDOW); + messageFlow(queue, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + messageFlow(queue, MessageCreditUnit.MESSAGE, 10000); + } + + } +} diff --git a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs index d3e12d4ca4..5b31c9d71a 100644 --- a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -1,59 +1,80 @@ -using System; -using System.Threading; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; - -namespace common.org.apache.qpid.transport.util -{ - public class ResultFuture : Future - { - const long _timeout = 60000; - private Struct _result; - private Session _session; - private static readonly Logger log = Logger.get(typeof(ResultFuture)); - - public Struct get(long timeout) - { - lock (this) - { - DateTime start = DateTime.Now; - long elapsed = 0; - while (! _session.Closed && timeout - elapsed > 0 && _result == null) - { - log.debug("{0} waiting for result: {1}", _session, this ); - Monitor.Wait(this, (int) (timeout - elapsed)); - elapsed = (long) (DateTime.Now.Subtract(start)).TotalMilliseconds; - } - } - if( _session.Closed ) - { - throw new SessionException(_session.getExceptions()); - } - return _result; - } - - public Struct Result - { - get { return get(_timeout); } - set - { - lock (this) - { - _result = value; - Monitor.PulseAll(this); - } - } - } - - public Session Session - { - set { _session = value; } - } - - public String toString() - { - return String.Format("Future({0})", _result); - } - - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace common.org.apache.qpid.transport.util +{ + public class ResultFuture : Future + { + const long _timeout = 60000; + private Struct _result; + private Session _session; + private static readonly Logger log = Logger.get(typeof(ResultFuture)); + + public Struct get(long timeout) + { + lock (this) + { + DateTime start = DateTime.Now; + long elapsed = 0; + while (! _session.Closed && timeout - elapsed > 0 && _result == null) + { + log.debug("{0} waiting for result: {1}", _session, this ); + Monitor.Wait(this, (int) (timeout - elapsed)); + elapsed = (long) (DateTime.Now.Subtract(start)).TotalMilliseconds; + } + } + if( _session.Closed ) + { + throw new SessionException(_session.getExceptions()); + } + return _result; + } + + public Struct Result + { + get { return get(_timeout); } + set + { + lock (this) + { + _result = value; + Monitor.PulseAll(this); + } + } + } + + public Session Session + { + set { _session = value; } + } + + public String toString() + { + return String.Format("Future({0})", _result); + } + + } +} diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index 13dacc01be..67e687008f 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -1,78 +1,99 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E4C46FBC-7560-406D-BFEF-CA010E584DF4} - WinExe - Properties - demo - Qpid Demo - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {E4C46FBC-7560-406D-BFEF-CA010E584DF4} + WinExe + Properties + demo + Qpid Demo + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/demo/Program.cs b/qpid/dotnet/client-010/demo/Program.cs index 4affadb9df..6ed0f5c393 100644 --- a/qpid/dotnet/client-010/demo/Program.cs +++ b/qpid/dotnet/client-010/demo/Program.cs @@ -1,96 +1,117 @@ -using System; -using System.IO; -using System.Text; -using System.Threading; -using log4net.Config; -using org.apache.qpid.client; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; - -namespace WindowsClient -{ - class Program - { - static void Main(string[] args) - { - XmlConfigurator.Configure(new FileInfo("..\\..\\log.xml")); - // DOMConfigurator.Configure() - Client client = new Client(); - Console.WriteLine("Client created"); - client.connect("192.168.1.14", 5673, "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); - - - Object wl = new Object(); - ssn.attachMessageListener(new MyListener(ssn, wl), "myDest"); - - ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, - 0, null); - DateTime start = DateTime.Now; - - // 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 < 10000; 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)); - } - - lock(wl) - { - Monitor.Wait(wl); - } - DateTime now = DateTime.Now; - Console.WriteLine("Start time " + start + " now: " + now); - - Console.WriteLine("Done time: " + (now - start)); - lock (wl) - { - Monitor.Wait(wl, 30000); - } - client.close(); - } - } - - class MyListener : IMessageListener - { - private readonly Object _wl; - private ClientSession _session; - private int _count; - - public MyListener(ClientSession session, object wl) - { - _wl = wl; - _session = session; - _count = 0; - } - - 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(); - // Console.WriteLine("Got a message: " + enc.GetString(body) + " count = " + _count); - _count++; - if (_count == 10000) - { - lock (_wl) - { - Monitor.PulseAll(_wl); - } - } - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 log4net.Config; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; + +namespace WindowsClient +{ + class Program + { + static void Main(string[] args) + { + XmlConfigurator.Configure(new FileInfo("..\\..\\log.xml")); + // DOMConfigurator.Configure() + Client client = new Client(); + Console.WriteLine("Client created"); + client.connect("192.168.1.14", 5673, "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); + + + Object wl = new Object(); + ssn.attachMessageListener(new MyListener(ssn, wl), "myDest"); + + ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, + 0, null); + DateTime start = DateTime.Now; + + // 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 < 10000; 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)); + } + + lock(wl) + { + Monitor.Wait(wl); + } + DateTime now = DateTime.Now; + Console.WriteLine("Start time " + start + " now: " + now); + + Console.WriteLine("Done time: " + (now - start)); + lock (wl) + { + Monitor.Wait(wl, 30000); + } + client.close(); + } + } + + class MyListener : IMessageListener + { + private readonly Object _wl; + private ClientSession _session; + private int _count; + + public MyListener(ClientSession session, object wl) + { + _wl = wl; + _session = session; + _count = 0; + } + + 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(); + // Console.WriteLine("Got a message: " + enc.GetString(body) + " count = " + _count); + _count++; + if (_count == 10000) + { + lock (_wl) + { + Monitor.PulseAll(_wl); + } + } + } + } +} diff --git a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs index eab12ce3c7..5b993bb917 100644 --- a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid Demo")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid Demo")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("434bc34e-b59b-4800-87cf-c2d301cb5082")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Demo")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Demo")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("434bc34e-b59b-4800-87cf-c2d301cb5082")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs index 465e39cd65..d635c93dd4 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs @@ -1,71 +1,92 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = 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. + * + */ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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/Settings.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs index 7dcd2aa03b..e5d5c38547 100644 --- a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs @@ -1,30 +1,51 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.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; - } - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.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/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs index 07db227255..cfcafd19a2 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-direct-Listener")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-direct-Listener")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6a24bfe4-4714-4d2a-acf4-96cf9a678a06")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-direct-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-direct-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6a24bfe4-4714-4d2a-acf4-96cf9a678a06")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 17675cb479..22eed4c79b 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} - Exe - Properties - example_direct_Listener - example-direct-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} + Exe + Properties + example_direct_Listener + example-direct-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs index e72701e44b..3ca7a80095 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-direct-producer")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-direct-producer")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("006144c2-5e45-4543-8e16-c09cd4309ed7")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-direct-producer")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-direct-producer")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("006144c2-5e45-4543-8e16-c09cd4309ed7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 deafad1728..25f8491394 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {96FCB250-8142-40EE-9BDD-CA839EE21021} - Exe - Properties - example_direct_producer - example-direct-producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {96FCB250-8142-40EE-9BDD-CA839EE21021} + Exe + Properties + example_direct_producer + example-direct-producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/direct/verify b/qpid/dotnet/client-010/examples/direct/verify index cd53687176..7da08480a2 100644 --- a/qpid/dotnet/client-010/examples/direct/verify +++ b/qpid/dotnet/client-010/examples/direct/verify @@ -1,3 +1,25 @@ +# +## +## Licensed to the Apache Software Foundation (ASF) under one +## or more contributor license agreements. See the NOTICE file +## distributed with this work for additional information +## regarding copyright ownership. The ASF licenses this file +## to you under the Apache License, Version 2.0 (the +## "License"); you may not use this file except in compliance +## with the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, +## software distributed under the License is distributed on an +## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +## KIND, either express or implied. See the License for the +## specific language governing permissions and limitations +## under the License. +## +## +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/direct @@ -12,4 +34,4 @@ mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 } clients $cpp/declare_queues direct_producer_dotnet direct_listener_dotnet -outputs $cpp/declare_queues.out ./direct_producer_dotnet.out ./direct_listener_dotnet.out \ No newline at end of file +outputs $cpp/declare_queues.out ./direct_producer_dotnet.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs index 9e8adf557f..6454ae44db 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-fanout-Listener")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-fanout-Listener")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("68686ef9-aa0a-4334-9c52-d7e6fc507bec")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-fanout-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-fanout-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("68686ef9-aa0a-4334-9c52-d7e6fc507bec")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 27b785e081..d03f0170f3 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} - Exe - Properties - example_fanout_Listener - example-fanout-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} + Exe + Properties + example_fanout_Listener + example-fanout-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs index d35f3522d2..3054ba09db 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-fanout-Producer")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-fanout-Producer")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("01c0ba10-2f23-409b-9adc-bc514a13131a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-fanout-Producer")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-fanout-Producer")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("01c0ba10-2f23-409b-9adc-bc514a13131a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 ebafee7f1a..bf5811fbcd 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {4513BF94-D54A-42FE-8506-FE2CD57B2C51} - Exe - Properties - example_fanout_Producer - example-fanout-Producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {4513BF94-D54A-42FE-8506-FE2CD57B2C51} + Exe + Properties + example_fanout_Producer + example-fanout-Producer + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/fanout/verify b/qpid/dotnet/client-010/examples/fanout/verify index b53d440895..51b7327243 100644 --- a/qpid/dotnet/client-010/examples/fanout/verify +++ b/qpid/dotnet/client-010/examples/fanout/verify @@ -1,3 +1,24 @@ +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify fanout_listener_dotnet() diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs index f6ff3a3c82..6a1f505206 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-pub-sub-Listener")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-pub-sub-Listener")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("74ab02ae-95d1-4bad-a7cf-9964005b9b05")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-pub-sub-Listener")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-pub-sub-Listener")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("74ab02ae-95d1-4bad-a7cf-9964005b9b05")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 df58bfa6c4..ee1a22fc25 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} - Exe - Properties - example_pub_sub_Listener - example-pub-sub-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} + Exe + Properties + example_pub_sub_Listener + example-pub-sub-Listener + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs index 209db5d17e..fbbe6f04fc 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-pub-sub-Publisher")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-pub-sub-Publisher")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f6d282a0-9dc5-46cf-a4cd-44ae402d667f")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-pub-sub-Publisher")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-pub-sub-Publisher")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f6d282a0-9dc5-46cf-a4cd-44ae402d667f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 ecdf2a5d44..4068ac094e 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {F8857634-A134-44E7-A953-F2B22688C599} - Exe - Properties - example_pub_sub_Publisher - example-pub-sub-Publisher - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {F8857634-A134-44E7-A953-F2B22688C599} + Exe + Properties + example_pub_sub_Publisher + example-pub-sub-Publisher + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify b/qpid/dotnet/client-010/examples/pub-sub/verify index 8e4e7516ab..45d80c4866 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/verify +++ b/qpid/dotnet/client-010/examples/pub-sub/verify @@ -1,3 +1,24 @@ +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify pubsub_listener_dotnet() diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs index d1ac2473de..59c9f10f62 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-request-response-Client")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-request-response-Client")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("08bf6aed-bf79-4d16-9a28-6363d5322cdd")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-request-response-Client")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-request-response-Client")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("08bf6aed-bf79-4d16-9a28-6363d5322cdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 2d32dd6b66..2787aa4b6a 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1BC63815-4029-4039-9207-35E7E06ECC99} - Exe - Properties - example_request_response_Client - example-request-response-Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {1BC63815-4029-4039-9207-35E7E06ECC99} + Exe + Properties + example_request_response_Client + example-request-response-Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs index ae96a64eb0..468cdf557a 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("example-request-response-Server")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("example-request-response-Server")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ef3456e2-7c19-47aa-8dd6-aeaa88c5c4ad")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("example-request-response-Server")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("example-request-response-Server")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ef3456e2-7c19-47aa-8dd6-aeaa88c5c4ad")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] 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 080b2458b8..f35555aed8 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,53 +1,74 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {922FBA9C-E483-4AEF-ABE8-AC87421E829B} - Exe - Properties - example_request_response_Server - example-request-response-Server - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {922FBA9C-E483-4AEF-ABE8-AC87421E829B} + Exe + Properties + example_request_response_Server + example-request-response-Server + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/examples/request-response/verify b/qpid/dotnet/client-010/examples/request-response/verify index 1ee4f25c18..fa69461f68 100644 --- a/qpid/dotnet/client-010/examples/request-response/verify +++ b/qpid/dotnet/client-010/examples/request-response/verify @@ -1,3 +1,24 @@ +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify server_dotnet() diff --git a/qpid/dotnet/client-010/gentool/codegen b/qpid/dotnet/client-010/gentool/codegen index 7a1476b75e..8a3a6de7ee 100644 --- a/qpid/dotnet/client-010/gentool/codegen +++ b/qpid/dotnet/client-010/gentool/codegen @@ -1,4 +1,25 @@ #!/usr/bin/env python +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + import os, sys, mllib from templating import Parser @@ -61,4 +82,4 @@ enums = spec.query["amqp/domain", is_enum] + \ for e in enums: name = cname(e) - execute("%s.cs" % name, "Enum.tpl", name = name, type = e) \ No newline at end of file + execute("%s.cs" % name, "Enum.tpl", name = name, type = e) diff --git a/qpid/dotnet/client-010/gentool/dotnetgenutil.py b/qpid/dotnet/client-010/gentool/dotnetgenutil.py index 0bfea4a0ba..a071ad3bde 100644 --- a/qpid/dotnet/client-010/gentool/dotnetgenutil.py +++ b/qpid/dotnet/client-010/gentool/dotnetgenutil.py @@ -1,252 +1,273 @@ - -def camel(offset, *args): - parts = [] - for a in args: - parts.extend(a.split("-")) - return "".join(parts[:offset] + [p[0].upper() + p[1:] for p in parts[offset:]]) - -def dromedary(s): - return s[0].lower() + s[1:] - -def scream(*args): - return "_".join([a.replace("-", "_").upper() for a in args]) - -def num(x, default=None): - if x is not None and x != "": - return int(x, 0) - else: - return default - -def klass(nd): - parent = nd.parent - while parent is not None: - if hasattr(parent, "name") and parent.name == "class": - return parent - parent = parent.parent - -untyped = -1 - -def code(nd): - global untyped - cd = num(nd["@code"]) - if cd is None: - cd = untyped - untyped -= 1 - return cd - - cls = klass(nd) - if cls: - cd |= (num(cls["@code"]) << 8) - return cd - -def root(nd): - if nd.parent is None: - return nd - else: - return root(nd.parent) - -def qname(nd): - name = nd["@name"] - cls = klass(nd) - if cls != None: - return "%s.%s" % (cls["@name"], name) - else: - return name - -RESOLVED = {} - -def resolve(node, name): - key = (node, name) - if RESOLVED.has_key(key): - return RESOLVED[key] - else: - spec = root(node) - cls = klass(node) - if cls: - for nd in cls.query["#tag"]: - if nd["@name"] == name: - RESOLVED[key] = nd - return nd - for nd in spec.query["amqp/#tag"] + spec.query["amqp/class/#tag"]: - if name == qname(nd): - RESOLVED[key] = nd - return nd - raise Exception("unresolved name: %s" % name) - -def resolve_type(nd): - if hasattr(nd, "_resolved_type"): - return nd._resolved_type - else: - name = nd["@type"] - type = resolve(nd, name) - if type.name == "domain" and not type["enum"]: - type = resolve_type(type) - nd._resolved_type = type - return type - -TYPES = { - "bit": "bool", - "uint8": "short", - "uint16": "int", - "uint32": "long", - "uint64": "long", - "datetime": "long", - "uuid": "UUID", - "sequence-no": "int", - "sequence-set": "RangeSet", # XXX - "byte-ranges": "RangeSet", # XXX - "str8": "String", - "str16": "String", - "vbin8": "byte[]", - "vbin16": "byte[]", - "vbin32": "byte[]", - "struct32": "Struct", - "map": "Dictionary", - "array": "List" - } - -def cname(nd, field="@name"): - cls = klass(nd) - if cls: - if (nd.name in ("struct", "result") and - cls["@name"] != "session" and - nd[field] != "header"): - return camel(0, nd[field]) - else: - return camel(0, cls["@name"], nd[field]) - else: - return camel(0, nd[field]) - -def jtype(nd): - if nd.name == "struct" or nd["enum"]: - return cname(nd) - else: - return TYPES[nd["@name"]] - -REFS = { - "bool": "Boolean", - "byte": "Byte", - "short": "Short", - "int": "Integer", - "long": "Long", - "float": "Float", - "double": "Double", - "char": "Character" -} - -def jref(jt): - return REFS.get(jt, jt) - -def jclass(jt): - idx = jt.find('<') - if idx > 0: - return jt[:idx] - else: - return jt - -DEFAULTS = { - "long": 0, - "int": 0, - "short": 0, - "byte": 0, - "char": 0, - "bool": "false" - } - -class Field: - - def __init__(self, index, nd): - self.index = index - self.name = camel(1, nd["@name"]) - self.type_node = resolve_type(nd) - if self.type_node.name == "domain": - self.prim_type = resolve_type(self.type_node) - else: - self.prim_type = self.type_node - self.variable_width = num(self.prim_type["@variable-width"], 0) - self.fixed_width = num(self.prim_type["@fixed-width"], 0) - self.empty = self.variable_width == 0 and self.fixed_width == 0 and self.prim_type.name != "struct" - tname = cname(self.type_node) - if self.type_node.name == "struct": - self.read = "(%s) dec.readStruct(%s.TYPE)" % (tname, tname) - self.write = "enc.writeStruct(%s.TYPE, check(struct).%s)" % (tname, self.name) - self.coder = "Struct" - elif self.type_node.name == "domain": - self.coder = camel(0, self.prim_type["@name"]) - self.read = "%s.get(dec.read%s())" % (tname, self.coder) - self.write = "enc.write%s(check(struct).%s.getValue())" % (self.coder, self.name) - else: - self.coder = camel(0, self.type_node["@name"]) - self.read = "dec.read%s()" % self.coder - self.write = "enc.write%s(check(struct).%s)" % (self.coder, self.name) - self.type = jtype(self.type_node) - self.default = DEFAULTS.get(self.type, "null") - self.has = camel(1, "has", self.name) - self.get = camel(1, "get", self.name) - self.set = camel(1, "set", self.name) - self.clear = camel(1, "clear", self.name) - if self.type == "bool": - self.option = scream(nd["@name"]) - else: - self.option = None - - def flag_mask(self, pack): - flag = pack * 8 - 8 - (self.index/8)*8 + (self.index % 8) - return 1 << flag - - -def get_fields(nd): - fields = [] - index = 0 - for f in nd.query["field"]: - fields.append(Field(index, f)) - index += 1 - return fields - -def get_parameters(type, fields): - params = [] - options = False - for f in fields: - if f.option: - options = True - else: - params.append("%s %s" % (f.type, f.name)) - if type["segments"]: - params.append("Header header") - params.append("MemoryStream body") - if options or type.name in ("control", "command"): - params.append("Option ... _options") - return params - -def get_arguments(type, fields): - args = [] - options = False - for f in fields: - if f.option: - options = True - else: - args.append(f.name) - if type["segments"]: - args.append("header") - args.append("body") - if options or type.name in ("control", "command"): - args.append("_options") - return args - -def get_options(fields): - return [f for f in fields if f.option] - -def get_dotnetparameters(type, fields): - params = [] - options = False - for f in fields: - if f.option: - options = True - else: - params.append("%s %s" % (f.type, f.name)) - if type["segments"]: - params.append("Header header") - params.append("MemoryStream body") - if options or type.name in ("control", "command"): - params.append("params Option[] _options") - return params \ No newline at end of file +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + + +def camel(offset, *args): + parts = [] + for a in args: + parts.extend(a.split("-")) + return "".join(parts[:offset] + [p[0].upper() + p[1:] for p in parts[offset:]]) + +def dromedary(s): + return s[0].lower() + s[1:] + +def scream(*args): + return "_".join([a.replace("-", "_").upper() for a in args]) + +def num(x, default=None): + if x is not None and x != "": + return int(x, 0) + else: + return default + +def klass(nd): + parent = nd.parent + while parent is not None: + if hasattr(parent, "name") and parent.name == "class": + return parent + parent = parent.parent + +untyped = -1 + +def code(nd): + global untyped + cd = num(nd["@code"]) + if cd is None: + cd = untyped + untyped -= 1 + return cd + + cls = klass(nd) + if cls: + cd |= (num(cls["@code"]) << 8) + return cd + +def root(nd): + if nd.parent is None: + return nd + else: + return root(nd.parent) + +def qname(nd): + name = nd["@name"] + cls = klass(nd) + if cls != None: + return "%s.%s" % (cls["@name"], name) + else: + return name + +RESOLVED = {} + +def resolve(node, name): + key = (node, name) + if RESOLVED.has_key(key): + return RESOLVED[key] + else: + spec = root(node) + cls = klass(node) + if cls: + for nd in cls.query["#tag"]: + if nd["@name"] == name: + RESOLVED[key] = nd + return nd + for nd in spec.query["amqp/#tag"] + spec.query["amqp/class/#tag"]: + if name == qname(nd): + RESOLVED[key] = nd + return nd + raise Exception("unresolved name: %s" % name) + +def resolve_type(nd): + if hasattr(nd, "_resolved_type"): + return nd._resolved_type + else: + name = nd["@type"] + type = resolve(nd, name) + if type.name == "domain" and not type["enum"]: + type = resolve_type(type) + nd._resolved_type = type + return type + +TYPES = { + "bit": "bool", + "uint8": "short", + "uint16": "int", + "uint32": "long", + "uint64": "long", + "datetime": "long", + "uuid": "UUID", + "sequence-no": "int", + "sequence-set": "RangeSet", # XXX + "byte-ranges": "RangeSet", # XXX + "str8": "String", + "str16": "String", + "vbin8": "byte[]", + "vbin16": "byte[]", + "vbin32": "byte[]", + "struct32": "Struct", + "map": "Dictionary", + "array": "List" + } + +def cname(nd, field="@name"): + cls = klass(nd) + if cls: + if (nd.name in ("struct", "result") and + cls["@name"] != "session" and + nd[field] != "header"): + return camel(0, nd[field]) + else: + return camel(0, cls["@name"], nd[field]) + else: + return camel(0, nd[field]) + +def jtype(nd): + if nd.name == "struct" or nd["enum"]: + return cname(nd) + else: + return TYPES[nd["@name"]] + +REFS = { + "bool": "Boolean", + "byte": "Byte", + "short": "Short", + "int": "Integer", + "long": "Long", + "float": "Float", + "double": "Double", + "char": "Character" +} + +def jref(jt): + return REFS.get(jt, jt) + +def jclass(jt): + idx = jt.find('<') + if idx > 0: + return jt[:idx] + else: + return jt + +DEFAULTS = { + "long": 0, + "int": 0, + "short": 0, + "byte": 0, + "char": 0, + "bool": "false" + } + +class Field: + + def __init__(self, index, nd): + self.index = index + self.name = camel(1, nd["@name"]) + self.type_node = resolve_type(nd) + if self.type_node.name == "domain": + self.prim_type = resolve_type(self.type_node) + else: + self.prim_type = self.type_node + self.variable_width = num(self.prim_type["@variable-width"], 0) + self.fixed_width = num(self.prim_type["@fixed-width"], 0) + self.empty = self.variable_width == 0 and self.fixed_width == 0 and self.prim_type.name != "struct" + tname = cname(self.type_node) + if self.type_node.name == "struct": + self.read = "(%s) dec.readStruct(%s.TYPE)" % (tname, tname) + self.write = "enc.writeStruct(%s.TYPE, check(struct).%s)" % (tname, self.name) + self.coder = "Struct" + elif self.type_node.name == "domain": + self.coder = camel(0, self.prim_type["@name"]) + self.read = "%s.get(dec.read%s())" % (tname, self.coder) + self.write = "enc.write%s(check(struct).%s.getValue())" % (self.coder, self.name) + else: + self.coder = camel(0, self.type_node["@name"]) + self.read = "dec.read%s()" % self.coder + self.write = "enc.write%s(check(struct).%s)" % (self.coder, self.name) + self.type = jtype(self.type_node) + self.default = DEFAULTS.get(self.type, "null") + self.has = camel(1, "has", self.name) + self.get = camel(1, "get", self.name) + self.set = camel(1, "set", self.name) + self.clear = camel(1, "clear", self.name) + if self.type == "bool": + self.option = scream(nd["@name"]) + else: + self.option = None + + def flag_mask(self, pack): + flag = pack * 8 - 8 - (self.index/8)*8 + (self.index % 8) + return 1 << flag + + +def get_fields(nd): + fields = [] + index = 0 + for f in nd.query["field"]: + fields.append(Field(index, f)) + index += 1 + return fields + +def get_parameters(type, fields): + params = [] + options = False + for f in fields: + if f.option: + options = True + else: + params.append("%s %s" % (f.type, f.name)) + if type["segments"]: + params.append("Header header") + params.append("MemoryStream body") + if options or type.name in ("control", "command"): + params.append("Option ... _options") + return params + +def get_arguments(type, fields): + args = [] + options = False + for f in fields: + if f.option: + options = True + else: + args.append(f.name) + if type["segments"]: + args.append("header") + args.append("body") + if options or type.name in ("control", "command"): + args.append("_options") + return args + +def get_options(fields): + return [f for f in fields if f.option] + +def get_dotnetparameters(type, fields): + params = [] + options = False + for f in fields: + if f.option: + options = True + else: + params.append("%s %s" % (f.type, f.name)) + if type["segments"]: + params.append("Header header") + params.append("MemoryStream body") + if options or type.name in ("control", "command"): + params.append("params Option[] _options") + return params diff --git a/qpid/dotnet/client-010/lib/log4net/log4net.xml b/qpid/dotnet/client-010/lib/log4net/log4net.xml index f20322f340..5beb669ab0 100644 --- a/qpid/dotnet/client-010/lib/log4net/log4net.xml +++ b/qpid/dotnet/client-010/lib/log4net/log4net.xml @@ -1,28655 +1,28676 @@ - - - - log4net - - - - - Appender that logs to a database. - - - - appends logging events to a table within a - database. The appender can be configured to specify the connection - string by setting the property. - The connection type (provider) can be specified by setting the - property. For more information on database connection strings for - your specific database see http://www.connectionstrings.com/. - - - Records are written into the database either using a prepared - statement or a stored procedure. The property - is set to (System.Data.CommandType.Text) to specify a prepared statement - or to (System.Data.CommandType.StoredProcedure) to specify a stored - procedure. - - - The prepared statement text or the name of the stored procedure - must be set in the property. - - - The prepared statement or stored procedure can take a number - of parameters. Parameters are added using the - method. This adds a single to the - ordered list of parameters. The - type may be subclassed if required to provide database specific - functionality. The specifies - the parameter name, database type, size, and how the value should - be generated using a . - - - - An example of a SQL Server table that could be logged to: - - CREATE TABLE [dbo].[Log] ( - [ID] [int] IDENTITY (1, 1) NOT NULL , - [Date] [datetime] NOT NULL , - [Thread] [varchar] (255) NOT NULL , - [Level] [varchar] (20) NOT NULL , - [Logger] [varchar] (255) NOT NULL , - [Message] [varchar] (4000) NOT NULL - ) ON [PRIMARY] - - - - An example configuration to log to the above table: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Julian Biddle - Nicko Cadell - Gert Driesen - Lance Nehring - - - - Abstract base class implementation of that - buffers events in a fixed size buffer. - - - - This base class should be used by appenders that need to buffer a - number of events before logging them. For example the - buffers events and then submits the entire contents of the buffer to - the underlying database in one go. - - - Subclasses should override the - method to deliver the buffered events. - - The BufferingAppenderSkeleton maintains a fixed size cyclic - buffer of events. The size of the buffer is set using - the property. - - A is used to inspect - each event as it arrives in the appender. If the - triggers, then the current buffer is sent immediately - (see ). Otherwise the event - is stored in the buffer. For example, an evaluator can be used to - deliver the events immediately when an ERROR event arrives. - - - The buffering appender can be configured in a mode. - By default the appender is NOT lossy. When the buffer is full all - the buffered events are sent with . - If the property is set to true then the - buffer will not be sent when it is full, and new events arriving - in the appender will overwrite the oldest event in the buffer. - In lossy mode the buffer will only be sent when the - triggers. This can be useful behavior when you need to know about - ERROR events but not about events with a lower level, configure an - evaluator that will trigger when an ERROR event arrives, the whole - buffer will be sent which gives a history of events leading up to - the ERROR event. - - - Nicko Cadell - Gert Driesen - - - - Abstract base class implementation of . - - - - This class provides the code for common functionality, such - as support for threshold filtering and support for general filters. - - - Appenders can also implement the interface. Therefore - they would require that the method - be called after the appenders properties have been configured. - - - Nicko Cadell - Gert Driesen - - - - Implement this interface for your own strategies for printing log statements. - - - - Implementors should consider extending the - class which provides a default implementation of this interface. - - - Appenders can also implement the interface. Therefore - they would require that the method - be called after the appenders properties have been configured. - - - Nicko Cadell - Gert Driesen - - - - Closes the appender and releases resources. - - - - Releases any resources allocated within the appender such as file handles, - network connections, etc. - - - It is a programming error to append to a closed appender. - - - - - - Log the logging event in Appender specific way. - - The event to log - - - This method is called to log a message into this appender. - - - - - - Gets or sets the name of this appender. - - The name of the appender. - - The name uniquely identifies the appender. - - - - - Interface for appenders that support bulk logging. - - - - This interface extends the interface to - support bulk logging of objects. Appenders - should only implement this interface if they can bulk log efficiently. - - - Nicko Cadell - - - - Log the array of logging events in Appender specific way. - - The events to log - - - This method is called to log an array of events into this appender. - - - - - - Interface used to delay activate a configured object. - - - - This allows an object to defer activation of its options until all - options have been set. This is required for components which have - related options that remain ambiguous until all are set. - - - If a component implements this interface then the method - must be called by the container after its all the configured properties have been set - and before the component can be used. - - - Nicko Cadell - - - - Activate the options that were previously set with calls to properties. - - - - This allows an object to defer activation of its options until all - options have been set. This is required for components which have - related options that remain ambiguous until all are set. - - - If a component implements this interface then this method must be called - after its properties have been set before the component can be used. - - - - - - Initial buffer size - - - - - Maximum buffer size before it is recycled - - - - - Default constructor - - - Empty default constructor - - - - - Finalizes this appender by calling the implementation's - method. - - - - If this appender has not been closed then the Finalize method - will call . - - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Closes the appender and release resources. - - - - Release any resources allocated within the appender such as file handles, - network connections, etc. - - - It is a programming error to append to a closed appender. - - - This method cannot be overridden by subclasses. This method - delegates the closing of the appender to the - method which must be overridden in the subclass. - - - - - - Performs threshold checks and invokes filters before - delegating actual logging to the subclasses specific - method. - - The event to log. - - - This method cannot be overridden by derived classes. A - derived class should override the method - which is called by this method. - - - The implementation of this method is as follows: - - - - - - Checks that the severity of the - is greater than or equal to the of this - appender. - - - - Checks that the chain accepts the - . - - - - - Calls and checks that - it returns true. - - - - - If all of the above steps succeed then the - will be passed to the abstract method. - - - - - - Performs threshold checks and invokes filters before - delegating actual logging to the subclasses specific - method. - - The array of events to log. - - - This method cannot be overridden by derived classes. A - derived class should override the method - which is called by this method. - - - The implementation of this method is as follows: - - - - - - Checks that the severity of the - is greater than or equal to the of this - appender. - - - - Checks that the chain accepts the - . - - - - - Calls and checks that - it returns true. - - - - - If all of the above steps succeed then the - will be passed to the method. - - - - - - Test if the logging event should we output by this appender - - the event to test - true if the event should be output, false if the event should be ignored - - - This method checks the logging event against the threshold level set - on this appender and also against the filters specified on this - appender. - - - The implementation of this method is as follows: - - - - - - Checks that the severity of the - is greater than or equal to the of this - appender. - - - - Checks that the chain accepts the - . - - - - - - - - - Adds a filter to the end of the filter chain. - - the filter to add to this appender - - - The Filters are organized in a linked list. - - - Setting this property causes the new filter to be pushed onto the - back of the filter chain. - - - - - - Clears the filter list for this appender. - - - - Clears the filter list for this appender. - - - - - - Checks if the message level is below this appender's threshold. - - to test against. - - - If there is no threshold set, then the return value is always true. - - - - true if the meets the - requirements of this appender. - - - - - Is called when the appender is closed. Derived classes should override - this method if resources need to be released. - - - - Releases any resources allocated within the appender such as file handles, - network connections, etc. - - - It is a programming error to append to a closed appender. - - - - - - Subclasses of should implement this method - to perform actual logging. - - The event to append. - - - A subclass must implement this method to perform - logging of the . - - This method will be called by - if all the conditions listed for that method are met. - - - To restrict the logging of events in the appender - override the method. - - - - - - Append a bulk array of logging events. - - the array of logging events - - - This base class implementation calls the - method for each element in the bulk array. - - - A sub class that can better process a bulk array of events should - override this method in addition to . - - - - - - Called before as a precondition. - - - - This method is called by - before the call to the abstract method. - - - This method can be overridden in a subclass to extend the checks - made before the event is passed to the method. - - - A subclass should ensure that they delegate this call to - this base class if it is overridden. - - - true if the call to should proceed. - - - - Renders the to a string. - - The event to render. - The event rendered as a string. - - - Helper method to render a to - a string. This appender must have a - set to render the to - a string. - - If there is exception data in the logging event and - the layout does not process the exception, this method - will append the exception text to the rendered string. - - - Where possible use the alternative version of this method - . - That method streams the rendering onto an existing Writer - which can give better performance if the caller already has - a open and ready for writing. - - - - - - Renders the to a string. - - The event to render. - The TextWriter to write the formatted event to - - - Helper method to render a to - a string. This appender must have a - set to render the to - a string. - - If there is exception data in the logging event and - the layout does not process the exception, this method - will append the exception text to the rendered string. - - - Use this method in preference to - where possible. If, however, the caller needs to render the event - to a string then does - provide an efficient mechanism for doing so. - - - - - - The layout of this appender. - - - See for more information. - - - - - The name of this appender. - - - See for more information. - - - - - The level threshold of this appender. - - - - There is no level threshold filtering by default. - - - See for more information. - - - - - - It is assumed and enforced that errorHandler is never null. - - - - It is assumed and enforced that errorHandler is never null. - - - See for more information. - - - - - - The first filter in the filter chain. - - - - Set to null initially. - - - See for more information. - - - - - - The last filter in the filter chain. - - - See for more information. - - - - - Flag indicating if this appender is closed. - - - See for more information. - - - - - The guard prevents an appender from repeatedly calling its own DoAppend method - - - - - StringWriter used to render events - - - - - Gets or sets the threshold of this appender. - - - The threshold of the appender. - - - - All log events with lower level than the threshold level are ignored - by the appender. - - - In configuration files this option is specified by setting the - value of the option to a level - string, such as "DEBUG", "INFO" and so on. - - - - - - Gets or sets the for this appender. - - The of the appender - - - The provides a default - implementation for the property. - - - - - - The filter chain. - - The head of the filter chain filter chain. - - - Returns the head Filter. The Filters are organized in a linked list - and so all Filters on this Appender are available through the result. - - - - - - Gets or sets the for this appender. - - The layout of the appender. - - - See for more information. - - - - - - - Gets or sets the name of this appender. - - The name of the appender. - - - The name uniquely identifies the appender. - - - - - - Tests if this appender requires a to be set. - - - - In the rather exceptional case, where the appender - implementation admits a layout but can also work without it, - then the appender should return true. - - - This default implementation always returns true. - - - - true if the appender requires a layout object, otherwise false. - - - - - The default buffer size. - - - The default size of the cyclic buffer used to store events. - This is set to 512 by default. - - - - - Initializes a new instance of the class. - - - - Protected default constructor to allow subclassing. - - - - - - Initializes a new instance of the class. - - the events passed through this appender must be - fixed by the time that they arrive in the derived class' SendBuffer method. - - - Protected constructor to allow subclassing. - - - The should be set if the subclass - expects the events delivered to be fixed even if the - is set to zero, i.e. when no buffering occurs. - - - - - - Flush the currently buffered events - - - - Flushes any events that have been buffered. - - - If the appender is buffering in mode then the contents - of the buffer will NOT be flushed to the appender. - - - - - - Flush the currently buffered events - - set to true to flush the buffer of lossy events - - - Flushes events that have been buffered. If is - false then events will only be flushed if this buffer is non-lossy mode. - - - If the appender is buffering in mode then the contents - of the buffer will only be flushed if is true. - In this case the contents of the buffer will be tested against the - and if triggering will be output. All other buffered - events will be discarded. - - - If is true then the buffer will always - be emptied by calling this method. - - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Close this appender instance. - - - - Close this appender instance. If this appender is marked - as not then the remaining events in - the buffer must be sent when the appender is closed. - - - - - - This method is called by the method. - - the event to log - - - Stores the in the cyclic buffer. - - - The buffer will be sent (i.e. passed to the - method) if one of the following conditions is met: - - - - The cyclic buffer is full and this appender is - marked as not lossy (see ) - - - An is set and - it is triggered for the - specified. - - - - Before the event is stored in the buffer it is fixed - (see ) to ensure that - any data referenced by the event will be valid when the buffer - is processed. - - - - - - Sends the contents of the buffer. - - The first logging event. - The buffer containing the events that need to be send. - - - The subclass must override . - - - - - - Sends the events. - - The events that need to be send. - - - The subclass must override this method to process the buffered events. - - - - - - The size of the cyclic buffer used to hold the logging events. - - - Set to by default. - - - - - The cyclic buffer used to store the logging events. - - - - - The triggering event evaluator that causes the buffer to be sent immediately. - - - The object that is used to determine if an event causes the entire - buffer to be sent immediately. This field can be null, which - indicates that event triggering is not to be done. The evaluator - can be set using the property. If this appender - has the ( property) set to - true then an must be set. - - - - - Indicates if the appender should overwrite events in the cyclic buffer - when it becomes full, or if the buffer should be flushed when the - buffer is full. - - - If this field is set to true then an must - be set. - - - - - The triggering event evaluator filters discarded events. - - - The object that is used to determine if an event that is discarded should - really be discarded or if it should be sent to the appenders. - This field can be null, which indicates that all discarded events will - be discarded. - - - - - Value indicating which fields in the event should be fixed - - - By default all fields are fixed - - - - - The events delivered to the subclass must be fixed. - - - - - Gets or sets a value that indicates whether the appender is lossy. - - - true if the appender is lossy, otherwise false. The default is false. - - - - This appender uses a buffer to store logging events before - delivering them. A triggering event causes the whole buffer - to be send to the remote sink. If the buffer overruns before - a triggering event then logging events could be lost. Set - to false to prevent logging events - from being lost. - - If is set to true then an - must be specified. - - - - - Gets or sets the size of the cyclic buffer used to hold the - logging events. - - - The size of the cyclic buffer used to hold the logging events. - - - - The option takes a positive integer - representing the maximum number of logging events to collect in - a cyclic buffer. When the is reached, - oldest events are deleted as new events are added to the - buffer. By default the size of the cyclic buffer is 512 events. - - - If the is set to a value less than - or equal to 1 then no buffering will occur. The logging event - will be delivered synchronously (depending on the - and properties). Otherwise the event will - be buffered. - - - - - - Gets or sets the that causes the - buffer to be sent immediately. - - - The that causes the buffer to be - sent immediately. - - - - The evaluator will be called for each event that is appended to this - appender. If the evaluator triggers then the current buffer will - immediately be sent (see ). - - If is set to true then an - must be specified. - - - - - Gets or sets the value of the to use. - - - The value of the to use. - - - - The evaluator will be called for each event that is discarded from this - appender. If the evaluator triggers then the current buffer will immediately - be sent (see ). - - - - - - Gets or sets a value indicating if only part of the logging event data - should be fixed. - - - true if the appender should only fix part of the logging event - data, otherwise false. The default is false. - - - - Setting this property to true will cause only part of the - event data to be fixed and serialized. This will improve performance. - - - See for more information. - - - - - - Gets or sets a the fields that will be fixed in the event - - - The event fields that will be fixed before the event is buffered - - - - The logging event needs to have certain thread specific values - captured before it can be buffered. See - for details. - - - - - - - Initializes a new instance of the class. - - - Public default constructor to initialize a new instance of this class. - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Override the parent method to close the database - - - - Closes the database command and database connection. - - - - - - Inserts the events into the database. - - The events to insert into the database. - - - Insert all the events specified in the - array into the database. - - - - - - Adds a parameter to the command. - - The parameter to add to the command. - - - Adds a parameter to the ordered list of command parameters. - - - - - - Writes the events to the database using the transaction specified. - - The transaction that the events will be executed under. - The array of events to insert into the database. - - - The transaction argument can be null if the appender has been - configured not to use transactions. See - property for more information. - - - - - - Formats the log message into database statement text. - - The event being logged. - - This method can be overridden by subclasses to provide - more control over the format of the database statement. - - - Text that can be passed to a . - - - - - Connects to the database. - - - - - Retrieves the class type of the ADO.NET provider. - - - - Gets the Type of the ADO.NET provider to use to connect to the - database. This method resolves the type specified in the - property. - - - Subclasses can override this method to return a different type - if necessary. - - - The of the ADO.NET provider - - - - Prepares the database command and initialize the parameters. - - - - - Flag to indicate if we are using a command object - - - - Set to true when the appender is to use a prepared - statement or stored procedure to insert into the database. - - - - - - The list of objects. - - - - The list of objects. - - - - - - The security context to use for privileged calls - - - - - The that will be used - to insert logging events into a database. - - - - - The database command. - - - - - Database connection string. - - - - - String type name of the type name. - - - - - The text of the command. - - - - - The command type. - - - - - Indicates whether to use transactions when writing to the database. - - - - - Indicates whether to use transactions when writing to the database. - - - - - Gets or sets the database connection string that is used to connect to - the database. - - - The database connection string used to connect to the database. - - - - The connections string is specific to the connection type. - See for more information. - - - Connection string for MS Access via ODBC: - "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb" - - Another connection string for MS Access via ODBC: - "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" - - Connection string for MS Access via OLE DB: - "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" - - - - - Gets or sets the type name of the connection - that should be created. - - - The type name of the connection. - - - - The type name of the ADO.NET provider to use. - - - The default is to use the OLE DB provider. - - - Use the OLE DB Provider. This is the default value. - System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Use the MS SQL Server Provider. - System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Use the ODBC Provider. - Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral - This is an optional package that you can download from - http://msdn.microsoft.com/downloads - search for ODBC .NET Data Provider. - - Use the Oracle Provider. - System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - This is an optional package that you can download from - http://msdn.microsoft.com/downloads - search for .NET Managed Provider for Oracle. - - - - - Gets or sets the command text that is used to insert logging events - into the database. - - - The command text used to insert logging events into the database. - - - - Either the text of the prepared statement or the - name of the stored procedure to execute to write into - the database. - - - The property determines if - this text is a prepared statement or a stored procedure. - - - - - - Gets or sets the command type to execute. - - - The command type to execute. - - - - This value may be either (System.Data.CommandType.Text) to specify - that the is a prepared statement to execute, - or (System.Data.CommandType.StoredProcedure) to specify that the - property is the name of a stored procedure - to execute. - - - The default value is (System.Data.CommandType.Text). - - - - - - Should transactions be used to insert logging events in the database. - - - true if transactions should be used to insert logging events in - the database, otherwise false. The default value is true. - - - - Gets or sets a value that indicates whether transactions should be used - to insert logging events in the database. - - - When set a single transaction will be used to insert the buffered events - into the database. Otherwise each event will be inserted without using - an explicit transaction. - - - - - - Gets or sets the used to call the NetSend method. - - - The used to call the NetSend method. - - - - Unless a specified here for this appender - the is queried for the - security context to use. The default behavior is to use the security context - of the current thread. - - - - - - Should this appender try to reconnect to the database on error. - - - true if the appender should try to reconnect to the database after an - error has occurred, otherwise false. The default value is false, - i.e. not to try to reconnect. - - - - The default behaviour is for the appender not to try to reconnect to the - database if an error occurs. Subsequent logging events are discarded. - - - To force the appender to attempt to reconnect to the database set this - property to true. - - - When the appender attempts to connect to the database there may be a - delay of up to the connection timeout specified in the connection string. - This delay will block the calling application's thread. - Until the connection can be reestablished this potential delay may occur multiple times. - - - - - - Gets or sets the underlying . - - - The underlying . - - - creates a to insert - logging events into a database. Classes deriving from - can use this property to get or set this . Use the - underlying returned from if - you require access beyond that which provides. - - - - - Parameter type used by the . - - - - This class provides the basic database parameter properties - as defined by the interface. - - This type can be subclassed to provide database specific - functionality. The two methods that are called externally are - and . - - - - - - Initializes a new instance of the class. - - - Default constructor for the AdoNetAppenderParameter class. - - - - - Prepare the specified database command object. - - The command to prepare. - - - Prepares the database command object by adding - this parameter to its collection of parameters. - - - - - - Renders the logging event and set the parameter value in the command. - - The command containing the parameter. - The event to be rendered. - - - Renders the logging event using this parameters layout - object. Sets the value of the parameter on the command object. - - - - - - The name of this parameter. - - - - - The database type for this parameter. - - - - - Flag to infer type rather than use the DbType - - - - - The precision for this parameter. - - - - - The scale for this parameter. - - - - - The size for this parameter. - - - - - The to use to render the - logging event into an object for this parameter. - - - - - Gets or sets the name of this parameter. - - - The name of this parameter. - - - - The name of this parameter. The parameter name - must match up to a named parameter to the SQL stored procedure - or prepared statement. - - - - - - Gets or sets the database type for this parameter. - - - The database type for this parameter. - - - - The database type for this parameter. This property should - be set to the database type from the - enumeration. See . - - - This property is optional. If not specified the ADO.NET provider - will attempt to infer the type from the value. - - - - - - - Gets or sets the precision for this parameter. - - - The precision for this parameter. - - - - The maximum number of digits used to represent the Value. - - - This property is optional. If not specified the ADO.NET provider - will attempt to infer the precision from the value. - - - - - - - Gets or sets the scale for this parameter. - - - The scale for this parameter. - - - - The number of decimal places to which Value is resolved. - - - This property is optional. If not specified the ADO.NET provider - will attempt to infer the scale from the value. - - - - - - - Gets or sets the size for this parameter. - - - The size for this parameter. - - - - The maximum size, in bytes, of the data within the column. - - - This property is optional. If not specified the ADO.NET provider - will attempt to infer the size from the value. - - - - - - - Gets or sets the to use to - render the logging event into an object for this - parameter. - - - The used to render the - logging event into an object for this parameter. - - - - The that renders the value for this - parameter. - - - The can be used to adapt - any into a - for use in the property. - - - - - - Appends logging events to the terminal using ANSI color escape sequences. - - - - AnsiColorTerminalAppender appends log events to the standard output stream - or the error output stream using a layout specified by the - user. It also allows the color of a specific level of message to be set. - - - This appender expects the terminal to understand the VT100 control set - in order to interpret the color codes. If the terminal or console does not - understand the control codes the behavior is not defined. - - - By default, all output is written to the console's standard output stream. - The property can be set to direct the output to the - error stream. - - - NOTE: This appender writes each message to the System.Console.Out or - System.Console.Error that is set at the time the event is appended. - Therefore it is possible to programmatically redirect the output of this appender - (for example NUnit does this to capture program output). While this is the desired - behavior of this appender it may have security implications in your application. - - - When configuring the ANSI colored terminal appender, a mapping should be - specified to map a logging level to a color. For example: - - - - - - - - - - - - - - - The Level is the standard log4net logging level and ForeColor and BackColor can be any - of the following values: - - Blue - Green - Red - White - Yellow - Purple - Cyan - - These color values cannot be combined together to make new colors. - - - The attributes can be any combination of the following: - - Brightforeground is brighter - Dimforeground is dimmer - Underscoremessage is underlined - Blinkforeground is blinking (does not work on all terminals) - Reverseforeground and background are reversed - Hiddenoutput is hidden - Strikethroughmessage has a line through it - - While any of these attributes may be combined together not all combinations - work well together, for example setting both Bright and Dim attributes makes - no sense. - - - Patrick Wagstrom - Nicko Cadell - - - - The to use when writing to the Console - standard output stream. - - - - The to use when writing to the Console - standard output stream. - - - - - - The to use when writing to the Console - standard error output stream. - - - - The to use when writing to the Console - standard error output stream. - - - - - - Ansi code to reset terminal - - - - - Initializes a new instance of the class. - - - The instance of the class is set up to write - to the standard output stream. - - - - - Add a mapping of level to color - - The mapping to add - - - Add a mapping to this appender. - Each mapping defines the foreground and background colours - for a level. - - - - - - This method is called by the method. - - The event to log. - - - Writes the event to the console. - - - The format of the output will depend on the appender's layout. - - - - - - Initialize the options for this appender - - - - Initialize the level to color mappings set on this appender. - - - - - - Flag to write output to the error stream rather than the standard output stream - - - - - Mapping from level object to color value - - - - - Target is the value of the console output stream. - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - The enum of possible display attributes - - - - The following flags can be combined together to - form the ANSI color attributes. - - - - - - - text is bright - - - - - text is dim - - - - - text is underlined - - - - - text is blinking - - - Not all terminals support this attribute - - - - - text and background colors are reversed - - - - - text is hidden - - - - - text is displayed with a strikethrough - - - - - The enum of possible foreground or background color values for - use with the color mapping method - - - - The output can be in one for the following ANSI colors. - - - - - - - color is black - - - - - color is red - - - - - color is green - - - - - color is yellow - - - - - color is blue - - - - - color is magenta - - - - - color is cyan - - - - - color is white - - - - - A class to act as a mapping between the level that a logging call is made at and - the color it should be displayed as. - - - - Defines the mapping between a level and the color it should be displayed in. - - - - - - An entry in the - - - - This is an abstract base class for types that are stored in the - object. - - - Nicko Cadell - - - - Default protected constructor - - - - Default protected constructor - - - - - - Initialize any options defined on this entry - - - - Should be overridden by any classes that need to initialise based on their options - - - - - - The level that is the key for this mapping - - - The that is the key for this mapping - - - - Get or set the that is the key for this - mapping subclass. - - - - - - Initialize the options for the object - - - - Combine the and together - and append the attributes. - - - - - - The mapped foreground color for the specified level - - - - Required property. - The mapped foreground color for the specified level - - - - - - The mapped background color for the specified level - - - - Required property. - The mapped background color for the specified level - - - - - - The color attributes for the specified level - - - - Required property. - The color attributes for the specified level - - - - - - The combined , and - suitable for setting the ansi terminal color. - - - - - A strongly-typed collection of objects. - - Nicko Cadell - - - - Creates a read-only wrapper for a AppenderCollection instance. - - list to create a readonly wrapper arround - - An AppenderCollection wrapper that is read-only. - - - - - An empty readonly static AppenderCollection - - - - - Initializes a new instance of the AppenderCollection class - that is empty and has the default initial capacity. - - - - - Initializes a new instance of the AppenderCollection class - that has the specified initial capacity. - - - The number of elements that the new AppenderCollection is initially capable of storing. - - - - - Initializes a new instance of the AppenderCollection class - that contains elements copied from the specified AppenderCollection. - - The AppenderCollection whose elements are copied to the new collection. - - - - Initializes a new instance of the AppenderCollection class - that contains elements copied from the specified array. - - The array whose elements are copied to the new list. - - - - Initializes a new instance of the AppenderCollection class - that contains elements copied from the specified collection. - - The collection whose elements are copied to the new list. - - - - Allow subclasses to avoid our default constructors - - - - - - - Copies the entire AppenderCollection to a one-dimensional - array. - - The one-dimensional array to copy to. - - - - Copies the entire AppenderCollection to a one-dimensional - array, starting at the specified index of the target array. - - The one-dimensional array to copy to. - The zero-based index in at which copying begins. - - - - Adds a to the end of the AppenderCollection. - - The to be added to the end of the AppenderCollection. - The index at which the value has been added. - - - - Removes all elements from the AppenderCollection. - - - - - Creates a shallow copy of the . - - A new with a shallow copy of the collection data. - - - - Determines whether a given is in the AppenderCollection. - - The to check for. - true if is found in the AppenderCollection; otherwise, false. - - - - Returns the zero-based index of the first occurrence of a - in the AppenderCollection. - - The to locate in the AppenderCollection. - - The zero-based index of the first occurrence of - in the entire AppenderCollection, if found; otherwise, -1. - - - - - Inserts an element into the AppenderCollection at the specified index. - - The zero-based index at which should be inserted. - The to insert. - - is less than zero - -or- - is equal to or greater than . - - - - - Removes the first occurrence of a specific from the AppenderCollection. - - The to remove from the AppenderCollection. - - The specified was not found in the AppenderCollection. - - - - - Removes the element at the specified index of the AppenderCollection. - - The zero-based index of the element to remove. - - is less than zero - -or- - is equal to or greater than . - - - - - Returns an enumerator that can iterate through the AppenderCollection. - - An for the entire AppenderCollection. - - - - Adds the elements of another AppenderCollection to the current AppenderCollection. - - The AppenderCollection whose elements should be added to the end of the current AppenderCollection. - The new of the AppenderCollection. - - - - Adds the elements of a array to the current AppenderCollection. - - The array whose elements should be added to the end of the AppenderCollection. - The new of the AppenderCollection. - - - - Adds the elements of a collection to the current AppenderCollection. - - The collection whose elements should be added to the end of the AppenderCollection. - The new of the AppenderCollection. - - - - Sets the capacity to the actual number of elements. - - - - - Return the collection elements as an array - - the array - - - - is less than zero - -or- - is equal to or greater than . - - - - - is less than zero - -or- - is equal to or greater than . - - - - - Gets the number of elements actually contained in the AppenderCollection. - - - - - Gets a value indicating whether access to the collection is synchronized (thread-safe). - - true if access to the ICollection is synchronized (thread-safe); otherwise, false. - - - - Gets an object that can be used to synchronize access to the collection. - - - - - Gets or sets the at the specified index. - - The zero-based index of the element to get or set. - - is less than zero - -or- - is equal to or greater than . - - - - - Gets a value indicating whether the collection has a fixed size. - - true if the collection has a fixed size; otherwise, false. The default is false - - - - Gets a value indicating whether the IList is read-only. - - true if the collection is read-only; otherwise, false. The default is false - - - - Gets or sets the number of elements the AppenderCollection can contain. - - - - - Supports type-safe iteration over a . - - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - - - Type visible only to our subclasses - Used to access protected constructor - - - - - - A value - - - - - Supports simple iteration over a . - - - - - - Initializes a new instance of the Enumerator class. - - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - - - - - - - Appends log events to the ASP.NET system. - - - - - Diagnostic information and tracing messages that you specify are appended to the output - of the page that is sent to the requesting browser. Optionally, you can view this information - from a separate trace viewer (Trace.axd) that displays trace information for every page in a - given application. - - - Trace statements are processed and displayed only when tracing is enabled. You can control - whether tracing is displayed to a page, to the trace viewer, or both. - - - The logging event is passed to the or - method depending on the level of the logging event. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Write the logging event to the ASP.NET trace - - the event to log - - - Write the logging event to the ASP.NET trace - HttpContext.Current.Trace - (). - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Buffers events and then forwards them to attached appenders. - - - - The events are buffered in this appender until conditions are - met to allow the appender to deliver the events to the attached - appenders. See for the - conditions that cause the buffer to be sent. - - The forwarding appender can be used to specify different - thresholds and filters for the same appender at different locations - within the hierarchy. - - - Nicko Cadell - Gert Driesen - - - - Interface for attaching appenders to objects. - - - - Interface for attaching, removing and retrieving appenders. - - - Nicko Cadell - Gert Driesen - - - - Attaches an appender. - - The appender to add. - - - Add the specified appender. The implementation may - choose to allow or deny duplicate appenders. - - - - - - Gets an attached appender with the specified name. - - The name of the appender to get. - - The appender with the name specified, or null if no appender with the - specified name is found. - - - - Returns an attached appender with the specified. - If no appender with the specified name is found null will be - returned. - - - - - - Removes all attached appenders. - - - - Removes and closes all attached appenders - - - - - - Removes the specified appender from the list of attached appenders. - - The appender to remove. - The appender removed from the list - - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - Removes the appender with the specified name from the list of appenders. - - The name of the appender to remove. - The appender removed from the list - - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - Gets all attached appenders. - - - A collection of attached appenders. - - - - Gets a collection of attached appenders. - If there are no attached appenders the - implementation should return an empty - collection rather than null. - - - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Closes the appender and releases resources. - - - - Releases any resources allocated within the appender such as file handles, - network connections, etc. - - - It is a programming error to append to a closed appender. - - - - - - Send the events. - - The events that need to be send. - - - Forwards the events to the attached appenders. - - - - - - Adds an to the list of appenders of this - instance. - - The to add to this appender. - - - If the specified is already in the list of - appenders, then it won't be added again. - - - - - - Looks for the appender with the specified name. - - The name of the appender to lookup. - - The appender with the specified name, or null. - - - - Get the named appender attached to this buffering appender. - - - - - - Removes all previously added appenders from this appender. - - - - This is useful when re-reading configuration information. - - - - - - Removes the specified appender from the list of appenders. - - The appender to remove. - The appender removed from the list - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - Removes the appender with the specified name from the list of appenders. - - The name of the appender to remove. - The appender removed from the list - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - Implementation of the interface - - - - - Gets the appenders contained in this appender as an - . - - - If no appenders can be found, then an - is returned. - - - A collection of the appenders in this appender. - - - - - Appends logging events to the console. - - - - ColoredConsoleAppender appends log events to the standard output stream - or the error output stream using a layout specified by the - user. It also allows the color of a specific type of message to be set. - - - By default, all output is written to the console's standard output stream. - The property can be set to direct the output to the - error stream. - - - NOTE: This appender writes directly to the application's attached console - not to the System.Console.Out or System.Console.Error TextWriter. - The System.Console.Out and System.Console.Error streams can be - programmatically redirected (for example NUnit does this to capture program output). - This appender will ignore these redirections because it needs to use Win32 - API calls to colorize the output. To respect these redirections the - must be used. - - - When configuring the colored console appender, mapping should be - specified to map a logging level to a color. For example: - - - - - - - - - - - - - - The Level is the standard log4net logging level and ForeColor and BackColor can be any - combination of the following values: - - Blue - Green - Red - White - Yellow - Purple - Cyan - HighIntensity - - - - Rick Hobbs - Nicko Cadell - - - - The to use when writing to the Console - standard output stream. - - - - The to use when writing to the Console - standard output stream. - - - - - - The to use when writing to the Console - standard error output stream. - - - - The to use when writing to the Console - standard error output stream. - - - - - - Initializes a new instance of the class. - - - The instance of the class is set up to write - to the standard output stream. - - - - - Initializes a new instance of the class - with the specified layout. - - the layout to use for this appender - - The instance of the class is set up to write - to the standard output stream. - - - - - Initializes a new instance of the class - with the specified layout. - - the layout to use for this appender - flag set to true to write to the console error stream - - When is set to true, output is written to - the standard error output stream. Otherwise, output is written to the standard - output stream. - - - - - Add a mapping of level to color - done by the config file - - The mapping to add - - - Add a mapping to this appender. - Each mapping defines the foreground and background colors - for a level. - - - - - - This method is called by the method. - - The event to log. - - - Writes the event to the console. - - - The format of the output will depend on the appender's layout. - - - - - - Initialize the options for this appender - - - - Initialize the level to color mappings set on this appender. - - - - - - Flag to write output to the error stream rather than the standard output stream - - - - - Mapping from level object to color value - - - - - The console output stream writer to write to - - - - This writer is not thread safe. - - - - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - The enum of possible color values for use with the color mapping method - - - - The following flags can be combined together to - form the colors. - - - - - - - color is blue - - - - - color is green - - - - - color is red - - - - - color is white - - - - - color is yellow - - - - - color is purple - - - - - color is cyan - - - - - color is intensified - - - - - A class to act as a mapping between the level that a logging call is made at and - the color it should be displayed as. - - - - Defines the mapping between a level and the color it should be displayed in. - - - - - - Initialize the options for the object - - - - Combine the and together. - - - - - - The mapped foreground color for the specified level - - - - Required property. - The mapped foreground color for the specified level. - - - - - - The mapped background color for the specified level - - - - Required property. - The mapped background color for the specified level. - - - - - - The combined and suitable for - setting the console color. - - - - - Appends logging events to the console. - - - - ConsoleAppender appends log events to the standard output stream - or the error output stream using a layout specified by the - user. - - - By default, all output is written to the console's standard output stream. - The property can be set to direct the output to the - error stream. - - - NOTE: This appender writes each message to the System.Console.Out or - System.Console.Error that is set at the time the event is appended. - Therefore it is possible to programmatically redirect the output of this appender - (for example NUnit does this to capture program output). While this is the desired - behavior of this appender it may have security implications in your application. - - - Nicko Cadell - Gert Driesen - - - - The to use when writing to the Console - standard output stream. - - - - The to use when writing to the Console - standard output stream. - - - - - - The to use when writing to the Console - standard error output stream. - - - - The to use when writing to the Console - standard error output stream. - - - - - - Initializes a new instance of the class. - - - The instance of the class is set up to write - to the standard output stream. - - - - - Initializes a new instance of the class - with the specified layout. - - the layout to use for this appender - - The instance of the class is set up to write - to the standard output stream. - - - - - Initializes a new instance of the class - with the specified layout. - - the layout to use for this appender - flag set to true to write to the console error stream - - When is set to true, output is written to - the standard error output stream. Otherwise, output is written to the standard - output stream. - - - - - This method is called by the method. - - The event to log. - - - Writes the event to the console. - - - The format of the output will depend on the appender's layout. - - - - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - Target is the value of the console output stream. - This is either "Console.Out" or "Console.Error". - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Appends log events to the system. - - - - The application configuration file can be used to control what listeners - are actually used. See the MSDN documentation for the - class for details on configuring the - debug system. - - - Events are written using the - method. The event's logger name is passed as the value for the category name to the Write method. - - - Nicko Cadell - - - - Initializes a new instance of the . - - - - Default constructor. - - - - - - Initializes a new instance of the - with a specified layout. - - The layout to use with this appender. - - - Obsolete constructor. - - - - - - Writes the logging event to the system. - - The event to log. - - - Writes the logging event to the system. - If is true then the - is called. - - - - - - Immediate flush means that the underlying writer or output stream - will be flushed at the end of each append operation. - - - - Immediate flush is slower but ensures that each append request is - actually written. If is set to - false, then there is a good chance that the last few - logs events are not actually written to persistent media if and - when the application crashes. - - - The default value is true. - - - - - Gets or sets a value that indicates whether the appender will - flush at the end of each write. - - - The default behavior is to flush at the end of each - write. If the option is set tofalse, then the underlying - stream can defer writing to physical medium to a later time. - - - Avoiding the flush operation at the end of each append results - in a performance gain of 10 to 20 percent. However, there is safety - trade-off involved in skipping flushing. Indeed, when flushing is - skipped, then it is likely that the last few log events will not - be recorded on disk when the application exits. This is a high - price to pay even for a 20% performance gain. - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Writes events to the system event log. - - - - The EventID of the event log entry can be - set using the EventLogEventID property () - on the . - - - There is a limit of 32K characters for an event log message - - - When configuring the EventLogAppender a mapping can be - specified to map a logging level to an event log entry type. For example: - - - <mapping> - <level value="ERROR" /> - <eventLogEntryType value="Error" /> - </mapping> - <mapping> - <level value="DEBUG" /> - <eventLogEntryType value="Information" /> - </mapping> - - - The Level is the standard log4net logging level and eventLogEntryType can be any value - from the enum, i.e.: - - Erroran error event - Warninga warning event - Informationan informational event - - - - Aspi Havewala - Douglas de la Torre - Nicko Cadell - Gert Driesen - Thomas Voss - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Initializes a new instance of the class - with the specified . - - The to use with this appender. - - - Obsolete constructor. - - - - - - Add a mapping of level to - done by the config file - - The mapping to add - - - Add a mapping to this appender. - Each mapping defines the event log entry type for a level. - - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Create an event log source - - - Uses different API calls under NET_2_0 - - - - - This method is called by the - method. - - the event to log - - Writes the event to the system event log using the - . - - If the event has an EventID property (see ) - set then this integer will be used as the event log event id. - - - There is a limit of 32K characters for an event log message - - - - - - Get the equivalent for a - - the Level to convert to an EventLogEntryType - The equivalent for a - - Because there are fewer applicable - values to use in logging levels than there are in the - this is a one way mapping. There is - a loss of information during the conversion. - - - - - The log name is the section in the event logs where the messages - are stored. - - - - - Name of the application to use when logging. This appears in the - application column of the event log named by . - - - - - The name of the machine which holds the event log. This is - currently only allowed to be '.' i.e. the current machine. - - - - - Mapping from level object to EventLogEntryType - - - - - The security context to use for privileged calls - - - - - The name of the log where messages will be stored. - - - The string name of the log where messages will be stored. - - - This is the name of the log as it appears in the Event Viewer - tree. The default value is to log into the Application - log, this is where most applications write their events. However - if you need a separate log for your application (or applications) - then you should set the appropriately. - This should not be used to distinguish your event log messages - from those of other applications, the - property should be used to distinguish events. This property should be - used to group together events into a single log. - - - - - - Property used to set the Application name. This appears in the - event logs when logging. - - - The string used to distinguish events from different sources. - - - Sets the event log source property. - - - - - This property is used to return the name of the computer to use - when accessing the event logs. Currently, this is the current - computer, denoted by a dot "." - - - The string name of the machine holding the event log that - will be logged into. - - - This property cannot be changed. It is currently set to '.' - i.e. the local machine. This may be changed in future. - - - - - Gets or sets the used to write to the EventLog. - - - The used to write to the EventLog. - - - - The system security context used to write to the EventLog. - - - Unless a specified here for this appender - the is queried for the - security context to use. The default behavior is to use the security context - of the current thread. - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - A class to act as a mapping between the level that a logging call is made at and - the color it should be displayed as. - - - - Defines the mapping between a level and its event log entry type. - - - - - - The for this entry - - - - Required property. - The for this entry - - - - - - Appends logging events to a file. - - - - Logging events are sent to the file specified by - the property. - - - The file can be opened in either append or overwrite mode - by specifying the property. - If the file path is relative it is taken as relative from - the application base directory. The file encoding can be - specified by setting the property. - - - The layout's and - values will be written each time the file is opened and closed - respectively. If the property is - then the file may contain multiple copies of the header and footer. - - - This appender will first try to open the file for writing when - is called. This will typically be during configuration. - If the file cannot be opened for writing the appender will attempt - to open the file again each time a message is logged to the appender. - If the file cannot be opened for writing when a message is logged then - the message will be discarded by this appender. - - - The supports pluggable file locking models via - the property. - The default behavior, implemented by - is to obtain an exclusive write lock on the file until this appender is closed. - The alternative model, , only holds a - write lock while the appender is writing a logging event. - - - Nicko Cadell - Gert Driesen - Rodrigo B. de Oliveira - Douglas de la Torre - Niall Daley - - - - Sends logging events to a . - - - - An Appender that writes to a . - - - This appender may be used stand alone if initialized with an appropriate - writer, however it is typically used as a base class for an appender that - can open a to write to. - - - Nicko Cadell - Gert Driesen - Douglas de la Torre - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Initializes a new instance of the class and - sets the output destination to a new initialized - with the specified . - - The layout to use with this appender. - The to output to. - - - Obsolete constructor. - - - - - - Initializes a new instance of the class and sets - the output destination to the specified . - - The layout to use with this appender - The to output to - - The must have been previously opened. - - - - Obsolete constructor. - - - - - - This method determines if there is a sense in attempting to append. - - - - This method checked if an output target has been set and if a - layout has been set. - - - false if any of the preconditions fail. - - - - This method is called by the - method. - - The event to log. - - - Writes a log statement to the output stream if the output stream exists - and is writable. - - - The format of the output will depend on the appender's layout. - - - - - - This method is called by the - method. - - The array of events to log. - - - This method writes all the bulk logged events to the output writer - before flushing the stream. - - - - - - Close this appender instance. The underlying stream or writer is also closed. - - - Closed appenders cannot be reused. - - - - - Writes the footer and closes the underlying . - - - - Writes the footer and closes the underlying . - - - - - - Closes the underlying . - - - - Closes the underlying . - - - - - - Clears internal references to the underlying - and other variables. - - - - Subclasses can override this method for an alternate closing behavior. - - - - - - Writes a footer as produced by the embedded layout's property. - - - - Writes a footer as produced by the embedded layout's property. - - - - - - Writes a header produced by the embedded layout's property. - - - - Writes a header produced by the embedded layout's property. - - - - - - Called to allow a subclass to lazily initialize the writer - - - - This method is called when an event is logged and the or - have not been set. This allows a subclass to - attempt to initialize the writer multiple times. - - - - - - This is the where logging events - will be written to. - - - - - Immediate flush means that the underlying - or output stream will be flushed at the end of each append operation. - - - - Immediate flush is slower but ensures that each append request is - actually written. If is set to - false, then there is a good chance that the last few - logging events are not actually persisted if and when the application - crashes. - - - The default value is true. - - - - - - Gets or set whether the appender will flush at the end - of each append operation. - - - - The default behavior is to flush at the end of each - append operation. - - - If this option is set to false, then the underlying - stream can defer persisting the logging event to a later - time. - - - - Avoiding the flush operation at the end of each append results in - a performance gain of 10 to 20 percent. However, there is safety - trade-off involved in skipping flushing. Indeed, when flushing is - skipped, then it is likely that the last few log events will not - be recorded on disk when the application exits. This is a high - price to pay even for a 20% performance gain. - - - - - Sets the where the log output will go. - - - - The specified must be open and writable. - - - The will be closed when the appender - instance is closed. - - - Note: Logging to an unopened will fail. - - - - - - Gets or set the and the underlying - , if any, for this appender. - - - The for this appender. - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Gets or sets the where logging events - will be written to. - - - The where logging events are written. - - - - This is the where logging events - will be written to. - - - - - - Default constructor - - - - Default constructor - - - - - - Construct a new appender using the layout, file and append mode. - - the layout to use with this appender - the full path to the file to write to - flag to indicate if the file should be appended to - - - Obsolete constructor. - - - - - - Construct a new appender using the layout and file specified. - The file will be appended to. - - the layout to use with this appender - the full path to the file to write to - - - Obsolete constructor. - - - - - - Activate the options on the file appender. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - This will cause the file to be opened. - - - - - - Closes any previously opened file and calls the parent's . - - - - Resets the filename and the file stream. - - - - - - Called to initialize the file writer - - - - Will be called for each logged message until the file is - successfully opened. - - - - - - This method is called by the - method. - - The event to log. - - - Writes a log statement to the output stream if the output stream exists - and is writable. - - - The format of the output will depend on the appender's layout. - - - - - - This method is called by the - method. - - The array of events to log. - - - Acquires the output file locks once before writing all the events to - the stream. - - - - - - Writes a footer as produced by the embedded layout's property. - - - - Writes a footer as produced by the embedded layout's property. - - - - - - Writes a header produced by the embedded layout's property. - - - - Writes a header produced by the embedded layout's property. - - - - - - Closes the underlying . - - - - Closes the underlying . - - - - - - Closes the previously opened file. - - - - Writes the to the file and then - closes the file. - - - - - - Sets and opens the file where the log output will go. The specified file must be writable. - - The path to the log file. Must be a fully qualified path. - If true will append to fileName. Otherwise will truncate fileName - - - Calls but guarantees not to throw an exception. - Errors are passed to the . - - - - - - Sets and opens the file where the log output will go. The specified file must be writable. - - The path to the log file. Must be a fully qualified path. - If true will append to fileName. Otherwise will truncate fileName - - - If there was already an opened file, then the previous file - is closed first. - - - This method will ensure that the directory structure - for the specified exists. - - - - - - Sets the quiet writer used for file output - - the file stream that has been opened for writing - - - This implementation of creates a - over the and passes it to the - method. - - - This method can be overridden by sub classes that want to wrap the - in some way, for example to encrypt the output - data using a System.Security.Cryptography.CryptoStream. - - - - - - Sets the quiet writer being used. - - the writer over the file stream that has been opened for writing - - - This method can be overridden by sub classes that want to - wrap the in some way. - - - - - - Convert a path into a fully qualified path. - - The path to convert. - The fully qualified path. - - - Converts the path specified to a fully - qualified path. If the path is relative it is - taken as relative from the application base - directory. - - - - - - Flag to indicate if we should append to the file - or overwrite the file. The default is to append. - - - - - The name of the log file. - - - - - The encoding to use for the file stream. - - - - - The security context to use for privileged calls - - - - - The stream to log to. Has added locking semantics - - - - - The locking model to use - - - - - Gets or sets the path to the file that logging will be written to. - - - The path to the file that logging will be written to. - - - - If the path is relative it is taken as relative from - the application base directory. - - - - - - Gets or sets a flag that indicates whether the file should be - appended to or overwritten. - - - Indicates whether the file should be appended to or overwritten. - - - - If the value is set to false then the file will be overwritten, if - it is set to true then the file will be appended to. - - The default value is true. - - - - - Gets or sets used to write to the file. - - - The used to write to the file. - - - - The default encoding set is - which is the encoding for the system's current ANSI code page. - - - - - - Gets or sets the used to write to the file. - - - The used to write to the file. - - - - Unless a specified here for this appender - the is queried for the - security context to use. The default behavior is to use the security context - of the current thread. - - - - - - Gets or sets the used to handle locking of the file. - - - The used to lock the file. - - - - Gets or sets the used to handle locking of the file. - - - There are two built in locking models, and . - The former locks the file from the start of logging to the end and the - later lock only for the minimal amount of time when logging each message. - - - The default locking model is the . - - - - - - Write only that uses the - to manage access to an underlying resource. - - - - - True asynchronous writes are not supported, the implementation forces a synchronous write. - - - - - Exception base type for log4net. - - - - This type extends . It - does not add any new functionality but does differentiate the - type of exception being thrown. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Constructor - - A message to include with the exception. - - - Initializes a new instance of the class with - the specified message. - - - - - - Constructor - - A message to include with the exception. - A nested exception to include. - - - Initializes a new instance of the class - with the specified message and inner exception. - - - - - - Serialization constructor - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - - - Initializes a new instance of the class - with serialized data. - - - - - - Locking model base class - - - - Base class for the locking models available to the derived loggers. - - - - - - Open the output file - - The filename to use - Whether to append to the file, or overwrite - The encoding to use - - - Open the file specified and prepare for logging. - No writes will be made until is called. - Must be called before any calls to , - and . - - - - - - Close the file - - - - Close the file. No further writes will be made. - - - - - - Acquire the lock on the file - - A stream that is ready to be written to. - - - Acquire the lock on the file in preparation for writing to it. - Return a stream pointing to the file. - must be called to release the lock on the output file. - - - - - - Release the lock on the file - - - - Release the lock on the file. No further writes will be made to the - stream until is called again. - - - - - - Gets or sets the for this LockingModel - - - The for this LockingModel - - - - The file appender this locking model is attached to and working on - behalf of. - - - The file appender is used to locate the security context and the error handler to use. - - - The value of this property will be set before is - called. - - - - - - Hold an exclusive lock on the output file - - - - Open the file once for writing and hold it open until is called. - Maintains an exclusive lock on the file during this time. - - - - - - Open the file specified and prepare for logging. - - The filename to use - Whether to append to the file, or overwrite - The encoding to use - - - Open the file specified and prepare for logging. - No writes will be made until is called. - Must be called before any calls to , - and . - - - - - - Close the file - - - - Close the file. No further writes will be made. - - - - - - Acquire the lock on the file - - A stream that is ready to be written to. - - - Does nothing. The lock is already taken - - - - - - Release the lock on the file - - - - Does nothing. The lock will be released when the file is closed. - - - - - - Acquires the file lock for each write - - - - Opens the file once for each / cycle, - thus holding the lock for the minimal amount of time. This method of locking - is considerably slower than but allows - other processes to move/delete the log file whilst logging continues. - - - - - - Prepares to open the file when the first message is logged. - - The filename to use - Whether to append to the file, or overwrite - The encoding to use - - - Open the file specified and prepare for logging. - No writes will be made until is called. - Must be called before any calls to , - and . - - - - - - Close the file - - - - Close the file. No further writes will be made. - - - - - - Acquire the lock on the file - - A stream that is ready to be written to. - - - Acquire the lock on the file in preparation for writing to it. - Return a stream pointing to the file. - must be called to release the lock on the output file. - - - - - - Release the lock on the file - - - - Release the lock on the file. No further writes will be made to the - stream until is called again. - - - - - - This appender forwards logging events to attached appenders. - - - - The forwarding appender can be used to specify different thresholds - and filters for the same appender at different locations within the hierarchy. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Closes the appender and releases resources. - - - - Releases any resources allocated within the appender such as file handles, - network connections, etc. - - - It is a programming error to append to a closed appender. - - - - - - Forward the logging event to the attached appenders - - The event to log. - - - Delivers the logging event to all the attached appenders. - - - - - - Forward the logging events to the attached appenders - - The array of events to log. - - - Delivers the logging events to all the attached appenders. - - - - - - Adds an to the list of appenders of this - instance. - - The to add to this appender. - - - If the specified is already in the list of - appenders, then it won't be added again. - - - - - - Looks for the appender with the specified name. - - The name of the appender to lookup. - - The appender with the specified name, or null. - - - - Get the named appender attached to this appender. - - - - - - Removes all previously added appenders from this appender. - - - - This is useful when re-reading configuration information. - - - - - - Removes the specified appender from the list of appenders. - - The appender to remove. - The appender removed from the list - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - Removes the appender with the specified name from the list of appenders. - - The name of the appender to remove. - The appender removed from the list - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - Implementation of the interface - - - - - Gets the appenders contained in this appender as an - . - - - If no appenders can be found, then an - is returned. - - - A collection of the appenders in this appender. - - - - - Logs events to a local syslog service. - - - - This appender uses the POSIX libc library functions openlog, syslog, and closelog. - If these functions are not available on the local system then this appender will not work! - - - The functions openlog, syslog, and closelog are specified in SUSv2 and - POSIX 1003.1-2001 standards. These are used to log messages to the local syslog service. - - - This appender talks to a local syslog service. If you need to log to a remote syslog - daemon and you cannot configure your local syslog service to do this you may be - able to use the to log via UDP. - - - Syslog messages must have a facility and and a severity. The severity - is derived from the Level of the logging event. - The facility must be chosen from the set of defined syslog - values. The facilities list is predefined - and cannot be extended. - - - An identifier is specified with each log message. This can be specified - by setting the property. The identity (also know - as the tag) must not contain white space. The default value for the - identity is the application name (from ). - - - Rob Lyon - Nicko Cadell - - - - Initializes a new instance of the class. - - - This instance of the class is set up to write - to a local syslog service. - - - - - Add a mapping of level to severity - - The mapping to add - - - Adds a to this appender. - - - - - - Initialize the appender based on the options set. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - This method is called by the method. - - The event to log. - - - Writes the event to a remote syslog daemon. - - - The format of the output will depend on the appender's layout. - - - - - - Close the syslog when the appender is closed - - - - Close the syslog when the appender is closed - - - - - - Translates a log4net level to a syslog severity. - - A log4net level. - A syslog severity. - - - Translates a log4net level to a syslog severity. - - - - - - Generate a syslog priority. - - The syslog facility. - The syslog severity. - A syslog priority. - - - - The facility. The default facility is . - - - - - The message identity - - - - - Marshaled handle to the identity string. We have to hold on to the - string as the openlog and syslog APIs just hold the - pointer to the ident and dereference it for each log message. - - - - - Mapping from level object to syslog severity - - - - - Open connection to system logger. - - - - - Generate a log message. - - - - The libc syslog method takes a format string and a variable argument list similar - to the classic printf function. As this type of vararg list is not supported - by C# we need to specify the arguments explicitly. Here we have specified the - format string with a single message argument. The caller must set the format - string to "%s". - - - - - - Close descriptor used to write to system logger. - - - - - Message identity - - - - An identifier is specified with each log message. This can be specified - by setting the property. The identity (also know - as the tag) must not contain white space. The default value for the - identity is the application name (from ). - - - - - - Syslog facility - - - Set to one of the values. The list of - facilities is predefined and cannot be extended. The default value - is . - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - syslog severities - - - - The log4net Level maps to a syslog severity using the - method and the - class. The severity is set on . - - - - - - system is unusable - - - - - action must be taken immediately - - - - - critical conditions - - - - - error conditions - - - - - warning conditions - - - - - normal but significant condition - - - - - informational - - - - - debug-level messages - - - - - syslog facilities - - - - The syslog facility defines which subsystem the logging comes from. - This is set on the property. - - - - - - kernel messages - - - - - random user-level messages - - - - - mail system - - - - - system daemons - - - - - security/authorization messages - - - - - messages generated internally by syslogd - - - - - line printer subsystem - - - - - network news subsystem - - - - - UUCP subsystem - - - - - clock (cron/at) daemon - - - - - security/authorization messages (private) - - - - - ftp daemon - - - - - NTP subsystem - - - - - log audit - - - - - log alert - - - - - clock daemon - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - A class to act as a mapping between the level that a logging call is made at and - the syslog severity that is should be logged at. - - - - A class to act as a mapping between the level that a logging call is made at and - the syslog severity that is should be logged at. - - - - - - The mapped syslog severity for the specified level - - - - Required property. - The mapped syslog severity for the specified level - - - - - - Stores logging events in an array. - - - - The memory appender stores all the logging events - that are appended in an in-memory array. - - - Use the method to get - the current list of events that have been appended. - - - Use the method to clear the - current list of events. - - - Julian Biddle - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Gets the events that have been logged. - - The events that have been logged - - - Gets the events that have been logged. - - - - - - This method is called by the method. - - the event to log - - Stores the in the events list. - - - - - Clear the list of events - - - Clear the list of events - - - - - The list of events that have been appended. - - - - - Value indicating which fields in the event should be fixed - - - By default all fields are fixed - - - - - Gets or sets a value indicating whether only part of the logging event - data should be fixed. - - - true if the appender should only fix part of the logging event - data, otherwise false. The default is false. - - - - Setting this property to true will cause only part of the event - data to be fixed and stored in the appender, hereby improving performance. - - - See for more information. - - - - - - Gets or sets the fields that will be fixed in the event - - - - The logging event needs to have certain thread specific values - captured before it can be buffered. See - for details. - - - - - - Logs entries by sending network messages using the - native function. - - - - You can send messages only to names that are active - on the network. If you send the message to a user name, - that user must be logged on and running the Messenger - service to receive the message. - - - The receiver will get a top most window displaying the - messages one at a time, therefore this appender should - not be used to deliver a high volume of messages. - - - The following table lists some possible uses for this appender : - - - - - Action - Property Value(s) - - - Send a message to a user account on the local machine - - - = <name of the local machine> - - - = <user name> - - - - - Send a message to a user account on a remote machine - - - = <name of the remote machine> - - - = <user name> - - - - - Send a message to a domain user account - - - = <name of a domain controller | uninitialized> - - - = <user name> - - - - - Send a message to all the names in a workgroup or domain - - - = <workgroup name | domain name>* - - - - - Send a message from the local machine to a remote machine - - - = <name of the local machine | uninitialized> - - - = <name of the remote machine> - - - - - - - Note : security restrictions apply for sending - network messages, see - for more information. - - - - - An example configuration section to log information - using this appender from the local machine, named - LOCAL_PC, to machine OPERATOR_PC : - - - - - - - - - - Nicko Cadell - Gert Driesen - - - - The DNS or NetBIOS name of the server on which the function is to execute. - - - - - The sender of the network message. - - - - - The message alias to which the message should be sent. - - - - - The security context to use for privileged calls - - - - - Initializes the appender. - - - The default constructor initializes all fields to their default values. - - - - - Initialize the appender based on the options set. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - The appender will be ignored if no was specified. - - - The required property was not specified. - - - - This method is called by the method. - - The event to log. - - - Sends the event using a network message. - - - - - - Sends a buffer of information to a registered message alias. - - The DNS or NetBIOS name of the server on which the function is to execute. - The message alias to which the message buffer should be sent - The originator of the message. - The message text. - The length, in bytes, of the message text. - - - The following restrictions apply for sending network messages: - - - - - Platform - Requirements - - - Windows NT - - - No special group membership is required to send a network message. - - - Admin, Accounts, Print, or Server Operator group membership is required to - successfully send a network message on a remote server. - - - - - Windows 2000 or later - - - If you send a message on a domain controller that is running Active Directory, - access is allowed or denied based on the access control list (ACL) for the securable - object. The default ACL permits only Domain Admins and Account Operators to send a network message. - - - On a member server or workstation, only Administrators and Server Operators can send a network message. - - - - - - - For more information see Security Requirements for the Network Management Functions. - - - - - If the function succeeds, the return value is zero. - - - - - - Gets or sets the sender of the message. - - - The sender of the message. - - - If this property is not specified, the message is sent from the local computer. - - - - - Gets or sets the message alias to which the message should be sent. - - - The recipient of the message. - - - This property should always be specified in order to send a message. - - - - - Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute. - - - DNS or NetBIOS name of the remote server on which the function is to execute. - - - - For Windows NT 4.0 and earlier, the string should begin with \\. - - - If this property is not specified, the local computer is used. - - - - - - Gets or sets the used to call the NetSend method. - - - The used to call the NetSend method. - - - - Unless a specified here for this appender - the is queried for the - security context to use. The default behavior is to use the security context - of the current thread. - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Appends log events to the OutputDebugString system. - - - - OutputDebugStringAppender appends log events to the - OutputDebugString system. - - - The string is passed to the native OutputDebugString - function. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Write the logging event to the output debug string API - - the event to log - - - Write the logging event to the output debug string API - - - - - - Stub for OutputDebugString native method - - the string to output - - - Stub for OutputDebugString native method - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Logs events to a remote syslog daemon. - - - - The BSD syslog protocol is used to remotely log to - a syslog daemon. The syslogd listens for for messages - on UDP port 514. - - - The syslog UDP protocol is not authenticated. Most syslog daemons - do not accept remote log messages because of the security implications. - You may be able to use the LocalSyslogAppender to talk to a local - syslog service. - - - There is an RFC 3164 that claims to document the BSD Syslog Protocol. - This RFC can be seen here: http://www.faqs.org/rfcs/rfc3164.html. - This appender generates what the RFC calls an "Original Device Message", - i.e. does not include the TIMESTAMP or HOSTNAME fields. By observation - this format of message will be accepted by all current syslog daemon - implementations. The daemon will attach the current time and the source - hostname or IP address to any messages received. - - - Syslog messages must have a facility and and a severity. The severity - is derived from the Level of the logging event. - The facility must be chosen from the set of defined syslog - values. The facilities list is predefined - and cannot be extended. - - - An identifier is specified with each log message. This can be specified - by setting the property. The identity (also know - as the tag) must not contain white space. The default value for the - identity is the application name (from ). - - - Rob Lyon - Nicko Cadell - - - - Sends logging events as connectionless UDP datagrams to a remote host or a - multicast group using an . - - - - UDP guarantees neither that messages arrive, nor that they arrive in the correct order. - - - To view the logging results, a custom application can be developed that listens for logging - events. - - - When decoding events send via this appender remember to use the same encoding - to decode the events as was used to send the events. See the - property to specify the encoding to use. - - - - This example shows how to log receive logging events that are sent - on IP address 244.0.0.1 and port 8080 to the console. The event is - encoded in the packet as a unicode string and it is decoded as such. - - IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); - UdpClient udpClient; - byte[] buffer; - string loggingEvent; - - try - { - udpClient = new UdpClient(8080); - - while(true) - { - buffer = udpClient.Receive(ref remoteEndPoint); - loggingEvent = System.Text.Encoding.Unicode.GetString(buffer); - Console.WriteLine(loggingEvent); - } - } - catch(Exception e) - { - Console.WriteLine(e.ToString()); - } - - - Dim remoteEndPoint as IPEndPoint - Dim udpClient as UdpClient - Dim buffer as Byte() - Dim loggingEvent as String - - Try - remoteEndPoint = new IPEndPoint(IPAddress.Any, 0) - udpClient = new UdpClient(8080) - - While True - buffer = udpClient.Receive(ByRef remoteEndPoint) - loggingEvent = System.Text.Encoding.Unicode.GetString(buffer) - Console.WriteLine(loggingEvent) - Wend - Catch e As Exception - Console.WriteLine(e.ToString()) - End Try - - - An example configuration section to log information using this appender to the - IP 224.0.0.1 on port 8080: - - - - - - - - - - Gert Driesen - Nicko Cadell - - - - Initializes a new instance of the class. - - - The default constructor initializes all fields to their default values. - - - - - Initialize the appender based on the options set. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - The appender will be ignored if no was specified or - an invalid remote or local TCP port number was specified. - - - The required property was not specified. - The TCP port number assigned to or is less than or greater than . - - - - This method is called by the method. - - The event to log. - - - Sends the event using an UDP datagram. - - - Exceptions are passed to the . - - - - - - Closes the UDP connection and releases all resources associated with - this instance. - - - - Disables the underlying and releases all managed - and unmanaged resources associated with the . - - - - - - Initializes the underlying connection. - - - - The underlying is initialized and binds to the - port number from which you intend to communicate. - - - Exceptions are passed to the . - - - - - - The IP address of the remote host or multicast group to which - the logging event will be sent. - - - - - The TCP port number of the remote host or multicast group to - which the logging event will be sent. - - - - - The cached remote endpoint to which the logging events will be sent. - - - - - The TCP port number from which the will communicate. - - - - - The instance that will be used for sending the - logging events. - - - - - The encoding to use for the packet. - - - - - Gets or sets the IP address of the remote host or multicast group to which - the underlying should sent the logging event. - - - The IP address of the remote host or multicast group to which the logging event - will be sent. - - - - Multicast addresses are identified by IP class D addresses (in the range 224.0.0.0 to - 239.255.255.255). Multicast packets can pass across different networks through routers, so - it is possible to use multicasts in an Internet scenario as long as your network provider - supports multicasting. - - - Hosts that want to receive particular multicast messages must register their interest by joining - the multicast group. Multicast messages are not sent to networks where no host has joined - the multicast group. Class D IP addresses are used for multicast groups, to differentiate - them from normal host addresses, allowing nodes to easily detect if a message is of interest. - - - Static multicast addresses that are needed globally are assigned by IANA. A few examples are listed in the table below: - - - - - IP Address - Description - - - 224.0.0.1 - - - Sends a message to all system on the subnet. - - - - - 224.0.0.2 - - - Sends a message to all routers on the subnet. - - - - - 224.0.0.12 - - - The DHCP server answers messages on the IP address 224.0.0.12, but only on a subnet. - - - - - - - A complete list of actually reserved multicast addresses and their owners in the ranges - defined by RFC 3171 can be found at the IANA web site. - - - The address range 239.0.0.0 to 239.255.255.255 is reserved for administrative scope-relative - addresses. These addresses can be reused with other local groups. Routers are typically - configured with filters to prevent multicast traffic in this range from flowing outside - of the local network. - - - - - - Gets or sets the TCP port number of the remote host or multicast group to which - the underlying should sent the logging event. - - - An integer value in the range to - indicating the TCP port number of the remote host or multicast group to which the logging event - will be sent. - - - The underlying will send messages to this TCP port number - on the remote host or multicast group. - - The value specified is less than or greater than . - - - - Gets or sets the TCP port number from which the underlying will communicate. - - - An integer value in the range to - indicating the TCP port number from which the underlying will communicate. - - - - The underlying will bind to this port for sending messages. - - - Setting the value to 0 (the default) will cause the udp client not to bind to - a local port. - - - The value specified is less than or greater than . - - - - Gets or sets used to write the packets. - - - The used to write the packets. - - - - The used to write the packets. - - - - - - Gets or sets the underlying . - - - The underlying . - - - creates a to send logging events - over a network. Classes deriving from can use this - property to get or set this . Use the underlying - returned from if you require access beyond that which - provides. - - - - - Gets or sets the cached remote endpoint to which the logging events should be sent. - - - The cached remote endpoint to which the logging events will be sent. - - - The method will initialize the remote endpoint - with the values of the and - properties. - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Syslog port 514 - - - - - Initializes a new instance of the class. - - - This instance of the class is set up to write - to a remote syslog daemon. - - - - - Add a mapping of level to severity - - The mapping to add - - - Add a mapping to this appender. - - - - - - This method is called by the method. - - The event to log. - - - Writes the event to a remote syslog daemon. - - - The format of the output will depend on the appender's layout. - - - - - - Initialize the options for this appender - - - - Initialize the level to syslog severity mappings set on this appender. - - - - - - Translates a log4net level to a syslog severity. - - A log4net level. - A syslog severity. - - - Translates a log4net level to a syslog severity. - - - - - - Generate a syslog priority. - - The syslog facility. - The syslog severity. - A syslog priority. - - - Generate a syslog priority. - - - - - - The facility. The default facility is . - - - - - The message identity - - - - - Mapping from level object to syslog severity - - - - - Message identity - - - - An identifier is specified with each log message. This can be specified - by setting the property. The identity (also know - as the tag) must not contain white space. The default value for the - identity is the application name (from ). - - - - - - Syslog facility - - - Set to one of the values. The list of - facilities is predefined and cannot be extended. The default value - is . - - - - - syslog severities - - - - The syslog severities. - - - - - - system is unusable - - - - - action must be taken immediately - - - - - critical conditions - - - - - error conditions - - - - - warning conditions - - - - - normal but significant condition - - - - - informational - - - - - debug-level messages - - - - - syslog facilities - - - - The syslog facilities - - - - - - kernel messages - - - - - random user-level messages - - - - - mail system - - - - - system daemons - - - - - security/authorization messages - - - - - messages generated internally by syslogd - - - - - line printer subsystem - - - - - network news subsystem - - - - - UUCP subsystem - - - - - clock (cron/at) daemon - - - - - security/authorization messages (private) - - - - - ftp daemon - - - - - NTP subsystem - - - - - log audit - - - - - log alert - - - - - clock daemon - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - reserved for local use - - - - - A class to act as a mapping between the level that a logging call is made at and - the syslog severity that is should be logged at. - - - - A class to act as a mapping between the level that a logging call is made at and - the syslog severity that is should be logged at. - - - - - - The mapped syslog severity for the specified level - - - - Required property. - The mapped syslog severity for the specified level - - - - - - Delivers logging events to a remote logging sink. - - - - This Appender is designed to deliver events to a remote sink. - That is any object that implements the - interface. It delivers the events using .NET remoting. The - object to deliver events to is specified by setting the - appenders property. - - The RemotingAppender buffers events before sending them. This allows it to - make more efficient use of the remoting infrastructure. - - Once the buffer is full the events are still not sent immediately. - They are scheduled to be sent using a pool thread. The effect is that - the send occurs asynchronously. This is very important for a - number of non obvious reasons. The remoting infrastructure will - flow thread local variables (stored in the ), - if they are marked as , across the - remoting boundary. If the server is not contactable then - the remoting infrastructure will clear the - objects from the . To prevent a logging failure from - having side effects on the calling application the remoting call must be made - from a separate thread to the one used by the application. A - thread is used for this. If no thread is available then - the events will block in the thread pool manager until a thread is available. - - Because the events are sent asynchronously using pool threads it is possible to close - this appender before all the queued events have been sent. - When closing the appender attempts to wait until all the queued events have been sent, but - this will timeout after 30 seconds regardless. - - If this appender is being closed because the - event has fired it may not be possible to send all the queued events. During process - exit the runtime limits the time that a - event handler is allowed to run for. If the runtime terminates the threads before - the queued events have been sent then they will be lost. To ensure that all events - are sent the appender must be closed before the application exits. See - for details on how to shutdown - log4net programmatically. - - - Nicko Cadell - Gert Driesen - Daniel Cazzulino - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Send the contents of the buffer to the remote sink. - - - The events are not sent immediately. They are scheduled to be sent - using a pool thread. The effect is that the send occurs asynchronously. - This is very important for a number of non obvious reasons. The remoting - infrastructure will flow thread local variables (stored in the ), - if they are marked as , across the - remoting boundary. If the server is not contactable then - the remoting infrastructure will clear the - objects from the . To prevent a logging failure from - having side effects on the calling application the remoting call must be made - from a separate thread to the one used by the application. A - thread is used for this. If no thread is available then - the events will block in the thread pool manager until a thread is available. - - The events to send. - - - - Override base class close. - - - - This method waits while there are queued work items. The events are - sent asynchronously using work items. These items - will be sent once a thread pool thread is available to send them, therefore - it is possible to close the appender before all the queued events have been - sent. - - This method attempts to wait until all the queued events have been sent, but this - method will timeout after 30 seconds regardless. - - If the appender is being closed because the - event has fired it may not be possible to send all the queued events. During process - exit the runtime limits the time that a - event handler is allowed to run for. - - - - - A work item is being queued into the thread pool - - - - - A work item from the thread pool has completed - - - - - Send the contents of the buffer to the remote sink. - - - This method is designed to be used with the . - This method expects to be passed an array of - objects in the state param. - - the logging events to send - - - - The URL of the remote sink. - - - - - The local proxy (.NET remoting) for the remote logging sink. - - - - - The number of queued callbacks currently waiting or executing - - - - - Event used to signal when there are no queued work items - - - This event is set when there are no queued work items. In this - state it is safe to close the appender. - - - - - Gets or sets the URL of the well-known object that will accept - the logging events. - - - The well-known URL of the remote sink. - - - - The URL of the remoting sink that will accept logging events. - The sink must implement the - interface. - - - - - - Interface used to deliver objects to a remote sink. - - - This interface must be implemented by a remoting sink - if the is to be used - to deliver logging events to the sink. - - - - - Delivers logging events to the remote sink - - Array of events to log. - - - Delivers logging events to the remote sink - - - - - - Appender that rolls log files based on size or date or both. - - - - RollingFileAppender can roll log files based on size or date or both - depending on the setting of the property. - When set to the log file will be rolled - once its size exceeds the . - When set to the log file will be rolled - once the date boundary specified in the property - is crossed. - When set to the log file will be - rolled once the date boundary specified in the property - is crossed, but within a date boundary the file will also be rolled - once its size exceeds the . - When set to the log file will be rolled when - the appender is configured. This effectively means that the log file can be - rolled once per program execution. - - - A of few additional optional features have been added: - - Attach date pattern for current log file - Backup number increments for newer files - Infinite number of backups by file size - - - - - - For large or infinite numbers of backup files a - greater than zero is highly recommended, otherwise all the backup files need - to be renamed each time a new backup is created. - - - When Date/Time based rolling is used setting - to will reduce the number of file renamings to few or none. - - - - - - Changing or without clearing - the log file directory of backup files will cause unexpected and unwanted side effects. - - - - - If Date/Time based rolling is enabled this appender will attempt to roll existing files - in the directory without a Date/Time tag based on the last write date of the base log file. - The appender only rolls the log file when a message is logged. If Date/Time based rolling - is enabled then the appender will not roll the log file at the Date/Time boundary but - at the point when the next message is logged after the boundary has been crossed. - - - - The extends the and - has the same behavior when opening the log file. - The appender will first try to open the file for writing when - is called. This will typically be during configuration. - If the file cannot be opened for writing the appender will attempt - to open the file again each time a message is logged to the appender. - If the file cannot be opened for writing when a message is logged then - the message will be discarded by this appender. - - - When rolling a backup file necessitates deleting an older backup file the - file to be deleted is moved to a temporary name before being deleted. - - - - - A maximum number of backup files when rolling on date/time boundaries is not supported. - - - - Nicko Cadell - Gert Driesen - Aspi Havewala - Douglas de la Torre - Edward Smit - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Sets the quiet writer being used. - - - This method can be overridden by sub classes. - - the writer to set - - - - Write out a logging event. - - the event to write to file. - - - Handles append time behavior for RollingFileAppender. This checks - if a roll over either by date (checked first) or time (checked second) - is need and then appends to the file last. - - - - - - Write out an array of logging events. - - the events to write to file. - - - Handles append time behavior for RollingFileAppender. This checks - if a roll over either by date (checked first) or time (checked second) - is need and then appends to the file last. - - - - - - Performs any required rolling before outputting the next event - - - - Handles append time behavior for RollingFileAppender. This checks - if a roll over either by date (checked first) or time (checked second) - is need and then appends to the file last. - - - - - - Creates and opens the file for logging. If - is false then the fully qualified name is determined and used. - - the name of the file to open - true to append to existing file - - This method will ensure that the directory structure - for the specified exists. - - - - - Get the current output file name - - the base file name - the output file name - - The output file name is based on the base fileName specified. - If is set then the output - file name is the same as the base file passed in. Otherwise - the output file depends on the date pattern, on the count - direction or both. - - - - - Determines curSizeRollBackups (only within the current roll point) - - - - - Generates a wildcard pattern that can be used to find all files - that are similar to the base file name. - - - - - - - Builds a list of filenames for all files matching the base filename plus a file - pattern. - - - - - - - Initiates a roll over if needed for crossing a date boundary since the last run. - - - - - Initializes based on existing conditions at time of . - - - - Initializes based on existing conditions at time of . - The following is done - - determine curSizeRollBackups (only within the current roll point) - initiates a roll over if needed for crossing a date boundary since the last run. - - - - - - - Does the work of bumping the 'current' file counter higher - to the highest count when an incremental file name is seen. - The highest count is either the first file (when count direction - is greater than 0) or the last file (when count direction less than 0). - In either case, we want to know the highest count that is present. - - - - - - - Takes a list of files and a base file name, and looks for - 'incremented' versions of the base file. Bumps the max - count up to the highest count seen. - - - - - - - Calculates the RollPoint for the datePattern supplied. - - the date pattern to calculate the check period for - The RollPoint that is most accurate for the date pattern supplied - - Essentially the date pattern is examined to determine what the - most suitable roll point is. The roll point chosen is the roll point - with the smallest period that can be detected using the date pattern - supplied. i.e. if the date pattern only outputs the year, month, day - and hour then the smallest roll point that can be detected would be - and hourly roll point as minutes could not be detected. - - - - - Initialize the appender based on the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - Sets initial conditions including date/time roll over information, first check, - scheduledFilename, and calls to initialize - the current number of backups. - - - - - - Rollover the file(s) to date/time tagged file(s). - - set to true if the file to be rolled is currently open - - - Rollover the file(s) to date/time tagged file(s). - Resets curSizeRollBackups. - If fileIsOpen is set then the new file is opened (through SafeOpenFile). - - - - - - Renames file to file . - - Name of existing file to roll. - New name for file. - - - Renames file to file . It - also checks for existence of target file and deletes if it does. - - - - - - Test if a file exists at a specified path - - the path to the file - true if the file exists - - - Test if a file exists at a specified path - - - - - - Deletes the specified file if it exists. - - The file to delete. - - - Delete a file if is exists. - The file is first moved to a new filename then deleted. - This allows the file to be removed even when it cannot - be deleted, but it still can be moved. - - - - - - Implements file roll base on file size. - - - - If the maximum number of size based backups is reached - (curSizeRollBackups == maxSizeRollBackups) then the oldest - file is deleted -- its index determined by the sign of countDirection. - If countDirection < 0, then files - {File.1, ..., File.curSizeRollBackups -1} - are renamed to {File.2, ..., - File.curSizeRollBackups}. Moreover, File is - renamed File.1 and closed. - - - A new file is created to receive further log output. - - - If maxSizeRollBackups is equal to zero, then the - File is truncated with no backup files created. - - - If maxSizeRollBackups < 0, then File is - renamed if needed and no files are deleted. - - - - - - Implements file roll. - - the base name to rename - - - If the maximum number of size based backups is reached - (curSizeRollBackups == maxSizeRollBackups) then the oldest - file is deleted -- its index determined by the sign of countDirection. - If countDirection < 0, then files - {File.1, ..., File.curSizeRollBackups -1} - are renamed to {File.2, ..., - File.curSizeRollBackups}. - - - If maxSizeRollBackups is equal to zero, then the - File is truncated with no backup files created. - - - If maxSizeRollBackups < 0, then File is - renamed if needed and no files are deleted. - - - This is called by to rename the files. - - - - - - Get the start time of the next window for the current rollpoint - - the current date - the type of roll point we are working with - the start time for the next roll point an interval after the currentDateTime date - - - Returns the date of the next roll point after the currentDateTime date passed to the method. - - - The basic strategy is to subtract the time parts that are less significant - than the rollpoint from the current time. This should roll the time back to - the start of the time window for the current rollpoint. Then we add 1 window - worth of time and get the start time of the next window for the rollpoint. - - - - - - This object supplies the current date/time. Allows test code to plug in - a method to control this class when testing date/time based rolling. - - - - - The date pattern. By default, the pattern is set to ".yyyy-MM-dd" - meaning daily rollover. - - - - - The actual formatted filename that is currently being written to - or will be the file transferred to on roll over - (based on staticLogFileName). - - - - - The timestamp when we shall next recompute the filename. - - - - - Holds date of last roll over - - - - - The type of rolling done - - - - - The default maximum file size is 10MB - - - - - There is zero backup files by default - - - - - How many sized based backups have been made so far - - - - - The rolling file count direction. - - - - - The rolling mode used in this appender. - - - - - Cache flag set if we are rolling by date. - - - - - Cache flag set if we are rolling by size. - - - - - Value indicating whether to always log to the same file. - - - - - FileName provided in configuration. Used for rolling properly - - - - - The 1st of January 1970 in UTC - - - - - Gets or sets the date pattern to be used for generating file names - when rolling over on date. - - - The date pattern to be used for generating file names when rolling - over on date. - - - - Takes a string in the same format as expected by - . - - - This property determines the rollover schedule when rolling over - on date. - - - - - - Gets or sets the maximum number of backup files that are kept before - the oldest is erased. - - - The maximum number of backup files that are kept before the oldest is - erased. - - - - If set to zero, then there will be no backup files and the log file - will be truncated when it reaches . - - - If a negative number is supplied then no deletions will be made. Note - that this could result in very slow performance as a large number of - files are rolled over unless is used. - - - The maximum applies to each time based group of files and - not the total. - - - - - - Gets or sets the maximum size that the output file is allowed to reach - before being rolled over to backup files. - - - The maximum size in bytes that the output file is allowed to reach before being - rolled over to backup files. - - - - This property is equivalent to except - that it is required for differentiating the setter taking a - argument from the setter taking a - argument. - - - The default maximum file size is 10MB (10*1024*1024). - - - - - - Gets or sets the maximum size that the output file is allowed to reach - before being rolled over to backup files. - - - The maximum size that the output file is allowed to reach before being - rolled over to backup files. - - - - This property allows you to specify the maximum size with the - suffixes "KB", "MB" or "GB" so that the size is interpreted being - expressed respectively in kilobytes, megabytes or gigabytes. - - - For example, the value "10KB" will be interpreted as 10240 bytes. - - - The default maximum file size is 10MB. - - - If you have the option to set the maximum file size programmatically - consider using the property instead as this - allows you to set the size in bytes as a . - - - - - - Gets or sets the rolling file count direction. - - - The rolling file count direction. - - - - Indicates if the current file is the lowest numbered file or the - highest numbered file. - - - By default newer files have lower numbers ( < 0), - i.e. log.1 is most recent, log.5 is the 5th backup, etc... - - - >= 0 does the opposite i.e. - log.1 is the first backup made, log.5 is the 5th backup made, etc. - For infinite backups use >= 0 to reduce - rollover costs. - - The default file count direction is -1. - - - - - Gets or sets the rolling style. - - The rolling style. - - - The default rolling style is . - - - When set to this appender's - property is set to false, otherwise - the appender would append to a single file rather than rolling - the file each time it is opened. - - - - - - Gets or sets a value indicating whether to always log to - the same file. - - - true if always should be logged to the same file, otherwise false. - - - - By default file.log is always the current file. Optionally - file.log.yyyy-mm-dd for current formatted datePattern can by the currently - logging file (or file.log.curSizeRollBackup or even - file.log.yyyy-mm-dd.curSizeRollBackup). - - - This will make time based rollovers with a large number of backups - much faster as the appender it won't have to rename all the backups! - - - - - - Style of rolling to use - - - - Style of rolling to use - - - - - - Roll files once per program execution - - - - Roll files once per program execution. - Well really once each time this appender is - configured. - - - Setting this option also sets AppendToFile to - false on the RollingFileAppender, otherwise - this appender would just be a normal file appender. - - - - - - Roll files based only on the size of the file - - - - - Roll files based only on the date - - - - - Roll files based on both the size and date of the file - - - - - The code assumes that the following 'time' constants are in a increasing sequence. - - - - The code assumes that the following 'time' constants are in a increasing sequence. - - - - - - Roll the log not based on the date - - - - - Roll the log for each minute - - - - - Roll the log for each hour - - - - - Roll the log twice a day (midday and midnight) - - - - - Roll the log each day (midnight) - - - - - Roll the log each week - - - - - Roll the log each month - - - - - This interface is used to supply Date/Time information to the . - - - This interface is used to supply Date/Time information to the . - Used primarily to allow test classes to plug themselves in so they can - supply test date/times. - - - - - Gets the current time. - - The current time. - - - Gets the current time. - - - - - - Default implementation of that returns the current time. - - - - - Gets the current time. - - The current time. - - - Gets the current time. - - - - - - Send an e-mail when a specific logging event occurs, typically on errors - or fatal errors. - - - - The number of logging events delivered in this e-mail depend on - the value of option. The - keeps only the last - logging events in its - cyclic buffer. This keeps memory requirements at a reasonable level while - still delivering useful application context. - - - Authentication and setting the server Port are only available on the MS .NET 1.1 runtime. - For these features to be enabled you need to ensure that you are using a version of - the log4net assembly that is built against the MS .NET 1.1 framework and that you are - running the your application on the MS .NET 1.1 runtime. On all other platforms only sending - unauthenticated messages to a server listening on port 25 (the default) is supported. - - - Authentication is supported by setting the property to - either or . - If using authentication then the - and properties must also be set. - - - To set the SMTP server port use the property. The default port is 25. - - - Nicko Cadell - Gert Driesen - - - - Default constructor - - - - Default constructor - - - - - - Sends the contents of the cyclic buffer as an e-mail message. - - The logging events to send. - - - - Send the email message - - the body text to include in the mail - - - - Gets or sets a semicolon-delimited list of recipient e-mail addresses. - - - A semicolon-delimited list of e-mail addresses. - - - - A semicolon-delimited list of recipient e-mail addresses. - - - - - - Gets or sets the e-mail address of the sender. - - - The e-mail address of the sender. - - - - The e-mail address of the sender. - - - - - - Gets or sets the subject line of the e-mail message. - - - The subject line of the e-mail message. - - - - The subject line of the e-mail message. - - - - - - Gets or sets the name of the SMTP relay mail server to use to send - the e-mail messages. - - - The name of the e-mail relay server. If SmtpServer is not set, the - name of the local SMTP server is used. - - - - The name of the e-mail relay server. If SmtpServer is not set, the - name of the local SMTP server is used. - - - - - - Obsolete - - - Use the BufferingAppenderSkeleton Fix methods instead - - - - Obsolete property. - - - - - - The mode to use to authentication with the SMTP server - - - Authentication is only available on the MS .NET 1.1 runtime. - - Valid Authentication mode values are: , - , and . - The default value is . When using - you must specify the - and to use to authenticate. - When using the Windows credentials for the current - thread, if impersonating, or the process will be used to authenticate. - - - - - - The username to use to authenticate with the SMTP server - - - Authentication is only available on the MS .NET 1.1 runtime. - - A and must be specified when - is set to , - otherwise the username will be ignored. - - - - - - The password to use to authenticate with the SMTP server - - - Authentication is only available on the MS .NET 1.1 runtime. - - A and must be specified when - is set to , - otherwise the password will be ignored. - - - - - - The port on which the SMTP server is listening - - - Server Port is only available on the MS .NET 1.1 runtime. - - The port on which the SMTP server is listening. The default - port is 25. The Port can only be changed when running on - the MS .NET 1.1 runtime. - - - - - - Gets or sets the priority of the e-mail message - - - One of the values. - - - - Sets the priority of the e-mails generated by this - appender. The default priority is . - - - If you are using this appender to report errors then - you may want to set the priority to . - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Values for the property. - - - - SMTP authentication modes. - - - - - - No authentication - - - - - Basic authentication. - - - Requires a username and password to be supplied - - - - - Integrated authentication - - - Uses the Windows credentials from the current thread or process to authenticate. - - - - - Send an email when a specific logging event occurs, typically on errors - or fatal errors. Rather than sending via smtp it writes a file into the - directory specified by . This allows services such - as the IIS SMTP agent to manage sending the messages. - - - - The configuration for this appender is identical to that of the SMTPAppender, - except that instead of specifying the SMTPAppender.SMTPHost you specify - . - - - The number of logging events delivered in this e-mail depend on - the value of option. The - keeps only the last - logging events in its - cyclic buffer. This keeps memory requirements at a reasonable level while - still delivering useful application context. - - - Niall Daley - Nicko Cadell - - - - Default constructor - - - - Default constructor - - - - - - Sends the contents of the cyclic buffer as an e-mail message. - - The logging events to send. - - - Sends the contents of the cyclic buffer as an e-mail message. - - - - - - Activate the options on this appender. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Convert a path into a fully qualified path. - - The path to convert. - The fully qualified path. - - - Converts the path specified to a fully - qualified path. If the path is relative it is - taken as relative from the application base - directory. - - - - - - The security context to use for privileged calls - - - - - Gets or sets a semicolon-delimited list of recipient e-mail addresses. - - - A semicolon-delimited list of e-mail addresses. - - - - A semicolon-delimited list of e-mail addresses. - - - - - - Gets or sets the e-mail address of the sender. - - - The e-mail address of the sender. - - - - The e-mail address of the sender. - - - - - - Gets or sets the subject line of the e-mail message. - - - The subject line of the e-mail message. - - - - The subject line of the e-mail message. - - - - - - Gets or sets the path to write the messages to. - - - - Gets or sets the path to write the messages to. This should be the same - as that used by the agent sending the messages. - - - - - - Gets or sets the used to write to the pickup directory. - - - The used to write to the pickup directory. - - - - Unless a specified here for this appender - the is queried for the - security context to use. The default behavior is to use the security context - of the current thread. - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Appender that allows clients to connect via Telnet to receive log messages - - - - The TelnetAppender accepts socket connections and streams logging messages - back to the client. - The output is provided in a telnet-friendly way so that a log can be monitored - over a TCP/IP socket. - This allows simple remote monitoring of application logging. - - - The default is 23 (the telnet port). - - - Keith Long - Nicko Cadell - - - - Default constructor - - - - Default constructor - - - - - - Overrides the parent method to close the socket handler - - - - Closes all the outstanding connections. - - - - - - Initialize the appender based on the options set. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - Create the socket handler and wait for connections - - - - - - Writes the logging event to each connected client. - - The event to log. - - - Writes the logging event to each connected client. - - - - - - Gets or sets the TCP port number on which this will listen for connections. - - - An integer value in the range to - indicating the TCP port number on which this will listen for connections. - - - - The default value is 23 (the telnet port). - - - The value specified is less than - or greater than . - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Helper class to manage connected clients - - - - The SocketHandler class is used to accept connections from - clients. It is threaded so that clients can connect/disconnect - asynchronously. - - - - - - Opens a new server port on - - the local port to listen on for connections - - - Creates a socket handler on the specified local server port. - - - - - - Sends a string message to each of the connected clients - - the text to send - - - Sends a string message to each of the connected clients - - - - - - Add a client to the internal clients list - - client to add - - - - Remove a client from the internal clients list - - client to remove - - - - Callback used to accept a connection on the server socket - - The result of the asynchronous operation - - - On connection adds to the list of connections - if there are two many open connections you will be disconnected - - - - - - Close all network connections - - - - Make sure we close all network connections - - - - - - Test if this handler has active connections - - - true if this handler has active connections - - - - This property will be true while this handler has - active connections, that is at least one connection that - the handler will attempt to send a message to. - - - - - - Class that represents a client connected to this handler - - - - Class that represents a client connected to this handler - - - - - - Create this for the specified - - the client's socket - - - Opens a stream writer on the socket. - - - - - - Write a string to the client - - string to send - - - Write a string to the client - - - - - - Cleanup the clients connection - - - - Close the socket connection. - - - - - - Appends log events to the system. - - - - The application configuration file can be used to control what listeners - are actually used. See the MSDN documentation for the - class for details on configuring the - trace system. - - - Events are written using the System.Diagnostics.Trace.Write(string,string) - method. The event's logger name is passed as the value for the category name to the Write method. - - - Compact Framework
- The Compact Framework does not support the - class for any operation except Assert. When using the Compact Framework this - appender will write to the system rather than - the Trace system. This appender will therefore behave like the . -
-
- Douglas de la Torre - Nicko Cadell - Gert Driesen -
- - - Initializes a new instance of the . - - - - Default constructor. - - - - - - Initializes a new instance of the - with a specified layout. - - The layout to use with this appender. - - - Obsolete constructor. - - - - - - Writes the logging event to the system. - - The event to log. - - - Writes the logging event to the system. - - - - - - Immediate flush means that the underlying writer or output stream - will be flushed at the end of each append operation. - - - - Immediate flush is slower but ensures that each append request is - actually written. If is set to - false, then there is a good chance that the last few - logs events are not actually written to persistent media if and - when the application crashes. - - - The default value is true. - - - - - Gets or sets a value that indicates whether the appender will - flush at the end of each write. - - - The default behavior is to flush at the end of each - write. If the option is set tofalse, then the underlying - stream can defer writing to physical medium to a later time. - - - Avoiding the flush operation at the end of each append results - in a performance gain of 10 to 20 percent. However, there is safety - trade-off involved in skipping flushing. Indeed, when flushing is - skipped, then it is likely that the last few log events will not - be recorded on disk when the application exits. This is a high - price to pay even for a 20% performance gain. - - - - - - This appender requires a to be set. - - true - - - This appender requires a to be set. - - - - - - Assembly level attribute that specifies a domain to alias to this assembly's repository. - - - - AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. - - - An assembly's logger repository is defined by its , - however this can be overridden by an assembly loaded before the target assembly. - - - An assembly can alias another assembly's domain to its repository by - specifying this attribute with the name of the target domain. - - - This attribute can only be specified on the assembly and may be used - as many times as necessary to alias all the required domains. - - - Nicko Cadell - Gert Driesen - - - - Assembly level attribute that specifies a repository to alias to this assembly's repository. - - - - An assembly's logger repository is defined by its , - however this can be overridden by an assembly loaded before the target assembly. - - - An assembly can alias another assembly's repository to its repository by - specifying this attribute with the name of the target repository. - - - This attribute can only be specified on the assembly and may be used - as many times as necessary to alias all the required repositories. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class with - the specified repository to alias to this assembly's repository. - - The repository to alias to this assemby's repository. - - - Initializes a new instance of the class with - the specified repository to alias to this assembly's repository. - - - - - - Gets or sets the repository to alias to this assemby's repository. - - - The repository to alias to this assemby's repository. - - - - The name of the repository to alias to this assemby's repository. - - - - - - Initializes a new instance of the class with - the specified domain to alias to this assembly's repository. - - The domain to alias to this assemby's repository. - - - Obsolete. Use instead of . - - - - - - Use this class to quickly configure a . - - - - Allows very simple programmatic configuration of log4net. - - - Only one appender can be configured using this configurator. - The appender is set at the root of the hierarchy and all logging - events will be delivered to that appender. - - - Appenders can also implement the interface. Therefore - they would require that the method - be called after the appenders properties have been configured. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - Initializes the log4net system with a default configuration. - - - - Initializes the log4net logging system using a - that will write to Console.Out. The log messages are - formatted using the layout object - with the - layout style. - - - - - - Initializes the log4net system using the specified appender. - - The appender to use to log all logging events. - - - Initializes the log4net system using the specified appender. - - - - - - Initializes the with a default configuration. - - The repository to configure. - - - Initializes the specified repository using a - that will write to Console.Out. The log messages are - formatted using the layout object - with the - layout style. - - - - - - Initializes the using the specified appender. - - The repository to configure. - The appender to use to log all logging events. - - - Initializes the using the specified appender. - - - - - - Base class for all log4net configuration attributes. - - - This is an abstract class that must be extended by - specific configurators. This attribute allows the - configurator to be parameterized by an assembly level - attribute. - - Nicko Cadell - Gert Driesen - - - - Constructor used by subclasses. - - the ordering priority for this configurator - - - The is used to order the configurator - attributes before they are invoked. Higher priority configurators are executed - before lower priority ones. - - - - - - Configures the for the specified assembly. - - The assembly that this attribute was defined on. - The repository to configure. - - - Abstract method implemented by a subclass. When this method is called - the subclass should configure the . - - - - - - Compare this instance to another ConfiguratorAttribute - - the object to compare to - see - - - Compares the priorities of the two instances. - Sorts by priority in descending order. Objects with the same priority are - randomly ordered. - - - - - - Assembly level attribute that specifies the logging domain for the assembly. - - - - DomainAttribute is obsolete. Use RepositoryAttribute instead of DomainAttribute. - - - Assemblies are mapped to logging domains. Each domain has its own - logging repository. This attribute specified on the assembly controls - the configuration of the domain. The property specifies the name - of the domain that this assembly is a part of. The - specifies the type of the repository objects to create for the domain. If - this attribute is not specified and a is not specified - then the assembly will be part of the default shared logging domain. - - - This attribute can only be specified on the assembly and may only be used - once per assembly. - - - Nicko Cadell - Gert Driesen - - - - Assembly level attribute that specifies the logging repository for the assembly. - - - - Assemblies are mapped to logging repository. This attribute specified - on the assembly controls - the configuration of the repository. The property specifies the name - of the repository that this assembly is a part of. The - specifies the type of the object - to create for the assembly. If this attribute is not specified or a - is not specified then the assembly will be part of the default shared logging repository. - - - This attribute can only be specified on the assembly and may only be used - once per assembly. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Initialize a new instance of the class - with the name of the repository. - - The name of the repository. - - - Initialize the attribute with the name for the assembly's repository. - - - - - - Gets or sets the name of the logging repository. - - - The string name to use as the name of the repository associated with this - assembly. - - - - This value does not have to be unique. Several assemblies can share the - same repository. They will share the logging configuration of the repository. - - - - - - Gets or sets the type of repository to create for this assembly. - - - The type of repository to create for this assembly. - - - - The type of the repository to create for the assembly. - The type must implement the - interface. - - - This will be the type of repository created when - the repository is created. If multiple assemblies reference the - same repository then the repository is only created once using the - of the first assembly to call into the - repository. - - - - - - Initializes a new instance of the class. - - - - Obsolete. Use RepositoryAttribute instead of DomainAttribute. - - - - - - Initialize a new instance of the class - with the name of the domain. - - The name of the domain. - - - Obsolete. Use RepositoryAttribute instead of DomainAttribute. - - - - - - Use this class to initialize the log4net environment using an Xml tree. - - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - Configures a using an Xml tree. - - - Nicko Cadell - Gert Driesen - - - - Private constructor - - - - - Automatically configures the log4net system based on the - application's configuration settings. - - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - Each application has a configuration file. This has the - same name as the application with '.config' appended. - This file is XML and calling this function prompts the - configurator to look in that file for a section called - log4net that contains the configuration data. - - - - - Automatically configures the using settings - stored in the application's configuration file. - - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - Each application has a configuration file. This has the - same name as the application with '.config' appended. - This file is XML and calling this function prompts the - configurator to look in that file for a section called - log4net that contains the configuration data. - - The repository to configure. - - - - Configures log4net using a log4net element - - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - Loads the log4net configuration from the XML element - supplied as . - - The element to parse. - - - - Configures the using the specified XML - element. - - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - Loads the log4net configuration from the XML element - supplied as . - - The repository to configure. - The element to parse. - - - - Configures log4net using the specified configuration file. - - The XML file to load the configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the log4net configuration data. - - - The log4net configuration file can possible be specified in the application's - configuration file (either MyAppName.exe.config for a - normal application on Web.config for an ASP.NET application). - - - The following example configures log4net using a configuration file, of which the - location is stored in the application's configuration file : - - - using log4net.Config; - using System.IO; - using System.Configuration; - - ... - - DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); - - - In the .config file, the path to the log4net can be specified like this : - - - - - - - - - - - - - Configures log4net using the specified configuration file. - - A stream to load the XML configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the log4net configuration data. - - - Note that this method will NOT close the stream parameter. - - - - - - Configures the using the specified configuration - file. - - The repository to configure. - The XML file to load the configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The log4net configuration file can possible be specified in the application's - configuration file (either MyAppName.exe.config for a - normal application on Web.config for an ASP.NET application). - - - The following example configures log4net using a configuration file, of which the - location is stored in the application's configuration file : - - - using log4net.Config; - using System.IO; - using System.Configuration; - - ... - - DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); - - - In the .config file, the path to the log4net can be specified like this : - - - - - - - - - - - - - Configures the using the specified configuration - file. - - The repository to configure. - The stream to load the XML configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - Note that this method will NOT close the stream parameter. - - - - - - Configures log4net using the file specified, monitors the file for changes - and reloads the configuration if a change is detected. - - The XML file to load the configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The configuration file will be monitored using a - and depends on the behavior of that class. - - - For more information on how to configure log4net using - a separate configuration file, see . - - - - - - - Configures the using the file specified, - monitors the file for changes and reloads the configuration if a change - is detected. - - The repository to configure. - The XML file to load the configuration from. - - - DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The configuration file will be monitored using a - and depends on the behavior of that class. - - - For more information on how to configure log4net using - a separate configuration file, see . - - - - - - - Assembly level attribute to configure the . - - - - AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. - - - This attribute may only be used at the assembly scope and can only - be used once per assembly. - - - Use this attribute to configure the - without calling one of the - methods. - - - Nicko Cadell - Gert Driesen - - - - Assembly level attribute to configure the . - - - - This attribute may only be used at the assembly scope and can only - be used once per assembly. - - - Use this attribute to configure the - without calling one of the - methods. - - - If neither of the or - properties are set the configuration is loaded from the application's .config file. - If set the property takes priority over the - property. The property - specifies a path to a file to load the config from. The path is relative to the - application's base directory; . - The property is used as a postfix to the assembly file name. - The config file must be located in the application's base directory; . - For example in a console application setting the to - config has the same effect as not specifying the or - properties. - - - The property can be set to cause the - to watch the configuration file for changes. - - - - Log4net will only look for assembly level configuration attributes once. - When using the log4net assembly level attributes to control the configuration - of log4net you must ensure that the first call to any of the - methods is made from the assembly with the configuration - attributes. - - - If you cannot guarantee the order in which log4net calls will be made from - different assemblies you must use programmatic configuration instead, i.e. - call the method directly. - - - - Nicko Cadell - Gert Driesen - - - - Default constructor - - - - Default constructor - - - - - - Configures the for the specified assembly. - - The assembly that this attribute was defined on. - The repository to configure. - - - Configure the repository using the . - The specified must extend the - class otherwise the will not be able to - configure it. - - - The does not extend . - - - - Attempt to load configuration from the local file system - - The assembly that this attribute was defined on. - The repository to configure. - - - - Configure the specified repository using a - - The repository to configure. - the FileInfo pointing to the config file - - - - Attempt to load configuration from a URI - - The assembly that this attribute was defined on. - The repository to configure. - - - - Gets or sets the filename of the configuration file. - - - The filename of the configuration file. - - - - If specified, this is the name of the configuration file to use with - the . This file path is relative to the - application base directory (). - - - The takes priority over the . - - - - - - Gets or sets the extension of the configuration file. - - - The extension of the configuration file. - - - - If specified this is the extension for the configuration file. - The path to the config file is built by using the application - base directory (), - the assembly file name and the config file extension. - - - If the is set to MyExt then - possible config file names would be: MyConsoleApp.exe.MyExt or - MyClassLibrary.dll.MyExt. - - - The takes priority over the . - - - - - - Gets or sets a value indicating whether to watch the configuration file. - - - true if the configuration should be watched, false otherwise. - - - - If this flag is specified and set to true then the framework - will watch the configuration file and will reload the config each time - the file is modified. - - - The config file can only be watched if it is loaded from local disk. - In a No-Touch (Smart Client) deployment where the application is downloaded - from a web server the config file may not reside on the local disk - and therefore it may not be able to watch it. - - - Watching configuration is not supported on the SSCLI. - - - - - - Class to register for the log4net section of the configuration file - - - The log4net section of the configuration file needs to have a section - handler registered. This is the section handler used. It simply returns - the XML element that is the root of the section. - - - Example of registering the log4net section handler : - - - -
- - - log4net configuration XML goes here - - - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Default constructor. - - - - - - Parses the configuration section. - - The configuration settings in a corresponding parent configuration section. - The configuration context when called from the ASP.NET configuration system. Otherwise, this parameter is reserved and is a null reference. - The for the log4net section. - The for the log4net section. - - - Returns the containing the configuration data, - - - - - - Assembly level attribute that specifies a plugin to attach to - the repository. - - - - Specifies the type of a plugin to create and attach to the - assembly's repository. The plugin type must implement the - interface. - - - Nicko Cadell - Gert Driesen - - - - Interface used to create plugins. - - - - Interface used to create a plugin. - - - Nicko Cadell - Gert Driesen - - - - Creates the plugin object. - - the new plugin instance - - - Create and return a new plugin instance. - - - - - - Initializes a new instance of the class - with the specified type. - - The type name of plugin to create. - - - Create the attribute with the plugin type specified. - - - Where possible use the constructor that takes a . - - - - - - Initializes a new instance of the class - with the specified type. - - The type of plugin to create. - - - Create the attribute with the plugin type specified. - - - - - - Creates the plugin object defined by this attribute. - - - - Creates the instance of the object as - specified by this attribute. - - - The plugin object. - - - - Returns a representation of the properties of this object. - - - - Overrides base class method to - return a representation of the properties of this object. - - - A representation of the properties of this object - - - - Gets or sets the type for the plugin. - - - The type for the plugin. - - - - The type for the plugin. - - - - - - Gets or sets the type name for the plugin. - - - The type name for the plugin. - - - - The type name for the plugin. - - - Where possible use the property instead. - - - - - - Assembly level attribute to configure the . - - - - This attribute may only be used at the assembly scope and can only - be used once per assembly. - - - Use this attribute to configure the - without calling one of the - methods. - - - Nicko Cadell - - - - Construct provider attribute with type specified - - the type of the provider to use - - - The provider specified must subclass the - class. - - - - - - Configures the SecurityContextProvider - - The assembly that this attribute was defined on. - The repository to configure. - - - Creates a provider instance from the specified. - Sets this as the default security context provider . - - - - - - Gets or sets the type of the provider to use. - - - the type of the provider to use. - - - - The provider specified must subclass the - class. - - - - - - Use this class to initialize the log4net environment using an Xml tree. - - - - Configures a using an Xml tree. - - - Nicko Cadell - Gert Driesen - - - - Private constructor - - - - - Automatically configures the log4net system based on the - application's configuration settings. - - - - Each application has a configuration file. This has the - same name as the application with '.config' appended. - This file is XML and calling this function prompts the - configurator to look in that file for a section called - log4net that contains the configuration data. - - - To use this method to configure log4net you must specify - the section - handler for the log4net configuration section. See the - for an example. - - - - - - - Automatically configures the using settings - stored in the application's configuration file. - - - - Each application has a configuration file. This has the - same name as the application with '.config' appended. - This file is XML and calling this function prompts the - configurator to look in that file for a section called - log4net that contains the configuration data. - - - To use this method to configure log4net you must specify - the section - handler for the log4net configuration section. See the - for an example. - - - The repository to configure. - - - - Configures log4net using a log4net element - - - - Loads the log4net configuration from the XML element - supplied as . - - - The element to parse. - - - - Configures the using the specified XML - element. - - - Loads the log4net configuration from the XML element - supplied as . - - The repository to configure. - The element to parse. - - - - Configures log4net using the specified configuration file. - - The XML file to load the configuration from. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the log4net configuration data. - - - The log4net configuration file can possible be specified in the application's - configuration file (either MyAppName.exe.config for a - normal application on Web.config for an ASP.NET application). - - - The first element matching <configuration> will be read as the - configuration. If this file is also a .NET .config file then you must specify - a configuration section for the log4net element otherwise .NET will - complain. Set the type for the section handler to , for example: - - -
- - - - - The following example configures log4net using a configuration file, of which the - location is stored in the application's configuration file : - - - using log4net.Config; - using System.IO; - using System.Configuration; - - ... - - XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); - - - In the .config file, the path to the log4net can be specified like this : - - - - - - - - - - - - - Configures log4net using the specified configuration URI. - - A URI to load the XML configuration from. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the log4net configuration data. - - - The must support the URI scheme specified. - - - - - - Configures log4net using the specified configuration data stream. - - A stream to load the XML configuration from. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the log4net configuration data. - - - Note that this method will NOT close the stream parameter. - - - - - - Configures the using the specified configuration - file. - - The repository to configure. - The XML file to load the configuration from. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The log4net configuration file can possible be specified in the application's - configuration file (either MyAppName.exe.config for a - normal application on Web.config for an ASP.NET application). - - - The first element matching <configuration> will be read as the - configuration. If this file is also a .NET .config file then you must specify - a configuration section for the log4net element otherwise .NET will - complain. Set the type for the section handler to , for example: - - -
- - - - - The following example configures log4net using a configuration file, of which the - location is stored in the application's configuration file : - - - using log4net.Config; - using System.IO; - using System.Configuration; - - ... - - XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); - - - In the .config file, the path to the log4net can be specified like this : - - - - - - - - - - - - - Configures the using the specified configuration - URI. - - The repository to configure. - A URI to load the XML configuration from. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The must support the URI scheme specified. - - - - - - Configures the using the specified configuration - file. - - The repository to configure. - The stream to load the XML configuration from. - - - The configuration data must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - Note that this method will NOT close the stream parameter. - - - - - - Configures log4net using the file specified, monitors the file for changes - and reloads the configuration if a change is detected. - - The XML file to load the configuration from. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The configuration file will be monitored using a - and depends on the behavior of that class. - - - For more information on how to configure log4net using - a separate configuration file, see . - - - - - - - Configures the using the file specified, - monitors the file for changes and reloads the configuration if a change - is detected. - - The repository to configure. - The XML file to load the configuration from. - - - The configuration file must be valid XML. It must contain - at least one element called log4net that holds - the configuration data. - - - The configuration file will be monitored using a - and depends on the behavior of that class. - - - For more information on how to configure log4net using - a separate configuration file, see . - - - - - - - Configures the specified repository using a log4net element. - - The hierarchy to configure. - The element to parse. - - - Loads the log4net configuration from the XML element - supplied as . - - - This method is ultimately called by one of the Configure methods - to load the configuration from an . - - - - - - Class used to watch config files. - - - - Uses the to monitor - changes to a specified file. Because multiple change notifications - may be raised when the file is modified, a timer is used to - compress the notifications into a single event. The timer - waits for time before delivering - the event notification. If any further - change notifications arrive while the timer is waiting it - is reset and waits again for to - elapse. - - - - - - The default amount of time to wait after receiving notification - before reloading the config file. - - - - - Watch a specified config file used to configure a repository - - The repository to configure. - The configuration file to watch. - - - Watch a specified config file used to configure a repository - - - - - - Holds the FileInfo used to configure the XmlConfigurator - - - - - Holds the repository being configured. - - - - - The timer used to compress the notification events. - - - - - Initializes a new instance of the class. - - The repository to configure. - The configuration file to watch. - - - Initializes a new instance of the class. - - - - - - Event handler used by . - - The firing the event. - The argument indicates the file that caused the event to be fired. - - - This handler reloads the configuration from the file when the event is fired. - - - - - - Event handler used by . - - The firing the event. - The argument indicates the file that caused the event to be fired. - - - This handler reloads the configuration from the file when the event is fired. - - - - - - Called by the timer when the configuration has been updated. - - null - - - - The implementation of the interface suitable - for use with the compact framework - - - - This implementation is a simple - mapping between repository name and - object. - - - The .NET Compact Framework 1.0 does not support retrieving assembly - level attributes therefore unlike the DefaultRepositorySelector - this selector does not examine the calling assembly for attributes. - - - Nicko Cadell - - - - Interface used by the to select the . - - - - The uses a - to specify the policy for selecting the correct - to return to the caller. - - - Nicko Cadell - Gert Driesen - - - - Gets the for the specified assembly. - - The assembly to use to lookup to the - The for the assembly. - - - Gets the for the specified assembly. - - - How the association between and - is made is not defined. The implementation may choose any method for - this association. The results of this method must be repeatable, i.e. - when called again with the same arguments the result must be the - save value. - - - - - - Gets the named . - - The name to use to lookup to the . - The named - - Lookup a named . This is the repository created by - calling . - - - - - Creates a new repository for the assembly specified. - - The assembly to use to create the domain to associate with the . - The type of repository to create, must implement . - The repository created. - - - The created will be associated with the domain - specified such that a call to with the - same assembly specified will return the same repository instance. - - - How the association between and - is made is not defined. The implementation may choose any method for - this association. - - - - - - Creates a new repository with the name specified. - - The name to associate with the . - The type of repository to create, must implement . - The repository created. - - - The created will be associated with the name - specified such that a call to with the - same name will return the same repository instance. - - - - - - Test if a named repository exists - - the named repository to check - true if the repository exists - - - Test if a named repository exists. Use - to create a new repository and to retrieve - a repository. - - - - - - Gets an array of all currently defined repositories. - - - An array of the instances created by - this . - - - Gets an array of all of the repositories created by this selector. - - - - - - Event to notify that a logger repository has been created. - - - Event to notify that a logger repository has been created. - - - - Event raised when a new repository is created. - The event source will be this selector. The event args will - be a which - holds the newly created . - - - - - - Create a new repository selector - - the type of the repositories to create, must implement - - - Create an new compact repository selector. - The default type for repositories must be specified, - an appropriate value would be . - - - throw if is null - throw if does not implement - - - - Get the for the specified assembly - - not used - The default - - - The argument is not used. This selector does not create a - separate repository for each assembly. - - - As a named repository is not specified the default repository is - returned. The default repository is named log4net-default-repository. - - - - - - Get the named - - the name of the repository to lookup - The named - - - Get the named . The default - repository is log4net-default-repository. Other repositories - must be created using the . - If the named repository does not exist an exception is thrown. - - - throw if is null - throw if the does not exist - - - - Create a new repository for the assembly specified - - not used - the type of repository to create, must implement - the repository created - - - The argument is not used. This selector does not create a - separate repository for each assembly. - - - If the is null then the - default repository type specified to the constructor is used. - - - As a named repository is not specified the default repository is - returned. The default repository is named log4net-default-repository. - - - - - - Create a new repository for the repository specified - - the repository to associate with the - the type of repository to create, must implement . - If this param is null then the default repository type is used. - the repository created - - - The created will be associated with the repository - specified such that a call to with the - same repository specified will return the same repository instance. - - - If the named repository already exists an exception will be thrown. - - - If is null then the default - repository type specified to the constructor is used. - - - throw if is null - throw if the already exists - - - - Test if a named repository exists - - the named repository to check - true if the repository exists - - - Test if a named repository exists. Use - to create a new repository and to retrieve - a repository. - - - - - - Gets a list of objects - - an array of all known objects - - - Gets an array of all of the repositories created by this selector. - - - - - - Notify the registered listeners that the repository has been created - - The repository that has been created - - - Raises the LoggerRepositoryCreatedEvent - event. - - - - - - Event to notify that a logger repository has been created. - - - Event to notify that a logger repository has been created. - - - - Event raised when a new repository is created. - The event source will be this selector. The event args will - be a which - holds the newly created . - - - - - - The default implementation of the interface. - - - - Uses attributes defined on the calling assembly to determine how to - configure the hierarchy for the repository. - - - Nicko Cadell - Gert Driesen - - - - Creates a new repository selector. - - The type of the repositories to create, must implement - - - Create an new repository selector. - The default type for repositories must be specified, - an appropriate value would be . - - - is . - does not implement . - - - - Gets the for the specified assembly. - - The assembly use to lookup the . - - - The type of the created and the repository - to create can be overridden by specifying the - attribute on the . - - - The default values are to use the - implementation of the interface and to use the - as the name of the repository. - - - The created will be automatically configured using - any attributes defined on - the . - - - The for the assembly - is . - - - - Gets the for the specified repository. - - The repository to use to lookup the . - The for the specified repository. - - - Returns the named repository. If is null - a is thrown. If the repository - does not exist a is thrown. - - - Use to create a repository. - - - is . - does not exist. - - - - Create a new repository for the assembly specified - - the assembly to use to create the repository to associate with the . - The type of repository to create, must implement . - The repository created. - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - The type of the created and - the repository to create can be overridden by specifying the - attribute on the - . The default values are to use the - implementation of the - interface and to use the - as the name of the repository. - - - The created will be automatically - configured using any - attributes defined on the . - - - If a repository for the already exists - that repository will be returned. An error will not be raised and that - repository may be of a different type to that specified in . - Also the attribute on the - assembly may be used to override the repository type specified in - . - - - is . - - - - Creates a new repository for the assembly specified. - - the assembly to use to create the repository to associate with the . - The type of repository to create, must implement . - The name to assign to the created repository - Set to true to read and apply the assembly attributes - The repository created. - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - The type of the created and - the repository to create can be overridden by specifying the - attribute on the - . The default values are to use the - implementation of the - interface and to use the - as the name of the repository. - - - The created will be automatically - configured using any - attributes defined on the . - - - If a repository for the already exists - that repository will be returned. An error will not be raised and that - repository may be of a different type to that specified in . - Also the attribute on the - assembly may be used to override the repository type specified in - . - - - is . - - - - Creates a new repository for the specified repository. - - The repository to associate with the . - The type of repository to create, must implement . - If this param is then the default repository type is used. - The new repository. - - - The created will be associated with the repository - specified such that a call to with the - same repository specified will return the same repository instance. - - - is . - already exists. - - - - Test if a named repository exists - - the named repository to check - true if the repository exists - - - Test if a named repository exists. Use - to create a new repository and to retrieve - a repository. - - - - - - Gets a list of objects - - an array of all known objects - - - Gets an array of all of the repositories created by this selector. - - - - - - Aliases a repository to an existing repository. - - The repository to alias. - The repository that the repository is aliased to. - - - The repository specified will be aliased to the repository when created. - The repository must not already exist. - - - When the repository is created it must utilize the same repository type as - the repository it is aliased to, otherwise the aliasing will fail. - - - - is . - -or- - is . - - - - - Notifies the registered listeners that the repository has been created. - - The repository that has been created. - - - Raises the event. - - - - - - Gets the repository name and repository type for the specified assembly. - - The assembly that has a . - in/out param to hold the repository name to use for the assembly, caller should set this to the default value before calling. - in/out param to hold the type of the repository to create for the assembly, caller should set this to the default value before calling. - is . - - - - Configures the repository using information from the assembly. - - The assembly containing - attributes which define the configuration for the repository. - The repository to configure. - - is . - -or- - is . - - - - - Loads the attribute defined plugins on the assembly. - - The assembly that contains the attributes. - The repository to add the plugins to. - - is . - -or- - is . - - - - - Loads the attribute defined aliases on the assembly. - - The assembly that contains the attributes. - The repository to alias to. - - is . - -or- - is . - - - - - Event to notify that a logger repository has been created. - - - Event to notify that a logger repository has been created. - - - - Event raised when a new repository is created. - The event source will be this selector. The event args will - be a which - holds the newly created . - - - - - - Defined error codes that can be passed to the method. - - - - Values passed to the method. - - - Nicko Cadell - - - - A general error - - - - - Error while writing output - - - - - Failed to flush file - - - - - Failed to close file - - - - - Unable to open output file - - - - - No layout specified - - - - - Failed to parse address - - - - - Appenders may delegate their error handling to an . - - - - Error handling is a particularly tedious to get right because by - definition errors are hard to predict and to reproduce. - - - Nicko Cadell - Gert Driesen - - - - Handles the error and information about the error condition is passed as - a parameter. - - The message associated with the error. - The that was thrown when the error occurred. - The error code associated with the error. - - - Handles the error and information about the error condition is passed as - a parameter. - - - - - - Prints the error message passed as a parameter. - - The message associated with the error. - The that was thrown when the error occurred. - - - See . - - - - - - Prints the error message passed as a parameter. - - The message associated with the error. - - - See . - - - - - - Interface for objects that require fixing. - - - - Interface that indicates that the object requires fixing before it - can be taken outside the context of the appender's - method. - - - When objects that implement this interface are stored - in the context properties maps - and - are fixed - (see ) the - method will be called. - - - Nicko Cadell - - - - Get a portable version of this object - - the portable instance of this object - - - Get a portable instance object that represents the current - state of this object. The portable object can be stored - and logged from any thread with identical results. - - - - - - Interface that all loggers implement - - - - This interface supports logging events and testing if a level - is enabled for logging. - - - These methods will not throw exceptions. Note to implementor, ensure - that the implementation of these methods cannot allow an exception - to be thrown to the caller. - - - Nicko Cadell - Gert Driesen - - - - This generic form is intended to be used by wrappers. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The level of the message to be logged. - The message object to log. - the exception to log, including its stack trace. Pass null to not log an exception. - - - Generates a logging event for the specified using - the and . - - - - - - This is the most generic printing method that is intended to be used - by wrappers. - - The event being logged. - - - Logs the specified logging event through this logger. - - - - - - Checks if this logger is enabled for a given passed as parameter. - - The level to check. - - true if this logger is enabled for level, otherwise false. - - - - Test if this logger is going to log events of the specified . - - - - - - Gets the name of the logger. - - - The name of the logger. - - - - The name of this logger - - - - - - Gets the where this - Logger instance is attached to. - - - The that this logger belongs to. - - - - Gets the where this - Logger instance is attached to. - - - - - - Base interface for all wrappers - - - - Base interface for all wrappers. - - - All wrappers must implement this interface. - - - Nicko Cadell - - - - Get the implementation behind this wrapper object. - - - The object that in implementing this object. - - - - The object that in implementing this - object. The Logger object may not - be the same object as this object because of logger decorators. - This gets the actual underlying objects that is used to process - the log events. - - - - - - Delegate used to handle logger repository creation event notifications - - The which created the repository. - The event args - that holds the instance that has been created. - - - Delegate used to handle logger repository creation event notifications. - - - - - - Provides data for the event. - - - - A - event is raised every time a is created. - - - - - - The created - - - - - Construct instance using specified - - the that has been created - - - Construct instance using specified - - - - - - The that has been created - - - The that has been created - - - - The that has been created - - - - - - Test if an triggers an action - - - - Implementations of this interface allow certain appenders to decide - when to perform an appender specific action. - - - The action or behavior triggered is defined by the implementation. - - - Nicko Cadell - - - - Test if this event triggers the action - - The event to check - true if this event triggers the action, otherwise false - - - Return true if this event triggers the action - - - - - - Defines the default set of levels recognized by the system. - - - - Each has an associated . - - - Levels have a numeric that defines the relative - ordering between levels. Two Levels with the same - are deemed to be equivalent. - - - The levels that are recognized by log4net are set for each - and each repository can have different levels defined. The levels are stored - in the on the repository. Levels are - looked up by name from the . - - - When logging at level INFO the actual level used is not but - the value of LoggerRepository.LevelMap["INFO"]. The default value for this is - , but this can be changed by reconfiguring the level map. - - - Each level has a in addition to its . The - is the string that is written into the output log. By default - the display name is the same as the level name, but this can be used to alias levels - or to localize the log output. - - - Some of the predefined levels recognized by the system are: - - - - . - - - . - - - . - - - . - - - . - - - . - - - . - - - - Nicko Cadell - Gert Driesen - - - - Constructor - - Integer value for this level, higher values represent more severe levels. - The string name of this level. - The display name for this level. This may be localized or otherwise different from the name - - - Initializes a new instance of the class with - the specified level name and value. - - - - - - Constructor - - Integer value for this level, higher values represent more severe levels. - The string name of this level. - - - Initializes a new instance of the class with - the specified level name and value. - - - - - - Returns the representation of the current - . - - - A representation of the current . - - - - Returns the level . - - - - - - Compares levels. - - The object to compare against. - true if the objects are equal. - - - Compares the levels of instances, and - defers to base class if the target object is not a - instance. - - - - - - Returns a hash code - - A hash code for the current . - - - Returns a hash code suitable for use in hashing algorithms and data - structures like a hash table. - - - Returns the hash code of the level . - - - - - - Compares this instance to a specified object and returns an - indication of their relative values. - - A instance or to compare with this instance. - - A 32-bit signed integer that indicates the relative order of the - values compared. The return value has these meanings: - - - Value - Meaning - - - Less than zero - This instance is less than . - - - Zero - This instance is equal to . - - - Greater than zero - - This instance is greater than . - -or- - is . - - - - - - - must be an instance of - or ; otherwise, an exception is thrown. - - - is not a . - - - - Returns a value indicating whether a specified - is greater than another specified . - - A - A - - true if is greater than - ; otherwise, false. - - - - Compares two levels. - - - - - - Returns a value indicating whether a specified - is less than another specified . - - A - A - - true if is less than - ; otherwise, false. - - - - Compares two levels. - - - - - - Returns a value indicating whether a specified - is greater than or equal to another specified . - - A - A - - true if is greater than or equal to - ; otherwise, false. - - - - Compares two levels. - - - - - - Returns a value indicating whether a specified - is less than or equal to another specified . - - A - A - - true if is less than or equal to - ; otherwise, false. - - - - Compares two levels. - - - - - - Returns a value indicating whether two specified - objects have the same value. - - A or . - A or . - - true if the value of is the same as the - value of ; otherwise, false. - - - - Compares two levels. - - - - - - Returns a value indicating whether two specified - objects have different values. - - A or . - A or . - - true if the value of is different from - the value of ; otherwise, false. - - - - Compares two levels. - - - - - - Compares two specified instances. - - The first to compare. - The second to compare. - - A 32-bit signed integer that indicates the relative order of the - two values compared. The return value has these meanings: - - - Value - Meaning - - - Less than zero - is less than . - - - Zero - is equal to . - - - Greater than zero - is greater than . - - - - - - Compares two levels. - - - - - - The level designates a higher level than all the rest. - - - - - The level designates very severe error events. - System unusable, emergencies. - - - - - The level designates very severe error events - that will presumably lead the application to abort. - - - - - The level designates very severe error events. - Take immediate action, alerts. - - - - - The level designates very severe error events. - Critical condition, critical. - - - - - The level designates very severe error events. - - - - - The level designates error events that might - still allow the application to continue running. - - - - - The level designates potentially harmful - situations. - - - - - The level designates informational messages - that highlight the progress of the application at the highest level. - - - - - The level designates informational messages that - highlight the progress of the application at coarse-grained level. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates fine-grained informational - events that are most useful to debug an application. - - - - - The level designates the lowest level possible. - - - - - Gets the name of this level. - - - The name of this level. - - - - Gets the name of this level. - - - - - - Gets the value of this level. - - - The value of this level. - - - - Gets the value of this level. - - - - - - Gets the display name of this level. - - - The display name of this level. - - - - Gets the display name of this level. - - - - - - A strongly-typed collection of objects. - - Nicko Cadell - - - - Creates a read-only wrapper for a LevelCollection instance. - - list to create a readonly wrapper arround - - A LevelCollection wrapper that is read-only. - - - - - Initializes a new instance of the LevelCollection class - that is empty and has the default initial capacity. - - - - - Initializes a new instance of the LevelCollection class - that has the specified initial capacity. - - - The number of elements that the new LevelCollection is initially capable of storing. - - - - - Initializes a new instance of the LevelCollection class - that contains elements copied from the specified LevelCollection. - - The LevelCollection whose elements are copied to the new collection. - - - - Initializes a new instance of the LevelCollection class - that contains elements copied from the specified array. - - The array whose elements are copied to the new list. - - - - Initializes a new instance of the LevelCollection class - that contains elements copied from the specified collection. - - The collection whose elements are copied to the new list. - - - - Allow subclasses to avoid our default constructors - - - - - - Copies the entire LevelCollection to a one-dimensional - array. - - The one-dimensional array to copy to. - - - - Copies the entire LevelCollection to a one-dimensional - array, starting at the specified index of the target array. - - The one-dimensional array to copy to. - The zero-based index in at which copying begins. - - - - Adds a to the end of the LevelCollection. - - The to be added to the end of the LevelCollection. - The index at which the value has been added. - - - - Removes all elements from the LevelCollection. - - - - - Creates a shallow copy of the . - - A new with a shallow copy of the collection data. - - - - Determines whether a given is in the LevelCollection. - - The to check for. - true if is found in the LevelCollection; otherwise, false. - - - - Returns the zero-based index of the first occurrence of a - in the LevelCollection. - - The to locate in the LevelCollection. - - The zero-based index of the first occurrence of - in the entire LevelCollection, if found; otherwise, -1. - - - - - Inserts an element into the LevelCollection at the specified index. - - The zero-based index at which should be inserted. - The to insert. - - is less than zero - -or- - is equal to or greater than . - - - - - Removes the first occurrence of a specific from the LevelCollection. - - The to remove from the LevelCollection. - - The specified was not found in the LevelCollection. - - - - - Removes the element at the specified index of the LevelCollection. - - The zero-based index of the element to remove. - - is less than zero - -or- - is equal to or greater than . - - - - - Returns an enumerator that can iterate through the LevelCollection. - - An for the entire LevelCollection. - - - - Adds the elements of another LevelCollection to the current LevelCollection. - - The LevelCollection whose elements should be added to the end of the current LevelCollection. - The new of the LevelCollection. - - - - Adds the elements of a array to the current LevelCollection. - - The array whose elements should be added to the end of the LevelCollection. - The new of the LevelCollection. - - - - Adds the elements of a collection to the current LevelCollection. - - The collection whose elements should be added to the end of the LevelCollection. - The new of the LevelCollection. - - - - Sets the capacity to the actual number of elements. - - - - - is less than zero - -or- - is equal to or greater than . - - - - - is less than zero - -or- - is equal to or greater than . - - - - - Gets the number of elements actually contained in the LevelCollection. - - - - - Gets a value indicating whether access to the collection is synchronized (thread-safe). - - true if access to the ICollection is synchronized (thread-safe); otherwise, false. - - - - Gets an object that can be used to synchronize access to the collection. - - - - - Gets or sets the at the specified index. - - The zero-based index of the element to get or set. - - is less than zero - -or- - is equal to or greater than . - - - - - Gets a value indicating whether the collection has a fixed size. - - true if the collection has a fixed size; otherwise, false. The default is false - - - - Gets a value indicating whether the IList is read-only. - - true if the collection is read-only; otherwise, false. The default is false - - - - Gets or sets the number of elements the LevelCollection can contain. - - - - - Supports type-safe iteration over a . - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - - - Type visible only to our subclasses - Used to access protected constructor - - - - - A value - - - - - Supports simple iteration over a . - - - - - Initializes a new instance of the Enumerator class. - - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - - - An evaluator that triggers at a threshold level - - - - This evaluator will trigger if the level of the event - passed to - is equal to or greater than the - level. - - - Nicko Cadell - - - - The threshold for triggering - - - - - Create a new evaluator using the threshold. - - - - Create a new evaluator using the threshold. - - - This evaluator will trigger if the level of the event - passed to - is equal to or greater than the - level. - - - - - - Create a new evaluator using the specified threshold. - - the threshold to trigger at - - - Create a new evaluator using the specified threshold. - - - This evaluator will trigger if the level of the event - passed to - is equal to or greater than the - level. - - - - - - Is this the triggering event? - - The event to check - This method returns true, if the event level - is equal or higher than the . - Otherwise it returns false - - - This evaluator will trigger if the level of the event - passed to - is equal to or greater than the - level. - - - - - - the threshold to trigger at - - - The that will cause this evaluator to trigger - - - - This evaluator will trigger if the level of the event - passed to - is equal to or greater than the - level. - - - - - - Mapping between string name and Level object - - - - Mapping between string name and object. - This mapping is held separately for each . - The level name is case insensitive. - - - Nicko Cadell - - - - Mapping from level name to Level object. The - level name is case insensitive - - - - - Construct the level map - - - - Construct the level map. - - - - - - Clear the internal maps of all levels - - - - Clear the internal maps of all levels - - - - - - Create a new Level and add it to the map - - the string to display for the Level - the level value to give to the Level - - - Create a new Level and add it to the map - - - - - - - Create a new Level and add it to the map - - the string to display for the Level - the level value to give to the Level - the display name to give to the Level - - - Create a new Level and add it to the map - - - - - - Add a Level to the map - - the Level to add - - - Add a Level to the map - - - - - - Lookup a named level from the map - - the name of the level to lookup is taken from this level. - If the level is not set on the map then this level is added - the level in the map with the name specified - - - Lookup a named level from the map. The name of the level to lookup is taken - from the property of the - argument. - - - If no level with the specified name is found then the - argument is added to the level map - and returned. - - - - - - Lookup a by name - - The name of the Level to lookup - a Level from the map with the name specified - - - Returns the from the - map with the name specified. If the no level is - found then null is returned. - - - - - - Return all possible levels as a list of Level objects. - - all possible levels as a list of Level objects - - - Return all possible levels as a list of Level objects. - - - - - - The internal representation of caller location information. - - - - This class uses the System.Diagnostics.StackTrace class to generate - a call stack. The caller's information is then extracted from this stack. - - - The System.Diagnostics.StackTrace class is not supported on the - .NET Compact Framework 1.0 therefore caller location information is not - available on that framework. - - - The System.Diagnostics.StackTrace class has this to say about Release builds: - - - "StackTrace information will be most informative with Debug build configurations. - By default, Debug builds include debug symbols, while Release builds do not. The - debug symbols contain most of the file, method name, line number, and column - information used in constructing StackFrame and StackTrace objects. StackTrace - might not report as many method calls as expected, due to code transformations - that occur during optimization." - - - This means that in a Release build the caller information may be incomplete or may - not exist at all! Therefore caller location information cannot be relied upon in a Release build. - - - Nicko Cadell - Gert Driesen - - - - When location information is not available the constant - NA is returned. Current value of this string - constant is ?. - - - - - Constructor - - The declaring type of the method that is - the stack boundary into the logging system for this call. - - - Initializes a new instance of the - class based on the current thread. - - - - - - Constructor - - The fully qualified class name. - The method name. - The file name. - The line number of the method within the file. - - - Initializes a new instance of the - class with the specified data. - - - - - - Gets the fully qualified class name of the caller making the logging - request. - - - The fully qualified class name of the caller making the logging - request. - - - - Gets the fully qualified class name of the caller making the logging - request. - - - - - - Gets the file name of the caller. - - - The file name of the caller. - - - - Gets the file name of the caller. - - - - - - Gets the line number of the caller. - - - The line number of the caller. - - - - Gets the line number of the caller. - - - - - - Gets the method name of the caller. - - - The method name of the caller. - - - - Gets the method name of the caller. - - - - - - Gets all available caller information - - - All available caller information, in the format - fully.qualified.classname.of.caller.methodName(Filename:line) - - - - Gets all available caller information, in the format - fully.qualified.classname.of.caller.methodName(Filename:line) - - - - - - Static manager that controls the creation of repositories - - - - Static manager that controls the creation of repositories - - - This class is used by the wrapper managers (e.g. ) - to provide access to the objects. - - - This manager also holds the that is used to - lookup and create repositories. The selector can be set either programmatically using - the property, or by setting the log4net.RepositorySelector - AppSetting in the applications config file to the fully qualified type name of the - selector to use. - - - Nicko Cadell - Gert Driesen - - - - Private constructor to prevent instances. Only static methods should be used. - - - - Private constructor to prevent instances. Only static methods should be used. - - - - - - Hook the shutdown event - - - - On the full .NET runtime, the static constructor hooks up the - AppDomain.ProcessExit and AppDomain.DomainUnload> events. - These are used to shutdown the log4net system as the application exits. - - - - - - Register for ProcessExit and DomainUnload events on the AppDomain - - - - This needs to be in a separate method because the events make - a LinkDemand for the ControlAppDomain SecurityPermission. Because - this is a LinkDemand it is demanded at JIT time. Therefore we cannot - catch the exception in the method itself, we have to catch it in the - caller. - - - - - - Return the default instance. - - the repository to lookup in - Return the default instance - - - Gets the for the repository specified - by the argument. - - - - - - Returns the default instance. - - The assembly to use to lookup the repository. - The default instance. - - - - Return the default instance. - - the repository to lookup in - Return the default instance - - - Gets the for the repository specified - by the argument. - - - - - - Returns the default instance. - - The assembly to use to lookup the repository. - The default instance. - - - Returns the default instance. - - - - - - Returns the named logger if it exists. - - The repository to lookup in. - The fully qualified logger name to look for. - - The logger found, or null if the named logger does not exist in the - specified repository. - - - - If the named logger exists (in the specified repository) then it - returns a reference to the logger, otherwise it returns - null. - - - - - - Returns the named logger if it exists. - - The assembly to use to lookup the repository. - The fully qualified logger name to look for. - - The logger found, or null if the named logger does not exist in the - specified assembly's repository. - - - - If the named logger exists (in the specified assembly's repository) then it - returns a reference to the logger, otherwise it returns - null. - - - - - - Returns all the currently defined loggers in the specified repository. - - The repository to lookup in. - All the defined loggers. - - - The root logger is not included in the returned array. - - - - - - Returns all the currently defined loggers in the specified assembly's repository. - - The assembly to use to lookup the repository. - All the defined loggers. - - - The root logger is not included in the returned array. - - - - - - Retrieves or creates a named logger. - - The repository to lookup in. - The name of the logger to retrieve. - The logger with the name specified. - - - Retrieves a logger named as the - parameter. If the named logger already exists, then the - existing instance will be returned. Otherwise, a new instance is - created. - - - By default, loggers do not have a set level but inherit - it from the hierarchy. This is one of the central features of - log4net. - - - - - - Retrieves or creates a named logger. - - The assembly to use to lookup the repository. - The name of the logger to retrieve. - The logger with the name specified. - - - Retrieves a logger named as the - parameter. If the named logger already exists, then the - existing instance will be returned. Otherwise, a new instance is - created. - - - By default, loggers do not have a set level but inherit - it from the hierarchy. This is one of the central features of - log4net. - - - - - - Shorthand for . - - The repository to lookup in. - The of which the fullname will be used as the name of the logger to retrieve. - The logger with the name specified. - - - Gets the logger for the fully qualified name of the type specified. - - - - - - Shorthand for . - - the assembly to use to lookup the repository - The of which the fullname will be used as the name of the logger to retrieve. - The logger with the name specified. - - - Gets the logger for the fully qualified name of the type specified. - - - - - - Shuts down the log4net system. - - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in all the - default repositories. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Shuts down the repository for the repository specified. - - The repository to shutdown. - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in the - repository for the specified. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Shuts down the repository for the repository specified. - - The assembly to use to lookup the repository. - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in the - repository for the repository. The repository is looked up using - the specified. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Resets all values contained in this repository instance to their defaults. - - The repository to reset. - - - Resets all values contained in the repository instance to their - defaults. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set its default "off" value. - - - - - - Resets all values contained in this repository instance to their defaults. - - The assembly to use to lookup the repository to reset. - - - Resets all values contained in the repository instance to their - defaults. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set its default "off" value. - - - - - - Creates a repository with the specified name. - - The name of the repository, this must be unique amongst repositories. - The created for the repository. - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - Creates the default type of which is a - object. - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The specified repository already exists. - - - - Creates a repository with the specified name. - - The name of the repository, this must be unique amongst repositories. - The created for the repository. - - - Creates the default type of which is a - object. - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The specified repository already exists. - - - - Creates a repository with the specified name and repository type. - - The name of the repository, this must be unique to the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - The name must be unique. Repositories cannot be redefined. - An Exception will be thrown if the repository already exists. - - - The specified repository already exists. - - - - Creates a repository with the specified name and repository type. - - The name of the repository, this must be unique to the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - The name must be unique. Repositories cannot be redefined. - An Exception will be thrown if the repository already exists. - - - The specified repository already exists. - - - - Creates a repository for the specified assembly and repository type. - - The assembly to use to get the name of the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - - - - Creates a repository for the specified assembly and repository type. - - The assembly to use to get the name of the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - - - - Gets an array of all currently defined repositories. - - An array of all the known objects. - - - Gets an array of all currently defined repositories. - - - - - - Internal method to get pertinent version info. - - A string of version info. - - - - Called when the event fires - - the that is exiting - null - - - Called when the event fires. - - - When the event is triggered the log4net system is . - - - - - - Called when the event fires - - the that is exiting - null - - - Called when the event fires. - - - When the event is triggered the log4net system is . - - - - - - Initialize the default repository selector - - - - - Gets or sets the repository selector used by the . - - - The repository selector used by the . - - - - The repository selector () is used by - the to create and select repositories - (). - - - The caller to supplies either a string name - or an assembly (if not supplied the assembly is inferred using - ). - - - This context is used by the selector to lookup a specific repository. - - - For the full .NET Framework, the default repository is DefaultRepositorySelector; - for the .NET Compact Framework CompactRepositorySelector is the default - repository. - - - - - - Implementation of the interface. - - - - This class should be used as the base for all wrapper implementations. - - - Nicko Cadell - Gert Driesen - - - - Constructs a new wrapper for the specified logger. - - The logger to wrap. - - - Constructs a new wrapper for the specified logger. - - - - - - The logger that this object is wrapping - - - - - Gets the implementation behind this wrapper object. - - - The object that this object is implementing. - - - - The Logger object may not be the same object as this object - because of logger decorators. - - - This gets the actual underlying objects that is used to process - the log events. - - - - - - Portable data structure used by - - - - Portable data structure used by - - - Nicko Cadell - - - - The logger name. - - - - The logger name. - - - - - - Level of logging event. - - - - Level of logging event. Level cannot be Serializable - because it is a flyweight. Due to its special serialization it - cannot be declared final either. - - - - - - The application supplied message. - - - - The application supplied message of logging event. - - - - - - The name of thread - - - - The name of thread in which this logging event was generated - - - - - - The time the event was logged - - - - The TimeStamp is stored in the local time zone for this computer. - - - - - - Location information for the caller. - - - - Location information for the caller. - - - - - - String representation of the user - - - - String representation of the user's windows name, - like DOMAIN\username - - - - - - String representation of the identity. - - - - String representation of the current thread's principal identity. - - - - - - The string representation of the exception - - - - The string representation of the exception - - - - - - String representation of the AppDomain. - - - - String representation of the AppDomain. - - - - - - Additional event specific properties - - - - A logger or an appender may attach additional - properties to specific events. These properties - have a string key and an object value. - - - - - - Flags passed to the property - - - - Flags passed to the property - - - Nicko Cadell - - - - Fix the MDC - - - - - Fix the NDC - - - - - Fix the rendered message - - - - - Fix the thread name - - - - - Fix the callers location information - - - CAUTION: Very slow to generate - - - - - Fix the callers windows user name - - - CAUTION: Slow to generate - - - - - Fix the domain friendly name - - - - - Fix the callers principal name - - - CAUTION: May be slow to generate - - - - - Fix the exception text - - - - - Fix the event properties - - - - - No fields fixed - - - - - All fields fixed - - - - - Partial fields fixed - - - - This set of partial fields gives good performance. The following fields are fixed: - - - - - - - - - - - - - The internal representation of logging events. - - - - When an affirmative decision is made to log then a - instance is created. This instance - is passed around to the different log4net components. - - - This class is of concern to those wishing to extend log4net. - - - Some of the values in instances of - are considered volatile, that is the values are correct at the - time the event is delivered to appenders, but will not be consistent - at any time afterwards. If an event is to be stored and then processed - at a later time these volatile values must be fixed by calling - . There is a performance penalty - for incurred by calling but it - is essential to maintaining data consistency. - - - Nicko Cadell - Gert Driesen - Douglas de la Torre - Daniel Cazzulino - - - - The key into the Properties map for the host name value. - - - - - The key into the Properties map for the thread identity value. - - - - - The key into the Properties map for the user name value. - - - - - Initializes a new instance of the class - from the supplied parameters. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The repository this event is logged in. - The name of the logger of this event. - The level of this event. - The message of this event. - The exception for this event. - - - Except , and , - all fields of LoggingEvent are filled when actually needed. Call - to cache all data locally - to prevent inconsistencies. - - This method is called by the log4net framework - to create a logging event. - - - - - - Initializes a new instance of the class - using specific data. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The repository this event is logged in. - Data used to initialize the logging event. - The fields in the struct that have already been fixed. - - - This constructor is provided to allow a - to be created independently of the log4net framework. This can - be useful if you require a custom serialization scheme. - - - Use the method to obtain an - instance of the class. - - - The parameter should be used to specify which fields in the - struct have been preset. Fields not specified in the - will be captured from the environment if requested or fixed. - - - - - - Initializes a new instance of the class - using specific data. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The repository this event is logged in. - Data used to initialize the logging event. - - - This constructor is provided to allow a - to be created independently of the log4net framework. This can - be useful if you require a custom serialization scheme. - - - Use the method to obtain an - instance of the class. - - - This constructor sets this objects flags to , - this assumes that all the data relating to this event is passed in via the - parameter and no other data should be captured from the environment. - - - - - - Initializes a new instance of the class - using specific data. - - Data used to initialize the logging event. - - - This constructor is provided to allow a - to be created independently of the log4net framework. This can - be useful if you require a custom serialization scheme. - - - Use the method to obtain an - instance of the class. - - - This constructor sets this objects flags to , - this assumes that all the data relating to this event is passed in via the - parameter and no other data should be captured from the environment. - - - - - - Serialization constructor - - The that holds the serialized object data. - The that contains contextual information about the source or destination. - - - Initializes a new instance of the class - with serialized data. - - - - - - Ensure that the repository is set. - - the value for the repository - - - - Write the rendered message to a TextWriter - - the writer to write the message to - - - Unlike the property this method - does store the message data in the internal cache. Therefore - if called only once this method should be faster than the - property, however if the message is - to be accessed multiple times then the property will be more efficient. - - - - - - Serializes this object into the provided. - - The to populate with data. - The destination for this serialization. - - - The data in this event must be fixed before it can be serialized. - - - The method must be called during the - method call if this event - is to be used outside that method. - - - - - - Gets the portable data for this . - - The for this event. - - - A new can be constructed using a - instance. - - - Does a fix of the data - in the logging event before returning the event data. - - - - - - Gets the portable data for this . - - The set of data to ensure is fixed in the LoggingEventData - The for this event. - - - A new can be constructed using a - instance. - - - - - - Returns this event's exception's rendered using the - . - - - This event's exception's rendered using the . - - - - Obsolete. Use instead. - - - - - - Returns this event's exception's rendered using the - . - - - This event's exception's rendered using the . - - - - Returns this event's exception's rendered using the - . - - - - - - Fix instance fields that hold volatile data. - - - - Some of the values in instances of - are considered volatile, that is the values are correct at the - time the event is delivered to appenders, but will not be consistent - at any time afterwards. If an event is to be stored and then processed - at a later time these volatile values must be fixed by calling - . There is a performance penalty - incurred by calling but it - is essential to maintaining data consistency. - - - Calling is equivalent to - calling passing the parameter - false. - - - See for more - information. - - - - - - Fixes instance fields that hold volatile data. - - Set to true to not fix data that takes a long time to fix. - - - Some of the values in instances of - are considered volatile, that is the values are correct at the - time the event is delivered to appenders, but will not be consistent - at any time afterwards. If an event is to be stored and then processed - at a later time these volatile values must be fixed by calling - . There is a performance penalty - for incurred by calling but it - is essential to maintaining data consistency. - - - The param controls the data that - is fixed. Some of the data that can be fixed takes a long time to - generate, therefore if you do not require those settings to be fixed - they can be ignored by setting the param - to true. This setting will ignore the - and settings. - - - Set to false to ensure that all - settings are fixed. - - - - - - Fix the fields specified by the parameter - - the fields to fix - - - Only fields specified in the will be fixed. - Fields will not be fixed if they have previously been fixed. - It is not possible to 'unfix' a field. - - - - - - Lookup a composite property in this event - - the key for the property to lookup - the value for the property - - - This event has composite properties that combine together properties from - several different contexts in the following order: - - - this events properties - - This event has that can be set. These - properties are specific to this event only. - - - - the thread properties - - The that are set on the current - thread. These properties are shared by all events logged on this thread. - - - - the global properties - - The that are set globally. These - properties are shared by all the threads in the AppDomain. - - - - - - - - - Get all the composite properties in this event - - the containing all the properties - - - See for details of the composite properties - stored by the event. - - - This method returns a single containing all the - properties defined for this event. - - - - - - The internal logging event data. - - - - - The internal logging event data. - - - - - The internal logging event data. - - - - - The fully qualified Type of the calling - logger class in the stack frame (i.e. the declaring type of the method). - - - - - The application supplied message of logging event. - - - - - The exception that was thrown. - - - This is not serialized. The string representation - is serialized instead. - - - - - The repository that generated the logging event - - - This is not serialized. - - - - - The fix state for this event - - - These flags indicate which fields have been fixed. - Not serialized. - - - - - Indicated that the internal cache is updateable (ie not fixed) - - - This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler - changes in the caching strategy. - - - - - Gets the time when the current process started. - - - This is the time when this process started. - - - - The TimeStamp is stored in the local time zone for this computer. - - - Tries to get the start time for the current process. - Failing that it returns the time of the first call to - this property. - - - Note that AppDomains may be loaded and unloaded within the - same process without the process terminating and therefore - without the process start time being reset. - - - - - - Gets the of the logging event. - - - The of the logging event. - - - - Gets the of the logging event. - - - - - - Gets the time of the logging event. - - - The time of the logging event. - - - - The TimeStamp is stored in the local time zone for this computer. - - - - - - Gets the name of the logger that logged the event. - - - The name of the logger that logged the event. - - - - Gets the name of the logger that logged the event. - - - - - - Gets the location information for this logging event. - - - The location information for this logging event. - - - - The collected information is cached for future use. - - - See the class for more information on - supported frameworks and the different behavior in Debug and - Release builds. - - - - - - Gets the message object used to initialize this event. - - - The message object used to initialize this event. - - - - Gets the message object used to initialize this event. - Note that this event may not have a valid message object. - If the event is serialized the message object will not - be transferred. To get the text of the message the - property must be used - not this property. - - - If there is no defined message object for this event then - null will be returned. - - - - - - Gets the exception object used to initialize this event. - - - The exception object used to initialize this event. - - - - Gets the exception object used to initialize this event. - Note that this event may not have a valid exception object. - If the event is serialized the exception object will not - be transferred. To get the text of the exception the - method must be used - not this property. - - - If there is no defined exception object for this event then - null will be returned. - - - - - - The that this event was created in. - - - - The that this event was created in. - - - - - - Gets the message, rendered through the . - - - The message rendered through the . - - - - The collected information is cached for future use. - - - - - - Gets the name of the current thread. - - - The name of the current thread, or the thread ID when - the name is not available. - - - - The collected information is cached for future use. - - - - - - Gets the name of the current user. - - - The name of the current user, or NOT AVAILABLE when the - underlying runtime has no support for retrieving the name of the - current user. - - - - Calls WindowsIdentity.GetCurrent().Name to get the name of - the current windows user. - - - To improve performance, we could cache the string representation of - the name, and reuse that as long as the identity stayed constant. - Once the identity changed, we would need to re-assign and re-render - the string. - - - However, the WindowsIdentity.GetCurrent() call seems to - return different objects every time, so the current implementation - doesn't do this type of caching. - - - Timing for these operations: - - - - Method - Results - - - WindowsIdentity.GetCurrent() - 10000 loops, 00:00:00.2031250 seconds - - - WindowsIdentity.GetCurrent().Name - 10000 loops, 00:00:08.0468750 seconds - - - - This means we could speed things up almost 40 times by caching the - value of the WindowsIdentity.GetCurrent().Name property, since - this takes (8.04-0.20) = 7.84375 seconds. - - - - - - Gets the identity of the current thread principal. - - - The string name of the identity of the current thread principal. - - - - Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get - the name of the current thread principal. - - - - - - Gets the AppDomain friendly name. - - - The AppDomain friendly name. - - - - Gets the AppDomain friendly name. - - - - - - Additional event specific properties. - - - Additional event specific properties. - - - - A logger or an appender may attach additional - properties to specific events. These properties - have a string key and an object value. - - - This property is for events that have been added directly to - this event. The aggregate properties (which include these - event properties) can be retrieved using - and . - - - Once the properties have been fixed this property - returns the combined cached properties. This ensures that updates to - this property are always reflected in the underlying storage. When - returning the combined properties there may be more keys in the - Dictionary than expected. - - - - - - The fixed fields in this event - - - The set of fields that are fixed in this event - - - - Fields will not be fixed if they have previously been fixed. - It is not possible to 'unfix' a field. - - - - - - Implementation of wrapper interface. - - - - This implementation of the interface - forwards to the held by the base class. - - - This logger has methods to allow the caller to log at the following - levels: - - - - DEBUG - - The and methods log messages - at the DEBUG level. That is the level with that name defined in the - repositories . The default value - for this level is . The - property tests if this level is enabled for logging. - - - - INFO - - The and methods log messages - at the INFO level. That is the level with that name defined in the - repositories . The default value - for this level is . The - property tests if this level is enabled for logging. - - - - WARN - - The and methods log messages - at the WARN level. That is the level with that name defined in the - repositories . The default value - for this level is . The - property tests if this level is enabled for logging. - - - - ERROR - - The and methods log messages - at the ERROR level. That is the level with that name defined in the - repositories . The default value - for this level is . The - property tests if this level is enabled for logging. - - - - FATAL - - The and methods log messages - at the FATAL level. That is the level with that name defined in the - repositories . The default value - for this level is . The - property tests if this level is enabled for logging. - - - - - The values for these levels and their semantic meanings can be changed by - configuring the for the repository. - - - Nicko Cadell - Gert Driesen - - - - The ILog interface is use by application to log messages into - the log4net framework. - - - - Use the to obtain logger instances - that implement this interface. The - static method is used to get logger instances. - - - This class contains methods for logging at different levels and also - has properties for determining if those logging levels are - enabled in the current configuration. - - - This interface can be implemented in different ways. This documentation - specifies reasonable behavior that a caller can expect from the actual - implementation, however different implementations reserve the right to - do things differently. - - - Simple example of logging messages - - ILog log = LogManager.GetLogger("application-log"); - - log.Info("Application Start"); - log.Debug("This is a debug message"); - - if (log.IsDebugEnabled) - { - log.Debug("This is another debug message"); - } - - - - - Nicko Cadell - Gert Driesen - - - Log a message object with the level. - - Log a message object with the level. - - The message object to log. - - - This method first checks if this logger is DEBUG - enabled by comparing the level of this logger with the - level. If this logger is - DEBUG enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of - the additivity flag. - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - - - - - - Log a message object with the level including - the stack trace of the passed - as a parameter. - - The message object to log. - The exception to log, including its stack trace. - - - See the form for more detailed information. - - - - - - - Log a formatted string with the level. - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - Log a message object with the level. - - Logs a message object with the level. - - - - This method first checks if this logger is INFO - enabled by comparing the level of this logger with the - level. If this logger is - INFO enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of the - additivity flag. - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - The message object to log. - - - - - - Logs a message object with the INFO level including - the stack trace of the passed - as a parameter. - - The message object to log. - The exception to log, including its stack trace. - - - See the form for more detailed information. - - - - - - - Log a formatted message string with the level. - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - Log a message object with the level. - - Log a message object with the level. - - - - This method first checks if this logger is WARN - enabled by comparing the level of this logger with the - level. If this logger is - WARN enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of the - additivity flag. - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - The message object to log. - - - - - - Log a message object with the level including - the stack trace of the passed - as a parameter. - - The message object to log. - The exception to log, including its stack trace. - - - See the form for more detailed information. - - - - - - - Log a formatted message string with the level. - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - Log a message object with the level. - - Logs a message object with the level. - - The message object to log. - - - This method first checks if this logger is ERROR - enabled by comparing the level of this logger with the - level. If this logger is - ERROR enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of the - additivity flag. - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - - - - - - Log a message object with the level including - the stack trace of the passed - as a parameter. - - The message object to log. - The exception to log, including its stack trace. - - - See the form for more detailed information. - - - - - - - Log a formatted message string with the level. - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - Log a message object with the level. - - Log a message object with the level. - - - - This method first checks if this logger is FATAL - enabled by comparing the level of this logger with the - level. If this logger is - FATAL enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of the - additivity flag. - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - The message object to log. - - - - - - Log a message object with the level including - the stack trace of the passed - as a parameter. - - The message object to log. - The exception to log, including its stack trace. - - - See the form for more detailed information. - - - - - - - Log a formatted message string with the level. - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Logs a formatted message string with the level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - - - Checks if this logger is enabled for the level. - - - true if this logger is enabled for events, false otherwise. - - - - This function is intended to lessen the computational cost of - disabled log debug statements. - - For some ILog interface log, when you write: - - log.Debug("This is entry number: " + i ); - - - You incur the cost constructing the message, string construction and concatenation in - this case, regardless of whether the message is logged or not. - - - If you are worried about speed (who isn't), then you should write: - - - if (log.IsDebugEnabled) - { - log.Debug("This is entry number: " + i ); - } - - - This way you will not incur the cost of parameter - construction if debugging is disabled for log. On - the other hand, if the log is debug enabled, you - will incur the cost of evaluating whether the logger is debug - enabled twice. Once in and once in - the . This is an insignificant overhead - since evaluating a logger takes about 1% of the time it - takes to actually log. This is the preferred style of logging. - - Alternatively if your logger is available statically then the is debug - enabled state can be stored in a static variable like this: - - - private static readonly bool isDebugEnabled = log.IsDebugEnabled; - - - Then when you come to log you can write: - - - if (isDebugEnabled) - { - log.Debug("This is entry number: " + i ); - } - - - This way the debug enabled state is only queried once - when the class is loaded. Using a private static readonly - variable is the most efficient because it is a run time constant - and can be heavily optimized by the JIT compiler. - - - Of course if you use a static readonly variable to - hold the enabled state of the logger then you cannot - change the enabled state at runtime to vary the logging - that is produced. You have to decide if you need absolute - speed or runtime flexibility. - - - - - - - - Checks if this logger is enabled for the level. - - - true if this logger is enabled for events, false otherwise. - - - For more information see . - - - - - - - - Checks if this logger is enabled for the level. - - - true if this logger is enabled for events, false otherwise. - - - For more information see . - - - - - - - - Checks if this logger is enabled for the level. - - - true if this logger is enabled for events, false otherwise. - - - For more information see . - - - - - - - - Checks if this logger is enabled for the level. - - - true if this logger is enabled for events, false otherwise. - - - For more information see . - - - - - - - - Construct a new wrapper for the specified logger. - - The logger to wrap. - - - Construct a new wrapper for the specified logger. - - - - - - Virtual method called when the configuration of the repository changes - - the repository holding the levels - - - Virtual method called when the configuration of the repository changes - - - - - - Logs a message object with the DEBUG level. - - The message object to log. - - - This method first checks if this logger is DEBUG - enabled by comparing the level of this logger with the - DEBUG level. If this logger is - DEBUG enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of the - additivity flag. - - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - - - - Logs a message object with the DEBUG level - - The message object to log. - The exception to log, including its stack trace. - - - Logs a message object with the DEBUG level including - the stack trace of the passed - as a parameter. - - - See the form for more detailed information. - - - - - - - Logs a formatted message string with the DEBUG level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the DEBUG level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the DEBUG level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the DEBUG level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the DEBUG level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a message object with the INFO level. - - The message object to log. - - - This method first checks if this logger is INFO - enabled by comparing the level of this logger with the - INFO level. If this logger is - INFO enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger - and also higher in the hierarchy depending on the value of - the additivity flag. - - - WARNING Note that passing an - to this method will print the name of the - but no stack trace. To print a stack trace use the - form instead. - - - - - - Logs a message object with the INFO level. - - The message object to log. - The exception to log, including its stack trace. - - - Logs a message object with the INFO level including - the stack trace of the - passed as a parameter. - - - See the form for more detailed information. - - - - - - - Logs a formatted message string with the INFO level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the INFO level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the INFO level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the INFO level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the INFO level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a message object with the WARN level. - - the message object to log - - - This method first checks if this logger is WARN - enabled by comparing the level of this logger with the - WARN level. If this logger is - WARN enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger and - also higher in the hierarchy depending on the value of the - additivity flag. - - - WARNING Note that passing an to this - method will print the name of the but no - stack trace. To print a stack trace use the - form instead. - - - - - - Logs a message object with the WARN level - - The message object to log. - The exception to log, including its stack trace. - - - Logs a message object with the WARN level including - the stack trace of the - passed as a parameter. - - - See the form for more detailed information. - - - - - - - Logs a formatted message string with the WARN level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the WARN level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the WARN level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the WARN level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the WARN level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a message object with the ERROR level. - - The message object to log. - - - This method first checks if this logger is ERROR - enabled by comparing the level of this logger with the - ERROR level. If this logger is - ERROR enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger and - also higher in the hierarchy depending on the value of the - additivity flag. - - - WARNING Note that passing an to this - method will print the name of the but no - stack trace. To print a stack trace use the - form instead. - - - - - - Logs a message object with the ERROR level - - The message object to log. - The exception to log, including its stack trace. - - - Logs a message object with the ERROR level including - the stack trace of the - passed as a parameter. - - - See the form for more detailed information. - - - - - - - Logs a formatted message string with the ERROR level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the ERROR level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the ERROR level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the ERROR level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the ERROR level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a message object with the FATAL level. - - The message object to log. - - - This method first checks if this logger is FATAL - enabled by comparing the level of this logger with the - FATAL level. If this logger is - FATAL enabled, then it converts the message object - (passed as parameter) to a string by invoking the appropriate - . It then - proceeds to call all the registered appenders in this logger and - also higher in the hierarchy depending on the value of the - additivity flag. - - - WARNING Note that passing an to this - method will print the name of the but no - stack trace. To print a stack trace use the - form instead. - - - - - - Logs a message object with the FATAL level - - The message object to log. - The exception to log, including its stack trace. - - - Logs a message object with the FATAL level including - the stack trace of the - passed as a parameter. - - - See the form for more detailed information. - - - - - - - Logs a formatted message string with the FATAL level. - - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the FATAL level. - - A String containing zero or more format items - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the FATAL level. - - A String containing zero or more format items - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the FATAL level. - - A String containing zero or more format items - An Object to format - An Object to format - An Object to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - The string is formatted using the - format provider. To specify a localized provider use the - method. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Logs a formatted message string with the FATAL level. - - An that supplies culture-specific formatting information - A String containing zero or more format items - An Object array containing zero or more objects to format - - - The message is formatted using the method. See - String.Format for details of the syntax of the format string and the behavior - of the formatting. - - - This method does not take an object to include in the - log event. To pass an use one of the - methods instead. - - - - - - Event handler for the event - - the repository - Empty - - - - The fully qualified name of this declaring type not the type of any subclass. - - - - - Checks if this logger is enabled for the DEBUG - level. - - - true if this logger is enabled for DEBUG events, - false otherwise. - - - - This function is intended to lessen the computational cost of - disabled log debug statements. - - - For some log Logger object, when you write: - - - log.Debug("This is entry number: " + i ); - - - You incur the cost constructing the message, concatenation in - this case, regardless of whether the message is logged or not. - - - If you are worried about speed, then you should write: - - - if (log.IsDebugEnabled()) - { - log.Debug("This is entry number: " + i ); - } - - - This way you will not incur the cost of parameter - construction if debugging is disabled for log. On - the other hand, if the log is debug enabled, you - will incur the cost of evaluating whether the logger is debug - enabled twice. Once in IsDebugEnabled and once in - the Debug. This is an insignificant overhead - since evaluating a logger takes about 1% of the time it - takes to actually log. - - - - - - Checks if this logger is enabled for the INFO level. - - - true if this logger is enabled for INFO events, - false otherwise. - - - - See for more information and examples - of using this method. - - - - - - - Checks if this logger is enabled for the WARN level. - - - true if this logger is enabled for WARN events, - false otherwise. - - - - See for more information and examples - of using this method. - - - - - - - Checks if this logger is enabled for the ERROR level. - - - true if this logger is enabled for ERROR events, - false otherwise. - - - - See for more information and examples of using this method. - - - - - - - Checks if this logger is enabled for the FATAL level. - - - true if this logger is enabled for FATAL events, - false otherwise. - - - - See for more information and examples of using this method. - - - - - - - A SecurityContext used by log4net when interacting with protected resources - - - - A SecurityContext used by log4net when interacting with protected resources - for example with operating system services. This can be used to impersonate - a principal that has been granted privileges on the system resources. - - - Nicko Cadell - - - - Impersonate this SecurityContext - - State supplied by the caller - An instance that will - revoke the impersonation of this SecurityContext, or null - - - Impersonate this security context. Further calls on the current - thread should now be made in the security context provided - by this object. When the result - method is called the security - context of the thread should be reverted to the state it was in - before was called. - - - - - - The providers default instances. - - - - A configured component that interacts with potentially protected system - resources uses a to provide the elevated - privileges required. If the object has - been not been explicitly provided to the component then the component - will request one from this . - - - By default the is - an instance of which returns only - objects. This is a reasonable default - where the privileges required are not know by the system. - - - This default behavior can be overridden by subclassing the - and overriding the method to return - the desired objects. The default provider - can be replaced by programmatically setting the value of the - property. - - - An alternative is to use the log4net.Config.SecurityContextProviderAttribute - This attribute can be applied to an assembly in the same way as the - log4net.Config.XmlConfiguratorAttribute". The attribute takes - the type to use as the as an argument. - - - Nicko Cadell - - - - The default provider - - - - - Protected default constructor to allow subclassing - - - - Protected default constructor to allow subclassing - - - - - - Create a SecurityContext for a consumer - - The consumer requesting the SecurityContext - An impersonation context - - - The default implementation is to return a . - - - Subclasses should override this method to provide their own - behavior. - - - - - - Gets or sets the default SecurityContextProvider - - - The default SecurityContextProvider - - - - The default provider is used by configured components that - require a and have not had one - given to them. - - - By default this is an instance of - that returns objects. - - - The default provider can be set programmatically by setting - the value of this property to a sub class of - that has the desired behavior. - - - - - - Delegate used to handle creation of new wrappers. - - The logger to wrap in a wrapper. - - - Delegate used to handle creation of new wrappers. This delegate - is called from the - method to construct the wrapper for the specified logger. - - - The delegate to use is supplied to the - constructor. - - - - - - Maps between logger objects and wrapper objects. - - - - This class maintains a mapping between objects and - objects. Use the method to - lookup the for the specified . - - - New wrapper instances are created by the - method. The default behavior is for this method to delegate construction - of the wrapper to the delegate supplied - to the constructor. This allows specialization of the behavior without - requiring subclassing of this type. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the - - The handler to use to create the wrapper objects. - - - Initializes a new instance of the class with - the specified handler to create the wrapper objects. - - - - - - Gets the wrapper object for the specified logger. - - The wrapper object for the specified logger - - - If the logger is null then the corresponding wrapper is null. - - - Looks up the wrapper it it has previously been requested and - returns it. If the wrapper has never been requested before then - the virtual method is - called. - - - - - - Creates the wrapper object for the specified logger. - - The logger to wrap in a wrapper. - The wrapper object for the logger. - - - This implementation uses the - passed to the constructor to create the wrapper. This method - can be overridden in a subclass. - - - - - - Called when a monitored repository shutdown event is received. - - The that is shutting down - - - This method is called when a that this - is holding loggers for has signaled its shutdown - event . The default - behavior of this method is to release the references to the loggers - and their wrappers generated for this repository. - - - - - - Event handler for repository shutdown event. - - The sender of the event. - The event args. - - - - Map of logger repositories to hashtables of ILogger to ILoggerWrapper mappings - - - - - The handler to use to create the extension wrapper objects. - - - - - Internal reference to the delegate used to register for repository shutdown events. - - - - - Gets the map of logger repositories. - - - Map of logger repositories. - - - - Gets the hashtable that is keyed on . The - values are hashtables keyed on with the - value being the corresponding . - - - - - - Formats a as "HH:mm:ss,fff". - - - - Formats a in the format "HH:mm:ss,fff" for example, "15:49:37,459". - - - Nicko Cadell - Gert Driesen - - - - Render a as a string. - - - - Interface to abstract the rendering of a - instance into a string. - - - The method is used to render the - date to a text writer. - - - Nicko Cadell - Gert Driesen - - - - Formats the specified date as a string. - - The date to format. - The writer to write to. - - - Format the as a string and write it - to the provided. - - - - - - String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is ABSOLUTE. - - - - - String constant used to specify DateTimeDateFormat in layouts. Current value is DATE. - - - - - String constant used to specify ISO8601DateFormat in layouts. Current value is ISO8601. - - - - - Renders the date into a string. Format is "HH:mm:ss". - - The date to render into a string. - The string builder to write to. - - - Subclasses should override this method to render the date - into a string using a precision up to the second. This method - will be called at most once per second and the result will be - reused if it is needed again during the same second. - - - - - - Renders the date into a string. Format is "HH:mm:ss,fff". - - The date to render into a string. - The writer to write to. - - - Uses the method to generate the - time string up to the seconds and then appends the current - milliseconds. The results from are - cached and is called at most once - per second. - - - Sub classes should override - rather than . - - - - - - Last stored time with precision up to the second. - - - - - Last stored time with precision up to the second, formatted - as a string. - - - - - Last stored time with precision up to the second, formatted - as a string. - - - - - Formats a as "dd MMM yyyy HH:mm:ss,fff" - - - - Formats a in the format - "dd MMM yyyy HH:mm:ss,fff" for example, - "06 Nov 1994 15:49:37,459". - - - Nicko Cadell - Gert Driesen - Angelika Schnagl - - - - Default constructor. - - - - Initializes a new instance of the class. - - - - - - Formats the date without the milliseconds part - - The date to format. - The string builder to write to. - - - Formats a DateTime in the format "dd MMM yyyy HH:mm:ss" - for example, "06 Nov 1994 15:49:37". - - - The base class will append the ",fff" milliseconds section. - This method will only be called at most once per second. - - - - - - The format info for the invariant culture. - - - - - Formats the as "yyyy-MM-dd HH:mm:ss,fff". - - - - Formats the specified as a string: "yyyy-MM-dd HH:mm:ss,fff". - - - Nicko Cadell - Gert Driesen - - - - Default constructor - - - - Initializes a new instance of the class. - - - - - - Formats the date without the milliseconds part - - The date to format. - The string builder to write to. - - - Formats the date specified as a string: "yyyy-MM-dd HH:mm:ss". - - - The base class will append the ",fff" milliseconds section. - This method will only be called at most once per second. - - - - - - Formats the using the method. - - - - Formats the using the method. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - The format string. - - - Initializes a new instance of the class - with the specified format string. - - - The format string must be compatible with the options - that can be supplied to . - - - - - - Formats the date using . - - The date to convert to a string. - The writer to write to. - - - Uses the date format string supplied to the constructor to call - the method to format the date. - - - - - - The format string used to format the . - - - - The format string must be compatible with the options - that can be supplied to . - - - - - - This filter drops all . - - - - You can add this filter to the end of a filter chain to - switch from the default "accept all unless instructed otherwise" - filtering behavior to a "deny all unless instructed otherwise" - behavior. - - - Nicko Cadell - Gert Driesen - - - - Subclass this type to implement customized logging event filtering - - - - Users should extend this class to implement customized logging - event filtering. Note that and - , the parent class of all standard - appenders, have built-in filtering rules. It is suggested that you - first use and understand the built-in rules before rushing to write - your own custom filters. - - - This abstract class assumes and also imposes that filters be - organized in a linear chain. The - method of each filter is called sequentially, in the order of their - addition to the chain. - - - The method must return one - of the integer constants , - or . - - - If the value is returned, then the log event is dropped - immediately without consulting with the remaining filters. - - - If the value is returned, then the next filter - in the chain is consulted. If there are no more filters in the - chain, then the log event is logged. Thus, in the presence of no - filters, the default behavior is to log all logging events. - - - If the value is returned, then the log - event is logged without consulting the remaining filters. - - - The philosophy of log4net filters is largely inspired from the - Linux ipchains. - - - Nicko Cadell - Gert Driesen - - - - Implement this interface to provide customized logging event filtering - - - - Users should implement this interface to implement customized logging - event filtering. Note that and - , the parent class of all standard - appenders, have built-in filtering rules. It is suggested that you - first use and understand the built-in rules before rushing to write - your own custom filters. - - - This abstract class assumes and also imposes that filters be - organized in a linear chain. The - method of each filter is called sequentially, in the order of their - addition to the chain. - - - The method must return one - of the integer constants , - or . - - - If the value is returned, then the log event is dropped - immediately without consulting with the remaining filters. - - - If the value is returned, then the next filter - in the chain is consulted. If there are no more filters in the - chain, then the log event is logged. Thus, in the presence of no - filters, the default behavior is to log all logging events. - - - If the value is returned, then the log - event is logged without consulting the remaining filters. - - - The philosophy of log4net filters is largely inspired from the - Linux ipchains. - - - Nicko Cadell - Gert Driesen - - - - Decide if the logging event should be logged through an appender. - - The LoggingEvent to decide upon - The decision of the filter - - - If the decision is , then the event will be - dropped. If the decision is , then the next - filter, if any, will be invoked. If the decision is then - the event will be logged without consulting with other filters in - the chain. - - - - - - Property to get and set the next filter - - - The next filter in the chain - - - - Filters are typically composed into chains. This property allows the next filter in - the chain to be accessed. - - - - - - Points to the next filter in the filter chain. - - - - See for more information. - - - - - - Initialize the filter with the options set - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - Typically filter's options become active immediately on set, - however this method must still be called. - - - - - - Decide if the should be logged through an appender. - - The to decide upon - The decision of the filter - - - If the decision is , then the event will be - dropped. If the decision is , then the next - filter, if any, will be invoked. If the decision is then - the event will be logged without consulting with other filters in - the chain. - - - This method is marked abstract and must be implemented - in a subclass. - - - - - - Property to get and set the next filter - - - The next filter in the chain - - - - Filters are typically composed into chains. This property allows the next filter in - the chain to be accessed. - - - - - - Default constructor - - - - - Always returns the integer constant - - the LoggingEvent to filter - Always returns - - - Ignores the event being logged and just returns - . This can be used to change the default filter - chain behavior from to . This filter - should only be used as the last filter in the chain - as any further filters will be ignored! - - - - - - The return result from - - - - The return result from - - - - - - The log event must be dropped immediately without - consulting with the remaining filters, if any, in the chain. - - - - - This filter is neutral with respect to the log event. - The remaining filters, if any, should be consulted for a final decision. - - - - - The log event must be logged immediately without - consulting with the remaining filters, if any, in the chain. - - - - - This is a very simple filter based on matching. - - - - The filter admits two options and - . If there is an exact match between the value - of the option and the of the - , then the method returns in - case the option value is set - to true, if it is false then - is returned. If the does not match then - the result will be . - - - Nicko Cadell - Gert Driesen - - - - flag to indicate if the filter should on a match - - - - - the to match against - - - - - Default constructor - - - - - Tests if the of the logging event matches that of the filter - - the event to filter - see remarks - - - If the of the event matches the level of the - filter then the result of the function depends on the - value of . If it is true then - the function will return , it it is false then it - will return . If the does not match then - the result will be . - - - - - - when matching - - - - The property is a flag that determines - the behavior when a matching is found. If the - flag is set to true then the filter will the - logging event, otherwise it will the event. - - - The default is true i.e. to the event. - - - - - - The that the filter will match - - - - The level that this filter will attempt to match against the - level. If a match is found then - the result depends on the value of . - - - - - - This is a simple filter based on matching. - - - - The filter admits three options and - that determine the range of priorities that are matched, and - . If there is a match between the range - of priorities and the of the , then the - method returns in case the - option value is set to true, if it is false - then is returned. If there is no match, is returned. - - - Nicko Cadell - Gert Driesen - - - - Flag to indicate the behavior when matching a - - - - - the minimum value to match - - - - - the maximum value to match - - - - - Default constructor - - - - - Check if the event should be logged. - - the logging event to check - see remarks - - - If the of the logging event is outside the range - matched by this filter then - is returned. If the is matched then the value of - is checked. If it is true then - is returned, otherwise - is returned. - - - - - - when matching and - - - - The property is a flag that determines - the behavior when a matching is found. If the - flag is set to true then the filter will the - logging event, otherwise it will the event. - - - The default is true i.e. to the event. - - - - - - Set the minimum matched - - - - The minimum level that this filter will attempt to match against the - level. If a match is found then - the result depends on the value of . - - - - - - Sets the maximum matched - - - - The maximum level that this filter will attempt to match against the - level. If a match is found then - the result depends on the value of . - - - - - - Simple filter to match a string in the event's logger name. - - - - The works very similar to the . It admits two - options and . If the - of the starts - with the value of the option, then the - method returns in - case the option value is set to true, - if it is false then is returned. - - - Daniel Cazzulino - - - - Flag to indicate the behavior when we have a match - - - - - The logger name string to substring match against the event - - - - - Default constructor - - - - - Check if this filter should allow the event to be logged - - the event being logged - see remarks - - - The rendered message is matched against the . - If the equals the beginning of - the incoming () - then a match will have occurred. If no match occurs - this function will return - allowing other filters to check the event. If a match occurs then - the value of is checked. If it is - true then is returned otherwise - is returned. - - - - - - when matching - - - - The property is a flag that determines - the behavior when a matching is found. If the - flag is set to true then the filter will the - logging event, otherwise it will the event. - - - The default is true i.e. to the event. - - - - - - The that the filter will match - - - - This filter will attempt to match this value against logger name in - the following way. The match will be done against the beginning of the - logger name (using ). The match is - case sensitive. If a match is found then - the result depends on the value of . - - - - - - Simple filter to match a keyed string in the - - - - Simple filter to match a keyed string in the - - - As the MDC has been replaced with layered properties the - should be used instead. - - - Nicko Cadell - Gert Driesen - - - - Simple filter to match a string an event property - - - - Simple filter to match a string in the value for a - specific event property - - - Nicko Cadell - - - - Simple filter to match a string in the rendered message - - - - Simple filter to match a string in the rendered message - - - Nicko Cadell - Gert Driesen - - - - Flag to indicate the behavior when we have a match - - - - - The string to substring match against the message - - - - - A string regex to match - - - - - A regex object to match (generated from m_stringRegexToMatch) - - - - - Default constructor - - - - - Initialize and precompile the Regex if required - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Check if this filter should allow the event to be logged - - the event being logged - see remarks - - - The rendered message is matched against the . - If the occurs as a substring within - the message then a match will have occurred. If no match occurs - this function will return - allowing other filters to check the event. If a match occurs then - the value of is checked. If it is - true then is returned otherwise - is returned. - - - - - - when matching or - - - - The property is a flag that determines - the behavior when a matching is found. If the - flag is set to true then the filter will the - logging event, otherwise it will the event. - - - The default is true i.e. to the event. - - - - - - Sets the static string to match - - - - The string that will be substring matched against - the rendered message. If the message contains this - string then the filter will match. If a match is found then - the result depends on the value of . - - - One of or - must be specified. - - - - - - Sets the regular expression to match - - - - The regular expression pattern that will be matched against - the rendered message. If the message matches this - pattern then the filter will match. If a match is found then - the result depends on the value of . - - - One of or - must be specified. - - - - - - The key to use to lookup the string from the event properties - - - - - Default constructor - - - - - Check if this filter should allow the event to be logged - - the event being logged - see remarks - - - The event property for the is matched against - the . - If the occurs as a substring within - the property value then a match will have occurred. If no match occurs - this function will return - allowing other filters to check the event. If a match occurs then - the value of is checked. If it is - true then is returned otherwise - is returned. - - - - - - The key to lookup in the event properties and then match against. - - - - The key name to use to lookup in the properties map of the - . The match will be performed against - the value of this property if it exists. - - - - - - Simple filter to match a string in the - - - - Simple filter to match a string in the - - - As the MDC has been replaced with named stacks stored in the - properties collections the should - be used instead. - - - Nicko Cadell - Gert Driesen - - - - Default constructor - - - - Sets the to "NDC". - - - - - - Write the event appdomain name to the output - - - - Writes the to the output writer. - - - Daniel Cazzulino - Nicko Cadell - - - - Abstract class that provides the formatting functionality that - derived classes need. - - - Conversion specifiers in a conversion patterns are parsed to - individual PatternConverters. Each of which is responsible for - converting a logging event in a converter specific manner. - - Nicko Cadell - - - - Abstract class that provides the formatting functionality that - derived classes need. - - - - Conversion specifiers in a conversion patterns are parsed to - individual PatternConverters. Each of which is responsible for - converting a logging event in a converter specific manner. - - - Nicko Cadell - Gert Driesen - - - - Initial buffer size - - - - - Maximum buffer size before it is recycled - - - - - Protected constructor - - - - Initializes a new instance of the class. - - - - - - Evaluate this pattern converter and write the output to a writer. - - that will receive the formatted result. - The state object on which the pattern converter should be executed. - - - Derived pattern converters must override this method in order to - convert conversion specifiers in the appropriate way. - - - - - - Set the next pattern converter in the chains - - the pattern converter that should follow this converter in the chain - the next converter - - - The PatternConverter can merge with its neighbor during this method (or a sub class). - Therefore the return value may or may not be the value of the argument passed in. - - - - - - Write the pattern converter to the writer with appropriate formatting - - that will receive the formatted result. - The state object on which the pattern converter should be executed. - - - This method calls to allow the subclass to perform - appropriate conversion of the pattern converter. If formatting options have - been specified via the then this method will - apply those formattings before writing the output. - - - - - - Fast space padding method. - - to which the spaces will be appended. - The number of spaces to be padded. - - - Fast space padding method. - - - - - - The option string to the converter - - - - - Write an dictionary to a - - the writer to write to - a to use for object conversion - the value to write to the writer - - - Writes the to a writer in the form: - - - {key1=value1, key2=value2, key3=value3} - - - If the specified - is not null then it is used to render the key and value to text, otherwise - the object's ToString method is called. - - - - - - Write an object to a - - the writer to write to - a to use for object conversion - the value to write to the writer - - - Writes the Object to a writer. If the specified - is not null then it is used to render the object to text, otherwise - the object's ToString method is called. - - - - - - Get the next pattern converter in the chain - - - the next pattern converter in the chain - - - - Get the next pattern converter in the chain - - - - - - Gets or sets the formatting info for this converter - - - The formatting info for this converter - - - - Gets or sets the formatting info for this converter - - - - - - Gets or sets the option value for this converter - - - The option for this converter - - - - Gets or sets the option value for this converter - - - - - - Initializes a new instance of the class. - - - - - Derived pattern converters must override this method in order to - convert conversion specifiers in the correct way. - - that will receive the formatted result. - The on which the pattern converter should be executed. - - - - Derived pattern converters must override this method in order to - convert conversion specifiers in the correct way. - - that will receive the formatted result. - The state object on which the pattern converter should be executed. - - - - Flag indicating if this converter handles exceptions - - - false if this converter handles exceptions - - - - - Flag indicating if this converter handles the logging event exception - - false if this converter handles the logging event exception - - - If this converter handles the exception object contained within - , then this property should be set to - false. Otherwise, if the layout ignores the exception - object, then the property should be set to true. - - - Set this value to override a this default setting. The default - value is true, this converter does not handle the exception. - - - - - - Write the event appdomain name to the output - - that will receive the formatted result. - the event being logged - - - Writes the to the output . - - - - - - Date pattern converter, uses a to format - the date of a . - - - - Render the to the writer as a string. - - - The value of the determines - the formatting of the date. The following values are allowed: - - - Option value - Output - - - ISO8601 - - Uses the formatter. - Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. - - - - DATE - - Uses the formatter. - Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". - - - - ABSOLUTE - - Uses the formatter. - Formats using the "HH:mm:ss,yyyy" for example, "15:49:37,459". - - - - other - - Any other pattern string uses the formatter. - This formatter passes the pattern string to the - method. - For details on valid patterns see - DateTimeFormatInfo Class. - - - - - - The is in the local time zone and is rendered in that zone. - To output the time in Universal time see . - - - Nicko Cadell - - - - The used to render the date to a string - - - - The used to render the date to a string - - - - - - Initialize the converter pattern based on the property. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Convert the pattern into the rendered message - - that will receive the formatted result. - the event being logged - - - Pass the to the - for it to render it to the writer. - - - The passed is in the local time zone. - - - - - - Write the exception text to the output - - - - If an exception object is stored in the logging event - it will be rendered into the pattern output with a - trailing newline. - - - If there is no exception then nothing will be output - and no trailing newline will be appended. - It is typical to put a newline before the exception - and to have the exception as the last data in the pattern. - - - Nicko Cadell - - - - Default constructor - - - - - Write the exception text to the output - - that will receive the formatted result. - the event being logged - - - If an exception object is stored in the logging event - it will be rendered into the pattern output with a - trailing newline. - - - If there is no exception then nothing will be output - and no trailing newline will be appended. - It is typical to put a newline before the exception - and to have the exception as the last data in the pattern. - - - - - - Writes the caller location file name to the output - - - - Writes the value of the for - the event to the output writer. - - - Nicko Cadell - - - - Write the caller location file name to the output - - that will receive the formatted result. - the event being logged - - - Writes the value of the for - the to the output . - - - - - - Write the caller location info to the output - - - - Writes the to the output writer. - - - Nicko Cadell - - - - Write the caller location info to the output - - that will receive the formatted result. - the event being logged - - - Writes the to the output writer. - - - - - - Writes the event identity to the output - - - - Writes the value of the to - the output writer. - - - Daniel Cazzulino - Nicko Cadell - - - - Writes the event identity to the output - - that will receive the formatted result. - the event being logged - - - Writes the value of the - to - the output . - - - - - - Write the event level to the output - - - - Writes the display name of the event - to the writer. - - - Nicko Cadell - - - - Write the event level to the output - - that will receive the formatted result. - the event being logged - - - Writes the of the - to the . - - - - - - Write the caller location line number to the output - - - - Writes the value of the for - the event to the output writer. - - - Nicko Cadell - - - - Write the caller location line number to the output - - that will receive the formatted result. - the event being logged - - - Writes the value of the for - the to the output . - - - - - - Converter for logger name - - - - Outputs the of the event. - - - Nicko Cadell - - - - Converter to output and truncate '.' separated strings - - - - This abstract class supports truncating a '.' separated string - to show a specified number of elements from the right hand side. - This is used to truncate class names that are fully qualified. - - - Subclasses should override the method to - return the fully qualified string. - - - Nicko Cadell - - - - Initialize the converter - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Get the fully qualified string data - - the event being logged - the fully qualified name - - - Overridden by subclasses to get the fully qualified name before the - precision is applied to it. - - - Return the fully qualified '.' (dot/period) separated string. - - - - - - Convert the pattern to the rendered message - - that will receive the formatted result. - the event being logged - - Render the to the precision - specified by the property. - - - - - Gets the fully qualified name of the logger - - the event being logged - The fully qualified logger name - - - Returns the of the . - - - - - - Writes the event message to the output - - - - Uses the method - to write out the event message. - - - Nicko Cadell - - - - Writes the event message to the output - - that will receive the formatted result. - the event being logged - - - Uses the method - to write out the event message. - - - - - - Write the method name to the output - - - - Writes the caller location to - the output. - - - Nicko Cadell - - - - Write the method name to the output - - that will receive the formatted result. - the event being logged - - - Writes the caller location to - the output. - - - - - - Converter to include event NDC - - - - Outputs the value of the event property named NDC. - - - The should be used instead. - - - Nicko Cadell - - - - Write the event NDC to the output - - that will receive the formatted result. - the event being logged - - - As the thread context stacks are now stored in named event properties - this converter simply looks up the value of the NDC property. - - - The should be used instead. - - - - - - Property pattern converter - - - - Writes out the value of a named property. The property name - should be set in the - property. - - - If the is set to null - then all the properties are written as key value pairs. - - - Nicko Cadell - - - - Write the property value to the output - - that will receive the formatted result. - the event being logged - - - Writes out the value of a named property. The property name - should be set in the - property. - - - If the is set to null - then all the properties are written as key value pairs. - - - - - - Converter to output the relative time of the event - - - - Converter to output the time of the event relative to the start of the program. - - - Nicko Cadell - - - - Write the relative time to the output - - that will receive the formatted result. - the event being logged - - - Writes out the relative time of the event in milliseconds. - That is the number of milliseconds between the event - and the . - - - - - - Helper method to get the time difference between two DateTime objects - - start time (in the current local time zone) - end time (in the current local time zone) - the time difference in milliseconds - - - - Converter to include event thread name - - - - Writes the to the output. - - - Nicko Cadell - - - - Write the ThreadName to the output - - that will receive the formatted result. - the event being logged - - - Writes the to the . - - - - - - Pattern converter for the class name - - - - Outputs the of the event. - - - Nicko Cadell - - - - Gets the fully qualified name of the class - - the event being logged - The fully qualified type name for the caller location - - - Returns the of the . - - - - - - Converter to include event user name - - Douglas de la Torre - Nicko Cadell - - - - Convert the pattern to the rendered message - - that will receive the formatted result. - the event being logged - - - - Write the TimeStamp to the output - - - - Date pattern converter, uses a to format - the date of a . - - - Uses a to format the - in Universal time. - - - See the for details on the date pattern syntax. - - - - Nicko Cadell - - - - Write the TimeStamp to the output - - that will receive the formatted result. - the event being logged - - - Pass the to the - for it to render it to the writer. - - - The passed is in the local time zone, this is converted - to Universal time before it is rendered. - - - - - - - A Layout that renders only the Exception text from the logging event - - - - A Layout that renders only the Exception text from the logging event. - - - This Layout should only be used with appenders that utilize multiple - layouts (e.g. ). - - - Nicko Cadell - Gert Driesen - - - - Extend this abstract class to create your own log layout format. - - - - This is the base implementation of the - interface. Most layout objects should extend this class. - - - - - - Subclasses must implement the - method. - - - Subclasses should set the in their default - constructor. - - - - Nicko Cadell - Gert Driesen - - - - Interface implemented by layout objects - - - - An object is used to format a - as text. The method is called by an - appender to transform the into a string. - - - The layout can also supply and - text that is appender before any events and after all the events respectively. - - - Nicko Cadell - Gert Driesen - - - - Implement this method to create your own layout format. - - The TextWriter to write the formatted event to - The event to format - - - This method is called by an appender to format - the as text and output to a writer. - - - If the caller does not have a and prefers the - event to be formatted as a then the following - code can be used to format the event into a . - - - StringWriter writer = new StringWriter(); - Layout.Format(writer, loggingEvent); - string formattedEvent = writer.ToString(); - - - - - - The content type output by this layout. - - The content type - - - The content type output by this layout. - - - This is a MIME type e.g. "text/plain". - - - - - - The header for the layout format. - - the layout header - - - The Header text will be appended before any logging events - are formatted and appended. - - - - - - The footer for the layout format. - - the layout footer - - - The Footer text will be appended after all the logging events - have been formatted and appended. - - - - - - Flag indicating if this layout handle exceptions - - false if this layout handles exceptions - - - If this layout handles the exception object contained within - , then the layout should return - false. Otherwise, if the layout ignores the exception - object, then the layout should return true. - - - - - - The header text - - - - See for more information. - - - - - - The footer text - - - - See for more information. - - - - - - Flag indicating if this layout handles exceptions - - - - false if this layout handles exceptions - - - - - - Empty default constructor - - - - Empty default constructor - - - - - - Activate component options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - This method must be implemented by the subclass. - - - - - - Implement this method to create your own layout format. - - The TextWriter to write the formatted event to - The event to format - - - This method is called by an appender to format - the as text. - - - - - - The content type output by this layout. - - The content type is "text/plain" - - - The content type output by this layout. - - - This base class uses the value "text/plain". - To change this value a subclass must override this - property. - - - - - - The header for the layout format. - - the layout header - - - The Header text will be appended before any logging events - are formatted and appended. - - - - - - The footer for the layout format. - - the layout footer - - - The Footer text will be appended after all the logging events - have been formatted and appended. - - - - - - Flag indicating if this layout handles exceptions - - false if this layout handles exceptions - - - If this layout handles the exception object contained within - , then the layout should return - false. Otherwise, if the layout ignores the exception - object, then the layout should return true. - - - Set this value to override a this default setting. The default - value is true, this layout does not handle the exception. - - - - - - Default constructor - - - - Constructs a ExceptionLayout - - - - - - Activate component options - - - - Part of the component activation - framework. - - - This method does nothing as options become effective immediately. - - - - - - Gets the exception text from the logging event - - The TextWriter to write the formatted event to - the event being logged - - - Write the exception string to the . - The exception string is retrieved from . - - - - - - Interface for raw layout objects - - - - Interface used to format a - to an object. - - - This interface should not be confused with the - interface. This interface is used in - only certain specialized situations where a raw object is - required rather than a formatted string. The - is not generally useful than this interface. - - - Nicko Cadell - Gert Driesen - - - - Implement this method to create your own layout format. - - The event to format - returns the formatted event - - - Implement this method to create your own layout format. - - - - - - Adapts any to a - - - - Where an is required this adapter - allows a to be specified. - - - Nicko Cadell - Gert Driesen - - - - The layout to adapt - - - - - Construct a new adapter - - the layout to adapt - - - Create the adapter for the specified . - - - - - - Format the logging event as an object. - - The event to format - returns the formatted event - - - Format the logging event as an object. - - - Uses the object supplied to - the constructor to perform the formatting. - - - - - - A flexible layout configurable with pattern string. - - - - The goal of this class is to a - as a string. The results - depend on the conversion pattern. - - - The conversion pattern is closely related to the conversion - pattern of the printf function in C. A conversion pattern is - composed of literal text and format control expressions called - conversion specifiers. - - - You are free to insert any literal text within the conversion - pattern. - - - Each conversion specifier starts with a percent sign (%) and is - followed by optional format modifiers and a conversion - pattern name. The conversion pattern name specifies the type of - data, e.g. logger, level, date, thread name. The format - modifiers control such things as field width, padding, left and - right justification. The following is a simple example. - - - Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume - that the log4net environment was set to use a PatternLayout. Then the - statements - - - ILog log = LogManager.GetLogger(typeof(TestApp)); - log.Debug("Message 1"); - log.Warn("Message 2"); - - would yield the output - - DEBUG [main]: Message 1 - WARN [main]: Message 2 - - - Note that there is no explicit separator between text and - conversion specifiers. The pattern parser knows when it has reached - the end of a conversion specifier when it reads a conversion - character. In the example above the conversion specifier - %-5level means the level of the logging event should be left - justified to a width of five characters. - - - The recognized conversion pattern names are: - - - - Conversion Pattern Name - Effect - - - a - Equivalent to appdomain - - - appdomain - - Used to output the friendly name of the AppDomain where the - logging event was generated. - - - - c - Equivalent to logger - - - C - Equivalent to type - - - class - Equivalent to type - - - d - Equivalent to date - - - date - - - Used to output the date of the logging event in the local time zone. - To output the date in universal time use the %utcdate pattern. - The date conversion - specifier may be followed by a date format specifier enclosed - between braces. For example, %date{HH:mm:ss,fff} or - %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is - given then ISO8601 format is - assumed (). - - - The date format specifier admits the same syntax as the - time pattern string of the . - - - For better results it is recommended to use the log4net date - formatters. These can be specified using one of the strings - "ABSOLUTE", "DATE" and "ISO8601" for specifying - , - and respectively - . For example, - %date{ISO8601} or %date{ABSOLUTE}. - - - These dedicated date formatters perform significantly - better than . - - - - - exception - - - Used to output the exception passed in with the log message. - - - If an exception object is stored in the logging event - it will be rendered into the pattern output with a - trailing newline. - If there is no exception then nothing will be output - and no trailing newline will be appended. - It is typical to put a newline before the exception - and to have the exception as the last data in the pattern. - - - - - F - Equivalent to file - - - file - - - Used to output the file name where the logging request was - issued. - - - WARNING Generating caller location information is - extremely slow. Its use should be avoided unless execution speed - is not an issue. - - - See the note below on the availability of caller location information. - - - - - identity - - - Used to output the user name for the currently active user - (Principal.Identity.Name). - - - WARNING Generating caller information is - extremely slow. Its use should be avoided unless execution speed - is not an issue. - - - - - l - Equivalent to location - - - L - Equivalent to line - - - location - - - Used to output location information of the caller which generated - the logging event. - - - The location information depends on the CLI implementation but - usually consists of the fully qualified name of the calling - method followed by the callers source the file name and line - number between parentheses. - - - The location information can be very useful. However, its - generation is extremely slow. Its use should be avoided - unless execution speed is not an issue. - - - See the note below on the availability of caller location information. - - - - - level - - - Used to output the level of the logging event. - - - - - line - - - Used to output the line number from where the logging request - was issued. - - - WARNING Generating caller location information is - extremely slow. Its use should be avoided unless execution speed - is not an issue. - - - See the note below on the availability of caller location information. - - - - - logger - - - Used to output the logger of the logging event. The - logger conversion specifier can be optionally followed by - precision specifier, that is a decimal constant in - brackets. - - - If a precision specifier is given, then only the corresponding - number of right most components of the logger name will be - printed. By default the logger name is printed in full. - - - For example, for the logger name "a.b.c" the pattern - %logger{2} will output "b.c". - - - - - m - Equivalent to message - - - M - Equivalent to method - - - message - - - Used to output the application supplied message associated with - the logging event. - - - - - mdc - - - The MDC (old name for the ThreadContext.Properties) is now part of the - combined event properties. This pattern is supported for compatibility - but is equivalent to property. - - - - - method - - - Used to output the method name where the logging request was - issued. - - - WARNING Generating caller location information is - extremely slow. Its use should be avoided unless execution speed - is not an issue. - - - See the note below on the availability of caller location information. - - - - - n - Equivalent to newline - - - newline - - - Outputs the platform dependent line separator character or - characters. - - - This conversion pattern offers the same performance as using - non-portable line separator strings such as "\n", or "\r\n". - Thus, it is the preferred way of specifying a line separator. - - - - - ndc - - - Used to output the NDC (nested diagnostic context) associated - with the thread that generated the logging event. - - - - - p - Equivalent to level - - - P - Equivalent to property - - - properties - Equivalent to property - - - property - - - Used to output the an event specific property. The key to - lookup must be specified within braces and directly following the - pattern specifier, e.g. %property{user} would include the value - from the property that is keyed by the string 'user'. Each property value - that is to be included in the log must be specified separately. - Properties are added to events by loggers or appenders. By default - the log4net:HostName property is set to the name of machine on - which the event was originally logged. - - - If no key is specified, e.g. %property then all the keys and their - values are printed in a comma separated list. - - - The properties of an event are combined from a number of different - contexts. These are listed below in the order in which they are searched. - - - - the event properties - - The event has that can be set. These - properties are specific to this event only. - - - - the thread properties - - The that are set on the current - thread. These properties are shared by all events logged on this thread. - - - - the global properties - - The that are set globally. These - properties are shared by all the threads in the AppDomain. - - - - - - - - r - Equivalent to timestamp - - - t - Equivalent to thread - - - timestamp - - - Used to output the number of milliseconds elapsed since the start - of the application until the creation of the logging event. - - - - - thread - - - Used to output the name of the thread that generated the - logging event. Uses the thread number if no name is available. - - - - - type - - - Used to output the fully qualified type name of the caller - issuing the logging request. This conversion specifier - can be optionally followed by precision specifier, that - is a decimal constant in brackets. - - - If a precision specifier is given, then only the corresponding - number of right most components of the class name will be - printed. By default the class name is output in fully qualified form. - - - For example, for the class name "log4net.Layout.PatternLayout", the - pattern %type{1} will output "PatternLayout". - - - WARNING Generating the caller class information is - slow. Thus, its use should be avoided unless execution speed is - not an issue. - - - See the note below on the availability of caller location information. - - - - - u - Equivalent to identity - - - username - - - Used to output the WindowsIdentity for the currently - active user. - - - WARNING Generating caller WindowsIdentity information is - extremely slow. Its use should be avoided unless execution speed - is not an issue. - - - - - utcdate - - - Used to output the date of the logging event in universal time. - The date conversion - specifier may be followed by a date format specifier enclosed - between braces. For example, %utcdate{HH:mm:ss,fff} or - %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is - given then ISO8601 format is - assumed (). - - - The date format specifier admits the same syntax as the - time pattern string of the . - - - For better results it is recommended to use the log4net date - formatters. These can be specified using one of the strings - "ABSOLUTE", "DATE" and "ISO8601" for specifying - , - and respectively - . For example, - %utcdate{ISO8601} or %utcdate{ABSOLUTE}. - - - These dedicated date formatters perform significantly - better than . - - - - - w - Equivalent to username - - - x - Equivalent to ndc - - - X - Equivalent to mdc - - - % - - - The sequence %% outputs a single percent sign. - - - - - - The single letter patterns are deprecated in favor of the - longer more descriptive pattern names. - - - By default the relevant information is output as is. However, - with the aid of format modifiers it is possible to change the - minimum field width, the maximum field width and justification. - - - The optional format modifier is placed between the percent sign - and the conversion pattern name. - - - The first optional format modifier is the left justification - flag which is just the minus (-) character. Then comes the - optional minimum field width modifier. This is a decimal - constant that represents the minimum number of characters to - output. If the data item requires fewer characters, it is padded on - either the left or the right until the minimum width is - reached. The default is to pad on the left (right justify) but you - can specify right padding with the left justification flag. The - padding character is space. If the data item is larger than the - minimum field width, the field is expanded to accommodate the - data. The value is never truncated. - - - This behavior can be changed using the maximum field - width modifier which is designated by a period followed by a - decimal constant. If the data item is longer than the maximum - field, then the extra characters are removed from the - beginning of the data item and not from the end. For - example, it the maximum field width is eight and the data item is - ten characters long, then the first two characters of the data item - are dropped. This behavior deviates from the printf function in C - where truncation is done from the end. - - - Below are various format modifier examples for the logger - conversion specifier. - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none - - Left pad with spaces if the logger name is less than 20 - characters long. - -
%-20loggertrue20none - - Right pad with spaces if the logger - name is less than 20 characters long. - -
%.30loggerNAnone30 - - Truncate from the beginning if the logger - name is longer than 30 characters. - -
%20.30loggerfalse2030 - - Left pad with spaces if the logger name is shorter than 20 - characters. However, if logger name is longer than 30 characters, - then truncate from the beginning. - -
%-20.30loggertrue2030 - - Right pad with spaces if the logger name is shorter than 20 - characters. However, if logger name is longer than 30 characters, - then truncate from the beginning. - -
-
- - Note about caller location information.
- The following patterns %type %file %line %method %location %class %C %F %L %l %M - all generate caller location information. - Location information uses the System.Diagnostics.StackTrace class to generate - a call stack. The caller's information is then extracted from this stack. -
- - - The System.Diagnostics.StackTrace class is not supported on the - .NET Compact Framework 1.0 therefore caller location information is not - available on that framework. - - - - - The System.Diagnostics.StackTrace class has this to say about Release builds: - - - "StackTrace information will be most informative with Debug build configurations. - By default, Debug builds include debug symbols, while Release builds do not. The - debug symbols contain most of the file, method name, line number, and column - information used in constructing StackFrame and StackTrace objects. StackTrace - might not report as many method calls as expected, due to code transformations - that occur during optimization." - - - This means that in a Release build the caller information may be incomplete or may - not exist at all! Therefore caller location information cannot be relied upon in a Release build. - - - - Additional pattern converters may be registered with a specific - instance using the method. - -
- - This is a more detailed pattern. - %timestamp [%thread] %level %logger %ndc - %message%newline - - - A similar pattern except that the relative time is - right padded if less than 6 digits, thread name is right padded if - less than 15 characters and truncated if longer and the logger - name is left padded if shorter than 30 characters and truncated if - longer. - %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline - - Nicko Cadell - Gert Driesen - Douglas de la Torre - Daniel Cazzulino -
- - - Default pattern string for log output. - - - - Default pattern string for log output. - Currently set to the string "%message%newline" - which just prints the application supplied message. - - - - - - A detailed conversion pattern - - - - A conversion pattern which includes Time, Thread, Logger, and Nested Context. - Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. - - - - - - Internal map of converter identifiers to converter types. - - - - This static map is overridden by the m_converterRegistry instance map - - - - - - the pattern - - - - - the head of the pattern converter chain - - - - - patterns defined on this PatternLayout only - - - - - Initialize the global registry - - - - Defines the builtin global rules. - - - - - - Constructs a PatternLayout using the DefaultConversionPattern - - - - The default pattern just produces the application supplied message. - - - Note to Inheritors: This constructor calls the virtual method - . If you override this method be - aware that it will be called before your is called constructor. - - - As per the contract the - method must be called after the properties on this object have been - configured. - - - - - - Constructs a PatternLayout using the supplied conversion pattern - - the pattern to use - - - Note to Inheritors: This constructor calls the virtual method - . If you override this method be - aware that it will be called before your is called constructor. - - - When using this constructor the method - need not be called. This may not be the case when using a subclass. - - - - - - Create the pattern parser instance - - the pattern to parse - The that will format the event - - - Creates the used to parse the conversion string. Sets the - global and instance rules on the . - - - - - - Initialize layout options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Produces a formatted string as specified by the conversion pattern. - - the event being logged - The TextWriter to write the formatted event to - - - Parse the using the patter format - specified in the property. - - - - - - Add a converter to this PatternLayout - - the converter info - - - This version of the method is used by the configurator. - Programmatic users should use the alternative method. - - - - - - Add a converter to this PatternLayout - - the name of the conversion pattern for this converter - the type of the converter - - - Add a named pattern converter to this instance. This - converter will be used in the formatting of the event. - This method must be called before . - - - The specified must extend the - type. - - - - - - The pattern formatting string - - - - The ConversionPattern option. This is the string which - controls formatting and consists of a mix of literal content and - conversion specifiers. - - - - - - Wrapper class used to map converter names to converter types - - - - Pattern converter info class used during configuration to - pass to the - method. - - - - - - default constructor - - - - - Gets or sets the name of the conversion pattern - - - - The name of the pattern in the format string - - - - - - Gets or sets the type of the converter - - - - The value specified must extend the - type. - - - - - - Type converter for the interface - - - - Used to convert objects to the interface. - Supports converting from the interface to - the interface using the . - - - Nicko Cadell - Gert Driesen - - - - Interface supported by type converters - - - - This interface supports conversion from arbitrary types - to a single target type. See . - - - Nicko Cadell - Gert Driesen - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Test if the can be converted to the - type supported by this converter. - - - - - - Convert the source object to the type supported by this object - - the object to convert - the converted object - - - Converts the to the type supported - by this converter. - - - - - - Can the sourceType be converted to an - - the source to be to be converted - true if the source type can be converted to - - - Test if the can be converted to a - . Only is supported - as the . - - - - - - Convert the value to a object - - the value to convert - the object - - - Convert the object to a - object. If the object - is a then the - is used to adapt between the two interfaces, otherwise an - exception is thrown. - - - - - - Extract the value of a property from the - - - - Extract the value of a property from the - - - Nicko Cadell - - - - Constructs a RawPropertyLayout - - - - - Lookup the property for - - The event to format - returns property value - - - Looks up and returns the object value of the property - named . If there is no property defined - with than name then null will be returned. - - - - - - The name of the value to lookup in the LoggingEvent Properties collection. - - - Value to lookup in the LoggingEvent Properties collection - - - - String name of the property to lookup in the . - - - - - - Extract the date from the - - - - Extract the date from the - - - Nicko Cadell - Gert Driesen - - - - Constructs a RawTimeStampLayout - - - - - Gets the as a . - - The event to format - returns the time stamp - - - Gets the as a . - - - The time stamp is in local time. To format the time stamp - in universal time use . - - - - - - Extract the date from the - - - - Extract the date from the - - - Nicko Cadell - Gert Driesen - - - - Constructs a RawUtcTimeStampLayout - - - - - Gets the as a . - - The event to format - returns the time stamp - - - Gets the as a . - - - The time stamp is in universal time. To format the time stamp - in local time use . - - - - - - A very simple layout - - - - SimpleLayout consists of the level of the log statement, - followed by " - " and then the log message itself. For example, - - DEBUG - Hello world - - - - Nicko Cadell - Gert Driesen - - - - Constructs a SimpleLayout - - - - - Initialize layout options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Produces a simple formatted output. - - the event being logged - The TextWriter to write the formatted event to - - - Formats the event as the level of the even, - followed by " - " and then the log message itself. The - output is terminated by a newline. - - - - - - Layout that formats the log events as XML elements. - - - - The output of the consists of a series of - log4net:event elements. It does not output a complete well-formed XML - file. The output is designed to be included as an external entity - in a separate file to form a correct XML file. - - - For example, if abc is the name of the file where - the output goes, then a well-formed XML file would - be: - - - <?xml version="1.0" ?> - - <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> - - <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> - &data; - </log4net:events> - - - This approach enforces the independence of the - and the appender where it is embedded. - - - The version attribute helps components to correctly - interpret output generated by . The value of - this attribute should be "1.2" for release 1.2 and later. - - - Alternatively the Header and Footer properties can be - configured to output the correct XML header, open tag and close tag. - When setting the Header and Footer properties it is essential - that the underlying data store not be appendable otherwise the data - will become invalid XML. - - - Nicko Cadell - Gert Driesen - - - - Layout that formats the log events as XML elements. - - - - This is an abstract class that must be subclassed by an implementation - to conform to a specific schema. - - - Deriving classes must implement the method. - - - Nicko Cadell - Gert Driesen - - - - Protected constructor to support subclasses - - - - Initializes a new instance of the class - with no location info. - - - - - - Protected constructor to support subclasses - - - - The parameter determines whether - location information will be output by the layout. If - is set to true, then the - file name and line number of the statement at the origin of the log - statement will be output. - - - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. - - - - - - Initialize layout options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Produces a formatted string. - - The event being logged. - The TextWriter to write the formatted event to - - - Format the and write it to the . - - - This method creates an that writes to the - . The is passed - to the method. Subclasses should override the - method rather than this method. - - - - - - Does the actual writing of the XML. - - The writer to use to output the event to. - The event to write. - - - Subclasses should override this method to format - the as XML. - - - - - - Flag to indicate if location information should be included in - the XML events. - - - - - Writer adapter that ignores Close - - - - - The string to replace invalid chars with - - - - - Gets a value indicating whether to include location information in - the XML events. - - - true if location information should be included in the XML - events; otherwise, false. - - - - If is set to true, then the file - name and line number of the statement at the origin of the log - statement will be output. - - - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. - - - - - - The string to replace characters that can not be expressed in XML with. - - - Not all characters may be expressed in XML. This property contains the - string to replace those that can not with. This defaults to a ?. Set it - to the empty string to simply remove offending characters. For more - details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets - Character replacement will occur in the log message, the property names - and the property values. - - - - - - - Gets the content type output by this layout. - - - As this is the XML layout, the value is always "text/xml". - - - - As this is the XML layout, the value is always "text/xml". - - - - - - Constructs an XmlLayout - - - - - Constructs an XmlLayout. - - - - The LocationInfo option takes a boolean value. By - default, it is set to false which means there will be no location - information output by this layout. If the the option is set to - true, then the file name and line number of the statement - at the origin of the log statement will be output. - - - If you are embedding this layout within an SmtpAppender - then make sure to set the LocationInfo option of that - appender as well. - - - - - - Initialize layout options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - Builds a cache of the element names - - - - - - Does the actual writing of the XML. - - The writer to use to output the event to. - The event to write. - - - Override the base class method - to write the to the . - - - - - - The prefix to use for all generated element names - - - - - The prefix to use for all element names - - - - The default prefix is log4net. Set this property - to change the prefix. If the prefix is set to an empty string - then no prefix will be written. - - - - - - Set whether or not to base64 encode the message. - - - - By default the log message will be written as text to the xml - output. This can cause problems when the message contains binary - data. By setting this to true the contents of the message will be - base64 encoded. If this is set then invalid character replacement - (see ) will not be performed - on the log message. - - - - - - Set whether or not to base64 encode the property values. - - - - By default the properties will be written as text to the xml - output. This can cause problems when one or more properties contain - binary data. By setting this to true the values of the properties - will be base64 encoded. If this is set then invalid character replacement - (see ) will not be performed - on the property values. - - - - - - Layout that formats the log events as XML elements compatible with the log4j schema - - - - Formats the log events according to the http://logging.apache.org/log4j schema. - - - Nicko Cadell - - - - The 1st of January 1970 in UTC - - - - - Constructs an XMLLayoutSchemaLog4j - - - - - Constructs an XMLLayoutSchemaLog4j. - - - - The LocationInfo option takes a boolean value. By - default, it is set to false which means there will be no location - information output by this layout. If the the option is set to - true, then the file name and line number of the statement - at the origin of the log statement will be output. - - - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. - - - - - - Actually do the writing of the xml - - the writer to use - the event to write - - - Generate XML that is compatible with the log4j schema. - - - - - - The version of the log4j schema to use. - - - - Only version 1.2 of the log4j schema is supported. - - - - - - The default object Renderer. - - - - The default renderer supports rendering objects and collections to strings. - - - See the method for details of the output. - - - Nicko Cadell - Gert Driesen - - - - Implement this interface in order to render objects as strings - - - - Certain types require special case conversion to - string form. This conversion is done by an object renderer. - Object renderers implement the - interface. - - - Nicko Cadell - Gert Driesen - - - - Render the object to a string - - The map used to lookup renderers - The object to render - The writer to render to - - - Render the object to a - string. - - - The parameter is - provided to lookup and render other objects. This is - very useful where contains - nested objects of unknown type. The - method can be used to render these objects. - - - - - - Default constructor - - - - Default constructor - - - - - - Render the object to a string - - The map used to lookup renderers - The object to render - The writer to render to - - - Render the object to a string. - - - The parameter is - provided to lookup and render other objects. This is - very useful where contains - nested objects of unknown type. The - method can be used to render these objects. - - - The default renderer supports rendering objects to strings as follows: - - - - Value - Rendered String - - - null - - "(null)" - - - - - - - For a one dimensional array this is the - array type name, an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. - - - For example: int[] {1, 2, 3}. - - - If the array is not one dimensional the - Array.ToString() is returned. - - - - - , & - - - Rendered as an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. - - - For example: {a, b, c}. - - - All collection classes that implement its subclasses, - or generic equivalents all implement the interface. - - - - - - - - Rendered as the key, an equals sign ('='), and the value (using the appropriate - renderer). - - - For example: key=value. - - - - - other - - Object.ToString() - - - - - - - - Render the array argument into a string - - The map used to lookup renderers - the array to render - The writer to render to - - - For a one dimensional array this is the - array type name, an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. For example: - int[] {1, 2, 3}. - - - If the array is not one dimensional the - Array.ToString() is returned. - - - - - - Render the enumerator argument into a string - - The map used to lookup renderers - the enumerator to render - The writer to render to - - - Rendered as an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. For example: - {a, b, c}. - - - - - - Render the DictionaryEntry argument into a string - - The map used to lookup renderers - the DictionaryEntry to render - The writer to render to - - - Render the key, an equals sign ('='), and the value (using the appropriate - renderer). For example: key=value. - - - - - - Map class objects to an . - - - - Maintains a mapping between types that require special - rendering and the that - is used to render them. - - - The method is used to render an - object using the appropriate renderers defined in this map. - - - Nicko Cadell - Gert Driesen - - - - Default Constructor - - - - Default constructor. - - - - - - Render using the appropriate renderer. - - the object to render to a string - the object rendered as a string - - - This is a convenience method used to render an object to a string. - The alternative method - should be used when streaming output to a . - - - - - - Render using the appropriate renderer. - - the object to render to a string - The writer to render to - - - Find the appropriate renderer for the type of the - parameter. This is accomplished by calling the - method. Once a renderer is found, it is - applied on the object and the result is returned - as a . - - - - - - Gets the renderer for the specified object type - - the object to lookup the renderer for - the renderer for - - - Gets the renderer for the specified object type. - - - Syntactic sugar method that calls - with the type of the object parameter. - - - - - - Gets the renderer for the specified type - - the type to lookup the renderer for - the renderer for the specified type - - - Returns the renderer for the specified type. - If no specific renderer has been defined the - will be returned. - - - - - - Internal function to recursively search interfaces - - the type to lookup the renderer for - the renderer for the specified type - - - - Clear the map of renderers - - - - Clear the custom renderers defined by using - . The - cannot be removed. - - - - - - Register an for . - - the type that will be rendered by - the renderer for - - - Register an object renderer for a specific source type. - This renderer will be returned from a call to - specifying the same as an argument. - - - - - - Get the default renderer instance - - the default renderer - - - Get the default renderer - - - - - - Interface implemented by logger repository plugins. - - - - Plugins define additional behavior that can be associated - with a . - The held by the - property is used to store the plugins for a repository. - - - The log4net.Config.PluginAttribute can be used to - attach plugins to repositories created using configuration - attributes. - - - Nicko Cadell - Gert Driesen - - - - Attaches the plugin to the specified . - - The that this plugin should be attached to. - - - A plugin may only be attached to a single repository. - - - This method is called when the plugin is attached to the repository. - - - - - - Is called when the plugin is to shutdown. - - - - This method is called to notify the plugin that - it should stop operating and should detach from - the repository. - - - - - - Gets the name of the plugin. - - - The name of the plugin. - - - - Plugins are stored in the - keyed by name. Each plugin instance attached to a - repository must be a unique name. - - - - - - A strongly-typed collection of objects. - - Nicko Cadell - - - - Creates a read-only wrapper for a PluginCollection instance. - - list to create a readonly wrapper arround - - A PluginCollection wrapper that is read-only. - - - - - Initializes a new instance of the PluginCollection class - that is empty and has the default initial capacity. - - - - - Initializes a new instance of the PluginCollection class - that has the specified initial capacity. - - - The number of elements that the new PluginCollection is initially capable of storing. - - - - - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified PluginCollection. - - The PluginCollection whose elements are copied to the new collection. - - - - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified array. - - The array whose elements are copied to the new list. - - - - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified collection. - - The collection whose elements are copied to the new list. - - - - Allow subclasses to avoid our default constructors - - - - - - - Copies the entire PluginCollection to a one-dimensional - array. - - The one-dimensional array to copy to. - - - - Copies the entire PluginCollection to a one-dimensional - array, starting at the specified index of the target array. - - The one-dimensional array to copy to. - The zero-based index in at which copying begins. - - - - Adds a to the end of the PluginCollection. - - The to be added to the end of the PluginCollection. - The index at which the value has been added. - - - - Removes all elements from the PluginCollection. - - - - - Creates a shallow copy of the . - - A new with a shallow copy of the collection data. - - - - Determines whether a given is in the PluginCollection. - - The to check for. - true if is found in the PluginCollection; otherwise, false. - - - - Returns the zero-based index of the first occurrence of a - in the PluginCollection. - - The to locate in the PluginCollection. - - The zero-based index of the first occurrence of - in the entire PluginCollection, if found; otherwise, -1. - - - - - Inserts an element into the PluginCollection at the specified index. - - The zero-based index at which should be inserted. - The to insert. - - is less than zero - -or- - is equal to or greater than . - - - - - Removes the first occurrence of a specific from the PluginCollection. - - The to remove from the PluginCollection. - - The specified was not found in the PluginCollection. - - - - - Removes the element at the specified index of the PluginCollection. - - The zero-based index of the element to remove. - - is less than zero. - -or- - is equal to or greater than . - - - - - Returns an enumerator that can iterate through the PluginCollection. - - An for the entire PluginCollection. - - - - Adds the elements of another PluginCollection to the current PluginCollection. - - The PluginCollection whose elements should be added to the end of the current PluginCollection. - The new of the PluginCollection. - - - - Adds the elements of a array to the current PluginCollection. - - The array whose elements should be added to the end of the PluginCollection. - The new of the PluginCollection. - - - - Adds the elements of a collection to the current PluginCollection. - - The collection whose elements should be added to the end of the PluginCollection. - The new of the PluginCollection. - - - - Sets the capacity to the actual number of elements. - - - - - is less than zero. - -or- - is equal to or greater than . - - - - - is less than zero. - -or- - is equal to or greater than . - - - - - Gets the number of elements actually contained in the PluginCollection. - - - - - Gets a value indicating whether access to the collection is synchronized (thread-safe). - - true if access to the ICollection is synchronized (thread-safe); otherwise, false. - - - - Gets an object that can be used to synchronize access to the collection. - - - An object that can be used to synchronize access to the collection. - - - - - Gets or sets the at the specified index. - - - The at the specified index. - - The zero-based index of the element to get or set. - - is less than zero. - -or- - is equal to or greater than . - - - - - Gets a value indicating whether the collection has a fixed size. - - true if the collection has a fixed size; otherwise, false. The default is false. - - - - Gets a value indicating whether the IList is read-only. - - true if the collection is read-only; otherwise, false. The default is false. - - - - Gets or sets the number of elements the PluginCollection can contain. - - - The number of elements the PluginCollection can contain. - - - - - Supports type-safe iteration over a . - - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - - - Type visible only to our subclasses - Used to access protected constructor - - - - - - A value - - - - - Supports simple iteration over a . - - - - - - Initializes a new instance of the Enumerator class. - - - - - - Advances the enumerator to the next element in the collection. - - - true if the enumerator was successfully advanced to the next element; - false if the enumerator has passed the end of the collection. - - - The collection was modified after the enumerator was created. - - - - - Sets the enumerator to its initial position, before the first element in the collection. - - - - - Gets the current element in the collection. - - - The current element in the collection. - - - - - - - - Map of repository plugins. - - - - This class is a name keyed map of the plugins that are - attached to a repository. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - The repository that the plugins should be attached to. - - - Initialize a new instance of the class with a - repository that the plugins should be attached to. - - - - - - Adds a to the map. - - The to add to the map. - - - The will be attached to the repository when added. - - - If there already exists a plugin with the same name - attached to the repository then the old plugin will - be and replaced with - the new plugin. - - - - - - Removes a from the map. - - The to remove from the map. - - - Remove a specific plugin from this map. - - - - - - Gets a by name. - - The name of the to lookup. - - The from the map with the name specified, or - null if no plugin is found. - - - - Lookup a plugin by name. If the plugin is not found null - will be returned. - - - - - - Gets all possible plugins as a list of objects. - - All possible plugins as a list of objects. - - - Get a collection of all the plugins defined in this map. - - - - - - Base implementation of - - - - Default abstract implementation of the - interface. This base class can be used by implementors - of the interface. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - the name of the plugin - - Initializes a new Plugin with the specified name. - - - - - Attaches this plugin to a . - - The that this plugin should be attached to. - - - A plugin may only be attached to a single repository. - - - This method is called when the plugin is attached to the repository. - - - - - - Is called when the plugin is to shutdown. - - - - This method is called to notify the plugin that - it should stop operating and should detach from - the repository. - - - - - - The name of this plugin. - - - - - The repository this plugin is attached to. - - - - - Gets or sets the name of the plugin. - - - The name of the plugin. - - - - Plugins are stored in the - keyed by name. Each plugin instance attached to a - repository must be a unique name. - - - The name of the plugin must not change one the - plugin has been attached to a repository. - - - - - - The repository for this plugin - - - The that this plugin is attached to. - - - - Gets or sets the that this plugin is - attached to. - - - - - - Plugin that listens for events from the - - - - This plugin publishes an instance of - on a specified . This listens for logging events delivered from - a remote . - - - When an event is received it is relogged within the attached repository - as if it had been raised locally. - - - Nicko Cadell - Gert Driesen - - - - Default constructor - - - - Initializes a new instance of the class. - - - The property must be set. - - - - - - Construct with sink Uri. - - The name to publish the sink under in the remoting infrastructure. - See for more details. - - - Initializes a new instance of the class - with specified name. - - - - - - Attaches this plugin to a . - - The that this plugin should be attached to. - - - A plugin may only be attached to a single repository. - - - This method is called when the plugin is attached to the repository. - - - - - - Is called when the plugin is to shutdown. - - - - When the plugin is shutdown the remote logging - sink is disconnected. - - - - - - Gets or sets the URI of this sink. - - - The URI of this sink. - - - - This is the name under which the object is marshaled. - - - - - - - Delivers objects to a remote sink. - - - - Internal class used to listen for logging events - and deliver them to the local repository. - - - - - - Constructor - - The repository to log to. - - - Initializes a new instance of the for the - specified . - - - - - - Logs the events to the repository. - - The events to log. - - - The events passed are logged to the - - - - - - Obtains a lifetime service object to control the lifetime - policy for this instance. - - null to indicate that this instance should live forever. - - - Obtains a lifetime service object to control the lifetime - policy for this instance. This object should live forever - therefore this implementation returns null. - - - - - - The underlying that events should - be logged to. - - - - - Default implementation of - - - - This default implementation of the - interface is used to create the default subclass - of the object. - - - Nicko Cadell - Gert Driesen - - - - Interface abstracts creation of instances - - - - This interface is used by the to - create new objects. - - - The method is called - to create a named . - - - Implement this interface to create new subclasses of . - - - Nicko Cadell - Gert Driesen - - - - Create a new instance - - The name of the . - The instance for the specified name. - - - Create a new instance with the - specified name. - - - Called by the to create - new named instances. - - - If the is null then the root logger - must be returned. - - - - - - Default constructor - - - - Initializes a new instance of the class. - - - - - - Create a new instance - - The name of the . - The instance for the specified name. - - - Create a new instance with the - specified name. - - - Called by the to create - new named instances. - - - If the is null then the root logger - must be returned. - - - - - - Default internal subclass of - - - - This subclass has no additional behavior over the - class but does allow instances - to be created. - - - - - - Implementation of used by - - - - Internal class used to provide implementation of - interface. Applications should use to get - logger instances. - - - This is one of the central classes in the log4net implementation. One of the - distinctive features of log4net are hierarchical loggers and their - evaluation. The organizes the - instances into a rooted tree hierarchy. - - - The class is abstract. Only concrete subclasses of - can be created. The - is used to create instances of this type for the . - - - Nicko Cadell - Gert Driesen - Aspi Havewala - Douglas de la Torre - - - - This constructor created a new instance and - sets its name. - - The name of the . - - - This constructor is protected and designed to be used by - a subclass that is not abstract. - - - Loggers are constructed by - objects. See for the default - logger creator. - - - - - - Add to the list of appenders of this - Logger instance. - - An appender to add to this logger - - - Add to the list of appenders of this - Logger instance. - - - If is already in the list of - appenders, then it won't be added again. - - - - - - Look for the appender named as name - - The name of the appender to lookup - The appender with the name specified, or null. - - - Returns the named appender, or null if the appender is not found. - - - - - - Remove all previously added appenders from this Logger instance. - - - - Remove all previously added appenders from this Logger instance. - - - This is useful when re-reading configuration information. - - - - - - Remove the appender passed as parameter form the list of appenders. - - The appender to remove - The appender removed from the list - - - Remove the appender passed as parameter form the list of appenders. - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - Remove the appender passed as parameter form the list of appenders. - - The name of the appender to remove - The appender removed from the list - - - Remove the named appender passed as parameter form the list of appenders. - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - This generic form is intended to be used by wrappers. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The level of the message to be logged. - The message object to log. - The exception to log, including its stack trace. - - - Generate a logging event for the specified using - the and . - - - This method must not throw any exception to the caller. - - - - - - This is the most generic printing method that is intended to be used - by wrappers. - - The event being logged. - - - Logs the specified logging event through this logger. - - - This method must not throw any exception to the caller. - - - - - - Checks if this logger is enabled for a given passed as parameter. - - The level to check. - - true if this logger is enabled for level, otherwise false. - - - - Test if this logger is going to log events of the specified . - - - This method must not throw any exception to the caller. - - - - - - Deliver the to the attached appenders. - - The event to log. - - - Call the appenders in the hierarchy starting at - this. If no appenders could be found, emit a - warning. - - - This method calls all the appenders inherited from the - hierarchy circumventing any evaluation of whether to log or not - to log the particular log request. - - - - - - Closes all attached appenders implementing the interface. - - - - Used to ensure that the appenders are correctly shutdown. - - - - - - This is the most generic printing method. This generic form is intended to be used by wrappers - - The level of the message to be logged. - The message object to log. - The exception to log, including its stack trace. - - - Generate a logging event for the specified using - the . - - - - - - Creates a new logging event and logs the event without further checks. - - The declaring type of the method that is - the stack boundary into the logging system for this call. - The level of the message to be logged. - The message object to log. - The exception to log, including its stack trace. - - - Generates a logging event and delivers it to the attached - appenders. - - - - - - Creates a new logging event and logs the event without further checks. - - The event being logged. - - - Delivers the logging event to the attached appenders. - - - - - - The fully qualified type of the Logger class. - - - - - The name of this logger. - - - - - The assigned level of this logger. - - - - The level variable need not be - assigned a value in which case it is inherited - form the hierarchy. - - - - - - The parent of this logger. - - - - The parent of this logger. - All loggers have at least one ancestor which is the root logger. - - - - - - Loggers need to know what Hierarchy they are in. - - - - Loggers need to know what Hierarchy they are in. - The hierarchy that this logger is a member of is stored - here. - - - - - - Helper implementation of the interface - - - - - Flag indicating if child loggers inherit their parents appenders - - - - Additivity is set to true by default, that is children inherit - the appenders of their ancestors by default. If this variable is - set to false then the appenders found in the - ancestors of this logger are not used. However, the children - of this logger will inherit its appenders, unless the children - have their additivity flag set to false too. See - the user manual for more details. - - - - - - Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl - - - - - Gets or sets the parent logger in the hierarchy. - - - The parent logger in the hierarchy. - - - - Part of the Composite pattern that makes the hierarchy. - The hierarchy is parent linked rather than child linked. - - - - - - Gets or sets a value indicating if child loggers inherit their parent's appenders. - - - true if child loggers inherit their parent's appenders. - - - - Additivity is set to true by default, that is children inherit - the appenders of their ancestors by default. If this variable is - set to false then the appenders found in the - ancestors of this logger are not used. However, the children - of this logger will inherit its appenders, unless the children - have their additivity flag set to false too. See - the user manual for more details. - - - - - - Gets the effective level for this logger. - - The nearest level in the logger hierarchy. - - - Starting from this logger, searches the logger hierarchy for a - non-null level and returns it. Otherwise, returns the level of the - root logger. - - The Logger class is designed so that this method executes as - quickly as possible. - - - - - Gets or sets the where this - Logger instance is attached to. - - The hierarchy that this logger belongs to. - - - This logger must be attached to a single . - - - - - - Gets or sets the assigned , if any, for this Logger. - - - The of this logger. - - - - The assigned can be null. - - - - - - Get the appenders contained in this logger as an - . - - A collection of the appenders in this logger - - - Get the appenders contained in this logger as an - . If no appenders - can be found, then a is returned. - - - - - - Gets the logger name. - - - The name of the logger. - - - - The name of this logger - - - - - - Gets the where this - Logger instance is attached to. - - - The that this logger belongs to. - - - - Gets the where this - Logger instance is attached to. - - - - - - Construct a new Logger - - the name of the logger - - - Initializes a new instance of the class - with the specified name. - - - - - - Delegate used to handle logger creation event notifications. - - The in which the has been created. - The event args that hold the instance that has been created. - - - Delegate used to handle logger creation event notifications. - - - - - - Provides data for the event. - - - - A event is raised every time a - is created. - - - - - - The created - - - - - Constructor - - The that has been created. - - - Initializes a new instance of the event argument - class,with the specified . - - - - - - Gets the that has been created. - - - The that has been created. - - - - The that has been created. - - - - - - Hierarchical organization of loggers - - - - The casual user should not have to deal with this class - directly. - - - This class is specialized in retrieving loggers by name and - also maintaining the logger hierarchy. Implements the - interface. - - - The structure of the logger hierarchy is maintained by the - method. The hierarchy is such that children - link to their parent but parents do not have any references to their - children. Moreover, loggers can be instantiated in any order, in - particular descendant before ancestor. - - - In case a descendant is created before a particular ancestor, - then it creates a provision node for the ancestor and adds itself - to the provision node. Other descendants of the same ancestor add - themselves to the previously created provision node. - - - Nicko Cadell - Gert Driesen - - - - Base implementation of - - - - Default abstract implementation of the interface. - - - Skeleton implementation of the interface. - All types can extend this type. - - - Nicko Cadell - Gert Driesen - - - - Interface implemented by logger repositories. - - - - This interface is implemented by logger repositories. e.g. - . - - - This interface is used by the - to obtain interfaces. - - - Nicko Cadell - Gert Driesen - - - - Check if the named logger exists in the repository. If so return - its reference, otherwise returns null. - - The name of the logger to lookup - The Logger object with the name specified - - - If the names logger exists it is returned, otherwise - null is returned. - - - - - - Returns all the currently defined loggers as an Array. - - All the defined loggers - - - Returns all the currently defined loggers as an Array. - - - - - - Returns a named logger instance - - The name of the logger to retrieve - The logger object with the name specified - - - Returns a named logger instance. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. - - - - - Shutdown the repository - - - Shutting down a repository will safely close and remove - all appenders in all loggers including the root logger. - - - Some appenders need to be closed before the - application exists. Otherwise, pending logging events might be - lost. - - - The method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Reset the repositories configuration to a default state - - - - Reset all values contained in this instance to their - default state. - - - Existing loggers are not removed. They are just reset. - - - This method should be used sparingly and with care as it will - block all logging until it is completed. - - - - - - Log the through this repository. - - the event to log - - - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. - - - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. - - - - - - Returns all the Appenders that are configured as an Array. - - All the Appenders - - - Returns all the Appenders that are configured as an Array. - - - - - - The name of the repository - - - The name of the repository - - - - The name of the repository. - - - - - - RendererMap accesses the object renderer map for this repository. - - - RendererMap accesses the object renderer map for this repository. - - - - RendererMap accesses the object renderer map for this repository. - - - The RendererMap holds a mapping between types and - objects. - - - - - - The plugin map for this repository. - - - The plugin map for this repository. - - - - The plugin map holds the instances - that have been attached to this repository. - - - - - - Get the level map for the Repository. - - - - Get the level map for the Repository. - - - The level map defines the mappings between - level names and objects in - this repository. - - - - - - The threshold for all events in this repository - - - The threshold for all events in this repository - - - - The threshold for all events in this repository. - - - - - - Flag indicates if this repository has been configured. - - - Flag indicates if this repository has been configured. - - - - Flag indicates if this repository has been configured. - - - - - - Event to notify that the repository has been shutdown. - - - Event to notify that the repository has been shutdown. - - - - Event raised when the repository has been shutdown. - - - - - - Event to notify that the repository has had its configuration reset. - - - Event to notify that the repository has had its configuration reset. - - - - Event raised when the repository's configuration has been - reset to default. - - - - - - Event to notify that the repository has had its configuration changed. - - - Event to notify that the repository has had its configuration changed. - - - - Event raised when the repository's configuration has been changed. - - - - - - Repository specific properties - - - Repository specific properties - - - - These properties can be specified on a repository specific basis. - - - - - - Default Constructor - - - - Initializes the repository with default (empty) properties. - - - - - - Construct the repository using specific properties - - the properties to set for this repository - - - Initializes the repository with specified properties. - - - - - - Test if logger exists - - The name of the logger to lookup - The Logger object with the name specified - - - Check if the named logger exists in the repository. If so return - its reference, otherwise returns null. - - - - - - Returns all the currently defined loggers in the repository - - All the defined loggers - - - Returns all the currently defined loggers in the repository as an Array. - - - - - - Return a new logger instance - - The name of the logger to retrieve - The logger object with the name specified - - - Return a new logger instance. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. - - - - - - Shutdown the repository - - - - Shutdown the repository. Can be overridden in a subclass. - This base class implementation notifies the - listeners and all attached plugins of the shutdown event. - - - - - - Reset the repositories configuration to a default state - - - - Reset all values contained in this instance to their - default state. - - - Existing loggers are not removed. They are just reset. - - - This method should be used sparingly and with care as it will - block all logging until it is completed. - - - - - - Log the logEvent through this repository. - - the event to log - - - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. - - - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. - - - - - - Returns all the Appenders that are configured as an Array. - - All the Appenders - - - Returns all the Appenders that are configured as an Array. - - - - - - Adds an object renderer for a specific class. - - The type that will be rendered by the renderer supplied. - The object renderer used to render the object. - - - Adds an object renderer for a specific class. - - - - - - Notify the registered listeners that the repository is shutting down - - Empty EventArgs - - - Notify any listeners that this repository is shutting down. - - - - - - Notify the registered listeners that the repository has had its configuration reset - - Empty EventArgs - - - Notify any listeners that this repository's configuration has been reset. - - - - - - Notify the registered listeners that the repository has had its configuration changed - - Empty EventArgs - - - Notify any listeners that this repository's configuration has changed. - - - - - - Raise a configuration changed event on this repository - - EventArgs.Empty - - - Applications that programmatically change the configuration of the repository should - raise this event notification to notify listeners. - - - - - - The name of the repository - - - The string name of the repository - - - - The name of this repository. The name is - used to store and lookup the repositories - stored by the . - - - - - - The threshold for all events in this repository - - - The threshold for all events in this repository - - - - The threshold for all events in this repository - - - - - - RendererMap accesses the object renderer map for this repository. - - - RendererMap accesses the object renderer map for this repository. - - - - RendererMap accesses the object renderer map for this repository. - - - The RendererMap holds a mapping between types and - objects. - - - - - - The plugin map for this repository. - - - The plugin map for this repository. - - - - The plugin map holds the instances - that have been attached to this repository. - - - - - - Get the level map for the Repository. - - - - Get the level map for the Repository. - - - The level map defines the mappings between - level names and objects in - this repository. - - - - - - Flag indicates if this repository has been configured. - - - Flag indicates if this repository has been configured. - - - - Flag indicates if this repository has been configured. - - - - - - Event to notify that the repository has been shutdown. - - - Event to notify that the repository has been shutdown. - - - - Event raised when the repository has been shutdown. - - - - - - Event to notify that the repository has had its configuration reset. - - - Event to notify that the repository has had its configuration reset. - - - - Event raised when the repository's configuration has been - reset to default. - - - - - - Event to notify that the repository has had its configuration changed. - - - Event to notify that the repository has had its configuration changed. - - - - Event raised when the repository's configuration has been changed. - - - - - - Repository specific properties - - - Repository specific properties - - - These properties can be specified on a repository specific basis - - - - - Basic Configurator interface for repositories - - - - Interface used by basic configurator to configure a - with a default . - - - A should implement this interface to support - configuration by the . - - - Nicko Cadell - Gert Driesen - - - - Initialize the repository using the specified appender - - the appender to use to log all logging events - - - Configure the repository to route all logging events to the - specified appender. - - - - - - Configure repository using XML - - - - Interface used by Xml configurator to configure a . - - - A should implement this interface to support - configuration by the . - - - Nicko Cadell - Gert Driesen - - - - Initialize the repository using the specified config - - the element containing the root of the config - - - The schema for the XML configuration data is defined by - the implementation. - - - - - - Default constructor - - - - Initializes a new instance of the class. - - - - - - Construct with properties - - The properties to pass to this repository. - - - Initializes a new instance of the class. - - - - - - Construct with a logger factory - - The factory to use to create new logger instances. - - - Initializes a new instance of the class with - the specified . - - - - - - Construct with properties and a logger factory - - The properties to pass to this repository. - The factory to use to create new logger instances. - - - Initializes a new instance of the class with - the specified . - - - - - - Test if a logger exists - - The name of the logger to lookup - The Logger object with the name specified - - - Check if the named logger exists in the hierarchy. If so return - its reference, otherwise returns null. - - - - - - Returns all the currently defined loggers in the hierarchy as an Array - - All the defined loggers - - - Returns all the currently defined loggers in the hierarchy as an Array. - The root logger is not included in the returned - enumeration. - - - - - - Return a new logger instance named as the first parameter using - the default factory. - - - - Return a new logger instance named as the first parameter using - the default factory. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. - - - The name of the logger to retrieve - The logger object with the name specified - - - - Shutting down a hierarchy will safely close and remove - all appenders in all loggers including the root logger. - - - - Shutting down a hierarchy will safely close and remove - all appenders in all loggers including the root logger. - - - Some appenders need to be closed before the - application exists. Otherwise, pending logging events might be - lost. - - - The Shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Reset all values contained in this hierarchy instance to their default. - - - - Reset all values contained in this hierarchy instance to their - default. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set its default "off" value. - - - Existing loggers are not removed. They are just reset. - - - This method should be used sparingly and with care as it will - block all logging until it is completed. - - - - - - Log the logEvent through this hierarchy. - - the event to log - - - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. - - - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. - - - - - - Returns all the Appenders that are currently configured - - An array containing all the currently configured appenders - - - Returns all the instances that are currently configured. - All the loggers are searched for appenders. The appenders may also be containers - for appenders and these are also searched for additional loggers. - - - The list returned is unordered but does not contain duplicates. - - - - - - Collect the appenders from an . - The appender may also be a container. - - - - - - - Collect the appenders from an container - - - - - - - Initialize the log4net system using the specified appender - - the appender to use to log all logging events - - - - Initialize the log4net system using the specified appender - - the appender to use to log all logging events - - - This method provides the same functionality as the - method implemented - on this object, but it is protected and therefore can be called by subclasses. - - - - - - Initialize the log4net system using the specified config - - the element containing the root of the config - - - - Initialize the log4net system using the specified config - - the element containing the root of the config - - - This method provides the same functionality as the - method implemented - on this object, but it is protected and therefore can be called by subclasses. - - - - - - Test if this hierarchy is disabled for the specified . - - The level to check against. - - true if the repository is disabled for the level argument, false otherwise. - - - - If this hierarchy has not been configured then this method will - always return true. - - - This method will return true if this repository is - disabled for level object passed as parameter and - false otherwise. - - - See also the property. - - - - - - Clear all logger definitions from the internal hashtable - - - - This call will clear all logger definitions from the internal - hashtable. Invoking this method will irrevocably mess up the - logger hierarchy. - - - You should really know what you are doing before - invoking this method. - - - - - - Return a new logger instance named as the first parameter using - . - - The name of the logger to retrieve - The factory that will make the new logger instance - The logger object with the name specified - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated by the - parameter and linked with its existing - ancestors as well as children. - - - - - - Sends a logger creation event to all registered listeners - - The newly created logger - - Raises the logger creation event. - - - - - Updates all the parents of the specified logger - - The logger to update the parents for - - - This method loops through all the potential parents of - . There 3 possible cases: - - - - No entry for the potential parent of exists - - We create a ProvisionNode for this potential - parent and insert in that provision node. - - - - The entry is of type Logger for the potential parent. - - The entry is 's nearest existing parent. We - update 's parent field with this entry. We also break from - he loop because updating our parent's parent is our parent's - responsibility. - - - - The entry is of type ProvisionNode for this potential parent. - - We add to the list of children for this - potential parent. - - - - - - - - Replace a with a in the hierarchy. - - - - - - We update the links for all the children that placed themselves - in the provision node 'pn'. The second argument 'log' is a - reference for the newly created Logger, parent of all the - children in 'pn'. - - - We loop on all the children 'c' in 'pn'. - - - If the child 'c' has been already linked to a child of - 'log' then there is no need to update 'c'. - - - Otherwise, we set log's parent field to c's parent and set - c's parent field to log. - - - - - - Define or redefine a Level using the values in the argument - - the level values - - - Define or redefine a Level using the values in the argument - - - Supports setting levels via the configuration file. - - - - - - Set a Property using the values in the argument - - the property value - - - Set a Property using the values in the argument. - - - Supports setting property values via the configuration file. - - - - - - Event used to notify that a logger has been created. - - - - Event raised when a logger is created. - - - - - - Has no appender warning been emitted - - - - Flag to indicate if we have already issued a warning - about not having an appender warning. - - - - - - Get the root of this hierarchy - - - - Get the root of this hierarchy. - - - - - - Gets or sets the default instance. - - The default - - - The logger factory is used to create logger instances. - - - - - - A class to hold the value, name and display name for a level - - - - A class to hold the value, name and display name for a level - - - - - - Override Object.ToString to return sensible debug info - - string info about this object - - - - Value of the level - - - - If the value is not set (defaults to -1) the value will be looked - up for the current level with the same name. - - - - - - Name of the level - - - The name of the level - - - - The name of the level. - - - - - - Display name for the level - - - The display name of the level - - - - The display name of the level. - - - - - - A class to hold the key and data for a property set in the config file - - - - A class to hold the key and data for a property set in the config file - - - - - - Override Object.ToString to return sensible debug info - - string info about this object - - - - Property Key - - - Property Key - - - - Property Key. - - - - - - Property Value - - - Property Value - - - - Property Value. - - - - - - Used internally to accelerate hash table searches. - - - - Internal class used to improve performance of - string keyed hashtables. - - - The hashcode of the string is cached for reuse. - The string is stored as an interned value. - When comparing two objects for equality - the reference equality of the interned strings is compared. - - - Nicko Cadell - Gert Driesen - - - - Construct key with string name - - - - Initializes a new instance of the class - with the specified name. - - - Stores the hashcode of the string and interns - the string key to optimize comparisons. - - - The Compact Framework 1.0 the - method does not work. On the Compact Framework - the string keys are not interned nor are they - compared by reference. - - - The name of the logger. - - - - Returns a hash code for the current instance. - - A hash code for the current instance. - - - Returns the cached hashcode. - - - - - - Determines whether two instances - are equal. - - The to compare with the current . - - true if the specified is equal to the current ; otherwise, false. - - - - Compares the references of the interned strings. - - - - - - Provision nodes are used where no logger instance has been specified - - - - instances are used in the - when there is no specified - for that node. - - - A provision node holds a list of child loggers on behalf of - a logger that does not exist. - - - Nicko Cadell - Gert Driesen - - - - Create a new provision node with child node - - A child logger to add to this node. - - - Initializes a new instance of the class - with the specified child logger. - - - - - - The sits at the root of the logger hierarchy tree. - - - - The is a regular except - that it provides several guarantees. - - - First, it cannot be assigned a null - level. Second, since the root logger cannot have a parent, the - property always returns the value of the - level field without walking the hierarchy. - - - Nicko Cadell - Gert Driesen - - - - Construct a - - The level to assign to the root logger. - - - Initializes a new instance of the class with - the specified logging level. - - - The root logger names itself as "root". However, the root - logger cannot be retrieved by name. - - - - - - Gets the assigned level value without walking the logger hierarchy. - - The assigned level value without walking the logger hierarchy. - - - Because the root logger cannot have a parent and its level - must not be null this property just returns the - value of . - - - - - - Gets or sets the assigned for the root logger. - - - The of the root logger. - - - - Setting the level of the root logger to a null reference - may have catastrophic results. We prevent this here. - - - - - - Initializes the log4net environment using an XML DOM. - - - - Configures a using an XML DOM. - - - Nicko Cadell - Gert Driesen - - - - Construct the configurator for a hierarchy - - The hierarchy to build. - - - Initializes a new instance of the class - with the specified . - - - - - - Configure the hierarchy by parsing a DOM tree of XML elements. - - The root element to parse. - - - Configure the hierarchy by parsing a DOM tree of XML elements. - - - - - - Parse appenders by IDREF. - - The appender ref element. - The instance of the appender that the ref refers to. - - - Parse an XML element that represents an appender and return - the appender. - - - - - - Parses an appender element. - - The appender element. - The appender instance or null when parsing failed. - - - Parse an XML element that represents an appender and return - the appender instance. - - - - - - Parses a logger element. - - The logger element. - - - Parse an XML element that represents a logger. - - - - - - Parses the root logger element. - - The root element. - - - Parse an XML element that represents the root logger. - - - - - - Parses the children of a logger element. - - The category element. - The logger instance. - Flag to indicate if the logger is the root logger. - - - Parse the child elements of a <logger> element. - - - - - - Parses an object renderer. - - The renderer element. - - - Parse an XML element that represents a renderer. - - - - - - Parses a level element. - - The level element. - The logger object to set the level on. - Flag to indicate if the logger is the root logger. - - - Parse an XML element that represents a level. - - - - - - Sets a parameter on an object. - - The parameter element. - The object to set the parameter on. - - The parameter name must correspond to a writable property - on the object. The value of the parameter is a string, - therefore this function will attempt to set a string - property first. If unable to set a string property it - will inspect the property and its argument type. It will - attempt to call a static method called Parse on the - type of the property. This method will take a single - string argument and return a value that can be used to - set the property. - - - - - Test if an element has no attributes or child elements - - the element to inspect - true if the element has any attributes or child elements, false otherwise - - - - Test if a is constructible with Activator.CreateInstance. - - the type to inspect - true if the type is creatable using a default constructor, false otherwise - - - - Look for a method on the that matches the supplied - - the type that has the method - the name of the method - the method info found - - - The method must be a public instance method on the . - The method must be named or "Add" followed by . - The method must take a single parameter. - - - - - - Converts a string value to a target type. - - The type of object to convert the string to. - The string value to use as the value of the object. - - - An object of type with value or - null when the conversion could not be performed. - - - - - - Creates an object as specified in XML. - - The XML element that contains the definition of the object. - The object type to use if not explicitly specified. - The type that the returned object must be or must inherit from. - The object or null - - - Parse an XML element and create an object instance based on the configuration - data. - - - The type of the instance may be specified in the XML. If not - specified then the is used - as the type. However the type is specified it must support the - type. - - - - - - key: appenderName, value: appender. - - - - - The Hierarchy being configured. - - - - - Delegate used to handle logger repository shutdown event notifications - - The that is shutting down. - Empty event args - - - Delegate used to handle logger repository shutdown event notifications. - - - - - - Delegate used to handle logger repository configuration reset event notifications - - The that has had its configuration reset. - Empty event args - - - Delegate used to handle logger repository configuration reset event notifications. - - - - - - Delegate used to handle event notifications for logger repository configuration changes. - - The that has had its configuration changed. - Empty event arguments. - - - Delegate used to handle event notifications for logger repository configuration changes. - - - - - - Write the name of the current AppDomain to the output - - - - Write the name of the current AppDomain to the output writer - - - Nicko Cadell - - - - Write the name of the current AppDomain to the output - - the writer to write to - null, state is not set - - - Writes name of the current AppDomain to the output . - - - - - - Write the current date to the output - - - - Date pattern converter, uses a to format - the current date and time to the writer as a string. - - - The value of the determines - the formatting of the date. The following values are allowed: - - - Option value - Output - - - ISO8601 - - Uses the formatter. - Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. - - - - DATE - - Uses the formatter. - Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". - - - - ABSOLUTE - - Uses the formatter. - Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". - - - - other - - Any other pattern string uses the formatter. - This formatter passes the pattern string to the - method. - For details on valid patterns see - DateTimeFormatInfo Class. - - - - - - The date and time is in the local time zone and is rendered in that zone. - To output the time in Universal time see . - - - Nicko Cadell - - - - The used to render the date to a string - - - - The used to render the date to a string - - - - - - Initialize the converter options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Write the current date to the output - - that will receive the formatted result. - null, state is not set - - - Pass the current date and time to the - for it to render it to the writer. - - - The date and time passed is in the local time zone. - - - - - - Write an environment variable to the output - - - - Write an environment variable to the output writer. - The value of the determines - the name of the variable to output. - - - Nicko Cadell - - - - Write an environment variable to the output - - the writer to write to - null, state is not set - - - Writes the environment variable to the output . - The name of the environment variable to output must be set - using the - property. - - - - - - Write the current thread identity to the output - - - - Write the current thread identity to the output writer - - - Nicko Cadell - - - - Write the current thread identity to the output - - the writer to write to - null, state is not set - - - Writes the current thread identity to the output . - - - - - - Pattern converter for literal string instances in the pattern - - - - Writes the literal string value specified in the - property to - the output. - - - Nicko Cadell - - - - Set the next converter in the chain - - The next pattern converter in the chain - The next pattern converter - - - Special case the building of the pattern converter chain - for instances. Two adjacent - literals in the pattern can be represented by a single combined - pattern converter. This implementation detects when a - is added to the chain - after this converter and combines its value with this converter's - literal value. - - - - - - Write the literal to the output - - the writer to write to - null, not set - - - Override the formatting behavior to ignore the FormattingInfo - because we have a literal instead. - - - Writes the value of - to the output . - - - - - - Convert this pattern into the rendered message - - that will receive the formatted result. - null, not set - - - This method is not used. - - - - - - Writes a newline to the output - - - - Writes the system dependent line terminator to the output. - This behavior can be overridden by setting the : - - - - Option Value - Output - - - DOS - DOS or Windows line terminator "\r\n" - - - UNIX - UNIX line terminator "\n" - - - - Nicko Cadell - - - - Initialize the converter - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Write the current process ID to the output - - - - Write the current process ID to the output writer - - - Nicko Cadell - - - - Write the current process ID to the output - - the writer to write to - null, state is not set - - - Write the current process ID to the output . - - - - - - Property pattern converter - - - - This pattern converter reads the thread and global properties. - The thread properties take priority over global properties. - See for details of the - thread properties. See for - details of the global properties. - - - If the is specified then that will be used to - lookup a single property. If no is specified - then all properties will be dumped as a list of key value pairs. - - - Nicko Cadell - - - - Write the property value to the output - - that will receive the formatted result. - null, state is not set - - - Writes out the value of a named property. The property name - should be set in the - property. - - - If the is set to null - then all the properties are written as key value pairs. - - - - - - A Pattern converter that generates a string of random characters - - - - The converter generates a string of random characters. By default - the string is length 4. This can be changed by setting the - to the string value of the length required. - - - The random characters in the string are limited to uppercase letters - and numbers only. - - - The random number generator used by this class is not cryptographically secure. - - - Nicko Cadell - - - - Shared random number generator - - - - - Length of random string to generate. Default length 4. - - - - - Initialize the converter options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Write a randoim string to the output - - the writer to write to - null, state is not set - - - Write a randoim string to the output . - - - - - - Write the current threads username to the output - - - - Write the current threads username to the output writer - - - Nicko Cadell - - - - Write the current threads username to the output - - the writer to write to - null, state is not set - - - Write the current threads username to the output . - - - - - - Write the UTC date time to the output - - - - Date pattern converter, uses a to format - the current date and time in Universal time. - - - See the for details on the date pattern syntax. - - - - Nicko Cadell - - - - Write the current date and time to the output - - that will receive the formatted result. - null, state is not set - - - Pass the current date and time to the - for it to render it to the writer. - - - The date is in Universal time when it is rendered. - - - - - - - Type converter for Boolean. - - - - Supports conversion from string to bool type. - - - - - - Nicko Cadell - Gert Driesen - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Convert the source object to the type supported by this object - - the object to convert - the converted object - - - Uses the method to convert the - argument to a . - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Exception base type for conversion errors. - - - - This type extends . It - does not add any new functionality but does differentiate the - type of exception being thrown. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Constructor - - A message to include with the exception. - - - Initializes a new instance of the class - with the specified message. - - - - - - Constructor - - A message to include with the exception. - A nested exception to include. - - - Initializes a new instance of the class - with the specified message and inner exception. - - - - - - Serialization constructor - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - - - Initializes a new instance of the class - with serialized data. - - - - - - Creates a new instance of the class. - - The conversion destination type. - The value to convert. - An instance of the . - - - Creates a new instance of the class. - - - - - - Creates a new instance of the class. - - The conversion destination type. - The value to convert. - A nested exception to include. - An instance of the . - - - Creates a new instance of the class. - - - - - - Register of type converters for specific types. - - - - Maintains a registry of type converters used to convert between - types. - - - Use the and - methods to register new converters. - The and methods - lookup appropriate converters to use. - - - - - Nicko Cadell - Gert Driesen - - - - Private constructor - - - Initializes a new instance of the class. - - - - - Static constructor. - - - - This constructor defines the intrinsic type converters. - - - - - - Adds a converter for a specific type. - - The type being converted to. - The type converter to use to convert to the destination type. - - - Adds a converter instance for a specific type. - - - - - - Adds a converter for a specific type. - - The type being converted to. - The type of the type converter to use to convert to the destination type. - - - Adds a converter for a specific type. - - - - - - Gets the type converter to use to convert values to the destination type. - - The type being converted from. - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - - - - Gets the type converter to use to convert values to the destination type. - - - - - - Gets the type converter to use to convert values to the destination type. - - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - - - - Gets the type converter to use to convert values to the destination type. - - - - - - Lookups the type converter to use as specified by the attributes on the - destination type. - - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - - - - - Creates the instance of the type converter. - - The type of the type converter. - - The type converter instance to use for type conversions or null - if no type converter is found. - - - - The type specified for the type converter must implement - the or interfaces - and must have a public default (no argument) constructor. - - - - - - Mapping from to type converter. - - - - - Supports conversion from string to type. - - - - Supports conversion from string to type. - - - - - - Nicko Cadell - Gert Driesen - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Overrides the ConvertFrom method of IConvertFrom. - - the object to convert to an encoding - the encoding - - - Uses the method to - convert the argument to an . - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Interface supported by type converters - - - - This interface supports conversion from a single type to arbitrary types. - See . - - - Nicko Cadell - - - - Returns whether this converter can convert the object to the specified type - - A Type that represents the type you want to convert to - true if the conversion is possible - - - Test if the type supported by this converter can be converted to the - . - - - - - - Converts the given value object to the specified type, using the arguments - - the object to convert - The Type to convert the value parameter to - the converted object - - - Converts the (which must be of the type supported - by this converter) to the specified.. - - - - - - Supports conversion from string to type. - - - - Supports conversion from string to type. - - - - - Nicko Cadell - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Overrides the ConvertFrom method of IConvertFrom. - - the object to convert to an IPAddress - the IPAddress - - - Uses the method to convert the - argument to an . - If that fails then the string is resolved as a DNS hostname. - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) - - - - - Supports conversion from string to type. - - - - Supports conversion from string to type. - - - The string is used as the - of the . - - - - - - Nicko Cadell - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Overrides the ConvertFrom method of IConvertFrom. - - the object to convert to a PatternLayout - the PatternLayout - - - Creates and returns a new using - the as the - . - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Convert between string and - - - - Supports conversion from string to type, - and from a type to a string. - - - The string is used as the - of the . - - - - - - Nicko Cadell - - - - Can the target type be converted to the type supported by this object - - A that represents the type you want to convert to - true if the conversion is possible - - - Returns true if the is - assignable from a type. - - - - - - Converts the given value object to the specified type, using the arguments - - the object to convert - The Type to convert the value parameter to - the converted object - - - Uses the method to convert the - argument to a . - - - - The object cannot be converted to the - . To check for this condition use the - method. - - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Overrides the ConvertFrom method of IConvertFrom. - - the object to convert to a PatternString - the PatternString - - - Creates and returns a new using - the as the - . - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Supports conversion from string to type. - - - - Supports conversion from string to type. - - - - - - Nicko Cadell - - - - Can the source type be converted to the type supported by this object - - the type to convert - true if the conversion is possible - - - Returns true if the is - the type. - - - - - - Overrides the ConvertFrom method of IConvertFrom. - - the object to convert to a Type - the Type - - - Uses the method to convert the - argument to a . - Additional effort is made to locate partially specified types - by searching the loaded assemblies. - - - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Attribute used to associate a type converter - - - - Class and Interface level attribute that specifies a type converter - to use with the associated type. - - - To associate a type converter with a target type apply a - TypeConverterAttribute to the target type. Specify the - type of the type converter on the attribute. - - - Nicko Cadell - Gert Driesen - - - - The string type name of the type converter - - - - - Default constructor - - - - Default constructor - - - - - - Create a new type converter attribute for the specified type name - - The string type name of the type converter - - - The type specified must implement the - or the interfaces. - - - - - - Create a new type converter attribute for the specified type - - The type of the type converter - - - The type specified must implement the - or the interfaces. - - - - - - The string type name of the type converter - - - The string type name of the type converter - - - - The type specified must implement the - or the interfaces. - - - - - - A straightforward implementation of the interface. - - - - This is the default implementation of the - interface. Implementors of the interface - should aggregate an instance of this type. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Append on on all attached appenders. - - The event being logged. - The number of appenders called. - - - Calls the method on all - attached appenders. - - - - - - Append on on all attached appenders. - - The array of events being logged. - The number of appenders called. - - - Calls the method on all - attached appenders. - - - - - - Calls the DoAppende method on the with - the objects supplied. - - The appender - The events - - - If the supports the - interface then the will be passed - through using that interface. Otherwise the - objects in the array will be passed one at a time. - - - - - - Attaches an appender. - - The appender to add. - - - If the appender is already in the list it won't be added again. - - - - - - Gets an attached appender with the specified name. - - The name of the appender to get. - - The appender with the name specified, or null if no appender with the - specified name is found. - - - - Lookup an attached appender by name. - - - - - - Removes all attached appenders. - - - - Removes and closes all attached appenders - - - - - - Removes the specified appender from the list of attached appenders. - - The appender to remove. - The appender removed from the list - - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - Removes the appender with the specified name from the list of appenders. - - The name of the appender to remove. - The appender removed from the list - - - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. - - - - - - List of appenders - - - - - Array of appenders, used to cache the m_appenderList - - - - - Gets all attached appenders. - - - A collection of attached appenders, or null if there - are no attached appenders. - - - - The read only collection of all currently attached appenders. - - - - - - This class aggregates several PropertiesDictionary collections together. - - - - Provides a dictionary style lookup over an ordered list of - collections. - - - Nicko Cadell - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Add a Properties Dictionary to this composite collection - - the properties to add - - - Properties dictionaries added first take precedence over dictionaries added - later. - - - - - - Flatten this composite collection into a single properties dictionary - - the flattened dictionary - - - Reduces the collection of ordered dictionaries to a single dictionary - containing the resultant values for the keys. - - - - - - Gets the value of a property - - - The value for the property with the specified key - - - - Looks up the value for the specified. - The collections are searched - in the order in which they were added to this collection. The value - returned is the value held by the first collection that contains - the specified key. - - - If none of the collections contain the specified key then - null is returned. - - - - - - Base class for Context Properties implementations - - - - This class defines a basic property get set accessor - - - Nicko Cadell - - - - Gets or sets the value of a property - - - The value for the property with the specified key - - - - Gets or sets the value of a property - - - - - - Subclass of that maintains a count of - the number of bytes written. - - - - This writer counts the number of bytes written. - - - Nicko Cadell - Gert Driesen - - - - that does not leak exceptions - - - - does not throw exceptions when things go wrong. - Instead, it delegates error handling to its . - - - Nicko Cadell - Gert Driesen - - - - Adapter that extends and forwards all - messages to an instance of . - - - - Adapter that extends and forwards all - messages to an instance of . - - - Nicko Cadell - - - - The writer to forward messages to - - - - - Create an instance of that forwards all - messages to a . - - The to forward to - - - Create an instance of that forwards all - messages to a . - - - - - - Closes the writer and releases any system resources associated with the writer - - - - - - - - - Dispose this writer - - flag indicating if we are being disposed - - - Dispose this writer - - - - - - Flushes any buffered output - - - - Clears all buffers for the writer and causes any buffered data to be written - to the underlying device - - - - - - Writes a character to the wrapped TextWriter - - the value to write to the TextWriter - - - Writes a character to the wrapped TextWriter - - - - - - Writes a character buffer to the wrapped TextWriter - - the data buffer - the start index - the number of characters to write - - - Writes a character buffer to the wrapped TextWriter - - - - - - Writes a string to the wrapped TextWriter - - the value to write to the TextWriter - - - Writes a string to the wrapped TextWriter - - - - - - Gets or sets the underlying . - - - The underlying . - - - - Gets or sets the underlying . - - - - - - The Encoding in which the output is written - - - The - - - - The Encoding in which the output is written - - - - - - Gets an object that controls formatting - - - The format provider - - - - Gets an object that controls formatting - - - - - - Gets or sets the line terminator string used by the TextWriter - - - The line terminator to use - - - - Gets or sets the line terminator string used by the TextWriter - - - - - - Constructor - - the writer to actually write to - the error handler to report error to - - - Create a new QuietTextWriter using a writer and error handler - - - - - - Writes a character to the underlying writer - - the char to write - - - Writes a character to the underlying writer - - - - - - Writes a buffer to the underlying writer - - the buffer to write - the start index to write from - the number of characters to write - - - Writes a buffer to the underlying writer - - - - - - Writes a string to the output. - - The string data to write to the output. - - - Writes a string to the output. - - - - - - Closes the underlying output writer. - - - - Closes the underlying output writer. - - - - - - The error handler instance to pass all errors to - - - - - Flag to indicate if this writer is closed - - - - - Gets or sets the error handler that all errors are passed to. - - - The error handler that all errors are passed to. - - - - Gets or sets the error handler that all errors are passed to. - - - - - - Gets a value indicating whether this writer is closed. - - - true if this writer is closed, otherwise false. - - - - Gets a value indicating whether this writer is closed. - - - - - - Constructor - - The to actually write to. - The to report errors to. - - - Creates a new instance of the class - with the specified and . - - - - - - Writes a character to the underlying writer and counts the number of bytes written. - - the char to write - - - Overrides implementation of . Counts - the number of bytes written. - - - - - - Writes a buffer to the underlying writer and counts the number of bytes written. - - the buffer to write - the start index to write from - the number of characters to write - - - Overrides implementation of . Counts - the number of bytes written. - - - - - - Writes a string to the output and counts the number of bytes written. - - The string data to write to the output. - - - Overrides implementation of . Counts - the number of bytes written. - - - - - - Total number of bytes written. - - - - - Gets or sets the total number of bytes written. - - - The total number of bytes written. - - - - Gets or sets the total number of bytes written. - - - - - - A fixed size rolling buffer of logging events. - - - - An array backed fixed size leaky bucket. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - The maximum number of logging events in the buffer. - - - Initializes a new instance of the class with - the specified maximum number of buffered logging events. - - - The argument is not a positive integer. - - - - Appends a to the buffer. - - The event to append to the buffer. - The event discarded from the buffer, if the buffer is full, otherwise null. - - - Append an event to the buffer. If the buffer still contains free space then - null is returned. If the buffer is full then an event will be dropped - to make space for the new event, the event dropped is returned. - - - - - - Get and remove the oldest event in the buffer. - - The oldest logging event in the buffer - - - Gets the oldest (first) logging event in the buffer and removes it - from the buffer. - - - - - - Pops all the logging events from the buffer into an array. - - An array of all the logging events in the buffer. - - - Get all the events in the buffer and clear the buffer. - - - - - - Clear the buffer - - - - Clear the buffer of all events. The events in the buffer are lost. - - - - - - Gets the th oldest event currently in the buffer. - - The th oldest event currently in the buffer. - - - If is outside the range 0 to the number of events - currently in the buffer, then null is returned. - - - - - - Gets the maximum size of the buffer. - - The maximum size of the buffer. - - - Gets the maximum size of the buffer - - - - - - Gets the number of logging events in the buffer. - - The number of logging events in the buffer. - - - This number is guaranteed to be in the range 0 to - (inclusive). - - - - - - An always empty . - - - - A singleton implementation of the - interface that always represents an empty collection. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to enforce the singleton pattern. - - - - - - Copies the elements of the to an - , starting at a particular Array index. - - The one-dimensional - that is the destination of the elements copied from - . The Array must have zero-based - indexing. - The zero-based index in array at which - copying begins. - - - As the collection is empty no values are copied into the array. - - - - - - Returns an enumerator that can iterate through a collection. - - - An that can be used to - iterate through the collection. - - - - As the collection is empty a is returned. - - - - - - The singleton instance of the empty collection. - - - - - Gets the singleton instance of the empty collection. - - The singleton instance of the empty collection. - - - Gets the singleton instance of the empty collection. - - - - - - Gets a value indicating if access to the is synchronized (thread-safe). - - - true if access to the is synchronized (thread-safe); otherwise, false. - - - - For the this property is always true. - - - - - - Gets the number of elements contained in the . - - - The number of elements contained in the . - - - - As the collection is empty the is always 0. - - - - - - Gets an object that can be used to synchronize access to the . - - - An object that can be used to synchronize access to the . - - - - As the collection is empty and thread safe and synchronized this instance is also - the object. - - - - - - An always empty . - - - - A singleton implementation of the - interface that always represents an empty collection. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to enforce the singleton pattern. - - - - - - Copies the elements of the to an - , starting at a particular Array index. - - The one-dimensional - that is the destination of the elements copied from - . The Array must have zero-based - indexing. - The zero-based index in array at which - copying begins. - - - As the collection is empty no values are copied into the array. - - - - - - Returns an enumerator that can iterate through a collection. - - - An that can be used to - iterate through the collection. - - - - As the collection is empty a is returned. - - - - - - Adds an element with the provided key and value to the - . - - The to use as the key of the element to add. - The to use as the value of the element to add. - - - As the collection is empty no new values can be added. A - is thrown if this method is called. - - - This dictionary is always empty and cannot be modified. - - - - Removes all elements from the . - - - - As the collection is empty no values can be removed. A - is thrown if this method is called. - - - This dictionary is always empty and cannot be modified. - - - - Determines whether the contains an element - with the specified key. - - The key to locate in the . - false - - - As the collection is empty the method always returns false. - - - - - - Returns an enumerator that can iterate through a collection. - - - An that can be used to - iterate through the collection. - - - - As the collection is empty a is returned. - - - - - - Removes the element with the specified key from the . - - The key of the element to remove. - - - As the collection is empty no values can be removed. A - is thrown if this method is called. - - - This dictionary is always empty and cannot be modified. - - - - The singleton instance of the empty dictionary. - - - - - Gets the singleton instance of the . - - The singleton instance of the . - - - Gets the singleton instance of the . - - - - - - Gets a value indicating if access to the is synchronized (thread-safe). - - - true if access to the is synchronized (thread-safe); otherwise, false. - - - - For the this property is always true. - - - - - - Gets the number of elements contained in the - - - The number of elements contained in the . - - - - As the collection is empty the is always 0. - - - - - - Gets an object that can be used to synchronize access to the . - - - An object that can be used to synchronize access to the . - - - - As the collection is empty and thread safe and synchronized this instance is also - the object. - - - - - - Gets a value indicating whether the has a fixed size. - - true - - - As the collection is empty always returns true. - - - - - - Gets a value indicating whether the is read-only. - - true - - - As the collection is empty always returns true. - - - - - - Gets an containing the keys of the . - - An containing the keys of the . - - - As the collection is empty a is returned. - - - - - - Gets an containing the values of the . - - An containing the values of the . - - - As the collection is empty a is returned. - - - - - - Gets or sets the element with the specified key. - - The key of the element to get or set. - null - - - As the collection is empty no values can be looked up or stored. - If the index getter is called then null is returned. - A is thrown if the setter is called. - - - This dictionary is always empty and cannot be modified. - - - - Contain the information obtained when parsing formatting modifiers - in conversion modifiers. - - - - Holds the formatting information extracted from the format string by - the . This is used by the - objects when rendering the output. - - - Nicko Cadell - Gert Driesen - - - - Defaut Constructor - - - - Initializes a new instance of the class. - - - - - - Constructor - - - - Initializes a new instance of the class - with the specified parameters. - - - - - - Gets or sets the minimum value. - - - The minimum value. - - - - Gets or sets the minimum value. - - - - - - Gets or sets the maximum value. - - - The maximum value. - - - - Gets or sets the maximum value. - - - - - - Gets or sets a flag indicating whether left align is enabled - or not. - - - A flag indicating whether left align is enabled or not. - - - - Gets or sets a flag indicating whether left align is enabled or not. - - - - - - Implementation of Properties collection for the - - - - This class implements a properties collection that is thread safe and supports both - storing properties and capturing a read only copy of the current propertied. - - - This class is optimized to the scenario where the properties are read frequently - and are modified infrequently. - - - Nicko Cadell - - - - The read only copy of the properties. - - - - This variable is declared volatile to prevent the compiler and JIT from - reordering reads and writes of this thread performed on different threads. - - - - - - Lock object used to synchronize updates within this instance - - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Remove a property from the global context - - the key for the entry to remove - - - Removing an entry from the global context properties is relatively expensive compared - with reading a value. - - - - - - Clear the global context properties - - - - - Get a readonly immutable copy of the properties - - the current global context properties - - - This implementation is fast because the GlobalContextProperties class - stores a readonly copy of the properties. - - - - - - Gets or sets the value of a property - - - The value for the property with the specified key - - - - Reading the value for a key is faster than setting the value. - When the value is written a new read only copy of - the properties is created. - - - - - - Manages a mapping from levels to - - - - Manages an ordered mapping from instances - to subclasses. - - - Nicko Cadell - - - - Default constructor - - - - Initialise a new instance of . - - - - - - Add a to this mapping - - the entry to add - - - If a has previously been added - for the same then that entry will be - overwritten. - - - - - - Lookup the mapping for the specified level - - the level to lookup - the for the level or null if no mapping found - - - Lookup the value for the specified level. Finds the nearest - mapping value for the level that is equal to or less than the - specified. - - - If no mapping could be found then null is returned. - - - - - - Initialize options - - - - Caches the sorted list of in an array - - - - - - Implementation of Properties collection for the - - - - Class implements a collection of properties that is specific to each thread. - The class is not synchronized as each thread has its own . - - - Nicko Cadell - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Remove a property - - the key for the entry to remove - - - Remove the value for the specified from the context. - - - - - - Clear all the context properties - - - - Clear all the context properties - - - - - - Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. - - create the dictionary if it does not exist, otherwise return null if is does not exist - the properties for this thread - - - The collection returned is only to be used on the calling thread. If the - caller needs to share the collection between different threads then the - caller must clone the collection before doings so. - - - - - - Gets or sets the value of a property - - - The value for the property with the specified key - - - - Get or set the property value for the specified. - - - - - - Outputs log statements from within the log4net assembly. - - - - Log4net components cannot make log4net logging calls. However, it is - sometimes useful for the user to learn about what log4net is - doing. - - - All log4net internal debug calls go to the standard output stream - whereas internal error messages are sent to the standard error output - stream. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - Static constructor that initializes logging by reading - settings from the application configuration file. - - - - The log4net.Internal.Debug application setting - controls internal debugging. This setting should be set - to true to enable debugging. - - - The log4net.Internal.Quiet application setting - suppresses all internal logging including error messages. - This setting should be set to true to enable message - suppression. - - - - - - Writes log4net internal debug messages to the - standard output stream. - - The message to log. - - - All internal debug messages are prepended with - the string "log4net: ". - - - - - - Writes log4net internal debug messages to the - standard output stream. - - The message to log. - An exception to log. - - - All internal debug messages are prepended with - the string "log4net: ". - - - - - - Writes log4net internal warning messages to the - standard error stream. - - The message to log. - - - All internal warning messages are prepended with - the string "log4net:WARN ". - - - - - - Writes log4net internal warning messages to the - standard error stream. - - The message to log. - An exception to log. - - - All internal warning messages are prepended with - the string "log4net:WARN ". - - - - - - Writes log4net internal error messages to the - standard error stream. - - The message to log. - - - All internal error messages are prepended with - the string "log4net:ERROR ". - - - - - - Writes log4net internal error messages to the - standard error stream. - - The message to log. - An exception to log. - - - All internal debug messages are prepended with - the string "log4net:ERROR ". - - - - - - Writes output to the standard output stream. - - The message to log. - - - Writes to both Console.Out and System.Diagnostics.Trace. - Note that the System.Diagnostics.Trace is not supported - on the Compact Framework. - - - If the AppDomain is not configured with a config file then - the call to System.Diagnostics.Trace may fail. This is only - an issue if you are programmatically creating your own AppDomains. - - - - - - Writes output to the standard error stream. - - The message to log. - - - Writes to both Console.Error and System.Diagnostics.Trace. - Note that the System.Diagnostics.Trace is not supported - on the Compact Framework. - - - If the AppDomain is not configured with a config file then - the call to System.Diagnostics.Trace may fail. This is only - an issue if you are programmatically creating your own AppDomains. - - - - - - Default debug level - - - - - In quietMode not even errors generate any output. - - - - - Gets or sets a value indicating whether log4net internal logging - is enabled or disabled. - - - true if log4net internal logging is enabled, otherwise - false. - - - - When set to true, internal debug level logging will be - displayed. - - - This value can be set by setting the application setting - log4net.Internal.Debug in the application configuration - file. - - - The default value is false, i.e. debugging is - disabled. - - - - - The following example enables internal debugging using the - application configuration file : - - - - - - - - - - - - - Gets or sets a value indicating whether log4net should generate no output - from internal logging, not even for errors. - - - true if log4net should generate no output at all from internal - logging, otherwise false. - - - - When set to true will cause internal logging at all levels to be - suppressed. This means that no warning or error reports will be logged. - This option overrides the setting and - disables all debug also. - - This value can be set by setting the application setting - log4net.Internal.Quiet in the application configuration file. - - - The default value is false, i.e. internal logging is not - disabled. - - - - The following example disables internal logging using the - application configuration file : - - - - - - - - - - - - Test if LogLog.Debug is enabled for output. - - - true if Debug is enabled - - - - Test if LogLog.Debug is enabled for output. - - - - - - Test if LogLog.Warn is enabled for output. - - - true if Warn is enabled - - - - Test if LogLog.Warn is enabled for output. - - - - - - Test if LogLog.Error is enabled for output. - - - true if Error is enabled - - - - Test if LogLog.Error is enabled for output. - - - - - - Represents a native error code and message. - - - - Represents a Win32 platform native error. - - - Nicko Cadell - Gert Driesen - - - - Create an instance of the class with the specified - error number and message. - - The number of the native error. - The message of the native error. - - - Create an instance of the class with the specified - error number and message. - - - - - - Create a new instance of the class for the last Windows error. - - - An instance of the class for the last windows error. - - - - The message for the error number is lookup up using the - native Win32 FormatMessage function. - - - - - - Create a new instance of the class. - - the error number for the native error - - An instance of the class for the specified - error number. - - - - The message for the specified error number is lookup up using the - native Win32 FormatMessage function. - - - - - - Retrieves the message corresponding with a Win32 message identifier. - - Message identifier for the requested message. - - The message corresponding with the specified message identifier. - - - - The message will be searched for in system message-table resource(s) - using the native FormatMessage function. - - - - - - Return error information string - - error information string - - - Return error information string - - - - - - Formats a message string. - - Formatting options, and how to interpret the parameter. - Location of the message definition. - Message identifier for the requested message. - Language identifier for the requested message. - If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . - If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the maximum number of TCHARs that can be stored in the output buffer. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, this parameter specifies the minimum number of TCHARs to allocate for an output buffer. - Pointer to an array of values that are used as insert values in the formatted message. - - - The function requires a message definition as input. The message definition can come from a - buffer passed into the function. It can come from a message table resource in an - already-loaded module. Or the caller can ask the function to search the system's message - table resource(s) for the message definition. The function finds the message definition - in a message table resource based on a message identifier and a language identifier. - The function copies the formatted message text to an output buffer, processing any embedded - insert sequences if requested. - - - To prevent the usage of unsafe code, this stub does not support inserting values in the formatted message. - - - - - If the function succeeds, the return value is the number of TCHARs stored in the output - buffer, excluding the terminating null character. - - - If the function fails, the return value is zero. To get extended error information, - call . - - - - - - Gets the number of the native error. - - - The number of the native error. - - - - Gets the number of the native error. - - - - - - Gets the message of the native error. - - - The message of the native error. - - - - - Gets the message of the native error. - - - - - An always empty . - - - - A singleton implementation of the over a collection - that is empty and not modifiable. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to enforce the singleton pattern. - - - - - - Test if the enumerator can advance, if so advance. - - false as the cannot advance. - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will always return false. - - - - - - Resets the enumerator back to the start. - - - - As the enumerator is over an empty collection does nothing. - - - - - - The singleton instance of the . - - - - - Gets the singleton instance of the . - - The singleton instance of the . - - - Gets the singleton instance of the . - - - - - - Gets the current object from the enumerator. - - - Throws an because the - never has a current value. - - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will throw an . - - - The collection is empty and - cannot be positioned over a valid location. - - - - Gets the current key from the enumerator. - - - Throws an exception because the - never has a current value. - - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will throw an . - - - The collection is empty and - cannot be positioned over a valid location. - - - - Gets the current value from the enumerator. - - The current value from the enumerator. - - Throws an because the - never has a current value. - - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will throw an . - - - The collection is empty and - cannot be positioned over a valid location. - - - - Gets the current entry from the enumerator. - - - Throws an because the - never has a current entry. - - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will throw an . - - - The collection is empty and - cannot be positioned over a valid location. - - - - An always empty . - - - - A singleton implementation of the over a collection - that is empty and not modifiable. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to enforce the singleton pattern. - - - - - - Test if the enumerator can advance, if so advance - - false as the cannot advance. - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will always return false. - - - - - - Resets the enumerator back to the start. - - - - As the enumerator is over an empty collection does nothing. - - - - - - The singleton instance of the . - - - - - Get the singleton instance of the . - - The singleton instance of the . - - - Gets the singleton instance of the . - - - - - - Gets the current object from the enumerator. - - - Throws an because the - never has a current value. - - - - As the enumerator is over an empty collection its - value cannot be moved over a valid position, therefore - will throw an . - - - The collection is empty and - cannot be positioned over a valid location. - - - - A SecurityContext used when a SecurityContext is not required - - - - The is a no-op implementation of the - base class. It is used where a - is required but one has not been provided. - - - Nicko Cadell - - - - Singleton instance of - - - - Singleton instance of - - - - - - Private constructor - - - - Private constructor for singleton pattern. - - - - - - Impersonate this SecurityContext - - State supplied by the caller - null - - - No impersonation is done and null is always returned. - - - - - - Implements log4net's default error handling policy which consists - of emitting a message for the first error in an appender and - ignoring all subsequent errors. - - - - The error message is printed on the standard error output stream. - - - This policy aims at protecting an otherwise working application - from being flooded with error messages when logging fails. - - - Nicko Cadell - Gert Driesen - - - - Default Constructor - - - - Initializes a new instance of the class. - - - - - - Constructor - - The prefix to use for each message. - - - Initializes a new instance of the class - with the specified prefix. - - - - - - Log an Error - - The error message. - The exception. - The internal error code. - - - Prints the message and the stack trace of the exception on the standard - error output stream. - - - - - - Log an Error - - The error message. - The exception. - - - Prints the message and the stack trace of the exception on the standard - error output stream. - - - - - - Log an error - - The error message. - - - Print a the error message passed as parameter on the standard - error output stream. - - - - - - Flag to indicate if it is the first error - - - - - String to prefix each message with - - - - - Is error logging enabled - - - - Is error logging enabled. Logging is only enabled for the - first error delivered to the . - - - - - - A convenience class to convert property values to specific types. - - - - Utility functions for converting types and parsing values. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - Converts a string to a value. - - String to convert. - The default value. - The value of . - - - If is "true", then true is returned. - If is "false", then false is returned. - Otherwise, is returned. - - - - - - Parses a file size into a number. - - String to parse. - The default value. - The value of . - - - Parses a file size of the form: number[KB|MB|GB] into a - long value. It is scaled with the appropriate multiplier. - - - is returned when - cannot be converted to a value. - - - - - - Converts a string to an object. - - The target type to convert to. - The string to convert to an object. - - The object converted from a string or null when the - conversion failed. - - - - Converts a string to an object. Uses the converter registry to try - to convert the string value into the specified target type. - - - - - - Checks if there is an appropriate type conversion from the source type to the target type. - - The type to convert from. - The type to convert to. - true if there is a conversion from the source type to the target type. - - Checks if there is an appropriate type conversion from the source type to the target type. - - - - - - - Converts an object to the target type. - - The object to convert to the target type. - The type to convert to. - The converted object. - - - Converts an object to the target type. - - - - - - Instantiates an object given a class name. - - The fully qualified class name of the object to instantiate. - The class to which the new object should belong. - The object to return in case of non-fulfillment. - - An instance of the or - if the object could not be instantiated. - - - - Checks that the is a subclass of - . If that test fails or the object could - not be instantiated, then is returned. - - - - - - Performs variable substitution in string from the - values of keys found in . - - The string on which variable substitution is performed. - The dictionary to use to lookup variables. - The result of the substitutions. - - - The variable substitution delimiters are ${ and }. - - - For example, if props contains key=value, then the call - - - - string s = OptionConverter.SubstituteVariables("Value of key is ${key}."); - - - - will set the variable s to "Value of key is value.". - - - If no value could be found for the specified key, then substitution - defaults to an empty string. - - - For example, if system properties contains no value for the key - "nonExistentKey", then the call - - - - string s = OptionConverter.SubstituteVariables("Value of nonExistentKey is [${nonExistentKey}]"); - - - - will set s to "Value of nonExistentKey is []". - - - An Exception is thrown if contains a start - delimiter "${" which is not balanced by a stop delimiter "}". - - - - - - Converts the string representation of the name or numeric value of one or - more enumerated constants to an equivalent enumerated object. - - The type to convert to. - The enum string value. - If true, ignore case; otherwise, regard case. - An object of type whose value is represented by . - - - - Most of the work of the class - is delegated to the PatternParser class. - - - - The PatternParser processes a pattern string and - returns a chain of objects. - - - Nicko Cadell - Gert Driesen - - - - Constructor - - The pattern to parse. - - - Initializes a new instance of the class - with the specified pattern string. - - - - - - Parses the pattern into a chain of pattern converters. - - The head of a chain of pattern converters. - - - Parses the pattern into a chain of pattern converters. - - - - - - Build the unified cache of converters from the static and instance maps - - the list of all the converter names - - - Build the unified cache of converters from the static and instance maps - - - - - - Internal method to parse the specified pattern to find specified matches - - the pattern to parse - the converter names to match in the pattern - - - The matches param must be sorted such that longer strings come before shorter ones. - - - - - - Process a parsed literal - - the literal text - - - - Process a parsed converter pattern - - the name of the converter - the optional option for the converter - the formatting info for the converter - - - - Resets the internal state of the parser and adds the specified pattern converter - to the chain. - - The pattern converter to add. - - - - The first pattern converter in the chain - - - - - the last pattern converter in the chain - - - - - The pattern - - - - - Internal map of converter identifiers to converter types - - - - This map overrides the static s_globalRulesRegistry map. - - - - - - Get the converter registry used by this parser - - - The converter registry used by this parser - - - - Get the converter registry used by this parser - - - - - - Sort strings by length - - - - that orders strings by string length. - The longest strings are placed first - - - - - - This class implements a patterned string. - - - - This string has embedded patterns that are resolved and expanded - when the string is formatted. - - - This class functions similarly to the - in that it accepts a pattern and renders it to a string. Unlike the - however the PatternString - does not render the properties of a specific but - of the process in general. - - - The recognized conversion pattern names are: - - - - Conversion Pattern Name - Effect - - - appdomain - - - Used to output the friendly name of the current AppDomain. - - - - - date - - - Used to output the date of the logging event in the local time zone. - To output the date in universal time use the %utcdate pattern. - The date conversion - specifier may be followed by a date format specifier enclosed - between braces. For example, %date{HH:mm:ss,fff} or - %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is - given then ISO8601 format is - assumed (). - - - The date format specifier admits the same syntax as the - time pattern string of the . - - - For better results it is recommended to use the log4net date - formatters. These can be specified using one of the strings - "ABSOLUTE", "DATE" and "ISO8601" for specifying - , - and respectively - . For example, - %date{ISO8601} or %date{ABSOLUTE}. - - - These dedicated date formatters perform significantly - better than . - - - - - env - - - Used to output the a specific environment variable. The key to - lookup must be specified within braces and directly following the - pattern specifier, e.g. %env{COMPUTERNAME} would include the value - of the COMPUTERNAME environment variable. - - - The env pattern is not supported on the .NET Compact Framework. - - - - - identity - - - Used to output the user name for the currently active user - (Principal.Identity.Name). - - - - - newline - - - Outputs the platform dependent line separator character or - characters. - - - This conversion pattern name offers the same performance as using - non-portable line separator strings such as "\n", or "\r\n". - Thus, it is the preferred way of specifying a line separator. - - - - - processid - - - Used to output the system process ID for the current process. - - - - - property - - - Used to output a specific context property. The key to - lookup must be specified within braces and directly following the - pattern specifier, e.g. %property{user} would include the value - from the property that is keyed by the string 'user'. Each property value - that is to be included in the log must be specified separately. - Properties are stored in logging contexts. By default - the log4net:HostName property is set to the name of machine on - which the event was originally logged. - - - If no key is specified, e.g. %property then all the keys and their - values are printed in a comma separated list. - - - The properties of an event are combined from a number of different - contexts. These are listed below in the order in which they are searched. - - - - the thread properties - - The that are set on the current - thread. These properties are shared by all events logged on this thread. - - - - the global properties - - The that are set globally. These - properties are shared by all the threads in the AppDomain. - - - - - - - random - - - Used to output a random string of characters. The string is made up of - uppercase letters and numbers. By default the string is 4 characters long. - The length of the string can be specified within braces directly following the - pattern specifier, e.g. %random{8} would output an 8 character string. - - - - - username - - - Used to output the WindowsIdentity for the currently - active user. - - - - - utcdate - - - Used to output the date of the logging event in universal time. - The date conversion - specifier may be followed by a date format specifier enclosed - between braces. For example, %utcdate{HH:mm:ss,fff} or - %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is - given then ISO8601 format is - assumed (). - - - The date format specifier admits the same syntax as the - time pattern string of the . - - - For better results it is recommended to use the log4net date - formatters. These can be specified using one of the strings - "ABSOLUTE", "DATE" and "ISO8601" for specifying - , - and respectively - . For example, - %utcdate{ISO8601} or %utcdate{ABSOLUTE}. - - - These dedicated date formatters perform significantly - better than . - - - - - % - - - The sequence %% outputs a single percent sign. - - - - - - Additional pattern converters may be registered with a specific - instance using or - . - - - See the for details on the - format modifiers supported by the patterns. - - - Nicko Cadell - - - - Internal map of converter identifiers to converter types. - - - - - the pattern - - - - - the head of the pattern converter chain - - - - - patterns defined on this PatternString only - - - - - Initialize the global registry - - - - - Default constructor - - - - Initialize a new instance of - - - - - - Constructs a PatternString - - The pattern to use with this PatternString - - - Initialize a new instance of with the pattern specified. - - - - - - Initialize object options - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - - - - Create the used to parse the pattern - - the pattern to parse - The - - - Returns PatternParser used to parse the conversion string. Subclasses - may override this to return a subclass of PatternParser which recognize - custom conversion pattern name. - - - - - - Produces a formatted string as specified by the conversion pattern. - - The TextWriter to write the formatted event to - - - Format the pattern to the . - - - - - - Format the pattern as a string - - the pattern formatted as a string - - - Format the pattern to a string. - - - - - - Add a converter to this PatternString - - the converter info - - - This version of the method is used by the configurator. - Programmatic users should use the alternative method. - - - - - - Add a converter to this PatternString - - the name of the conversion pattern for this converter - the type of the converter - - - Add a converter to this PatternString - - - - - - Gets or sets the pattern formatting string - - - The pattern formatting string - - - - The ConversionPattern option. This is the string which - controls formatting and consists of a mix of literal content and - conversion specifiers. - - - - - - Wrapper class used to map converter names to converter types - - - - Wrapper class used to map converter names to converter types - - - - - - default constructor - - - - - Gets or sets the name of the conversion pattern - - - The name of the conversion pattern - - - - Gets or sets the name of the conversion pattern - - - - - - Gets or sets the type of the converter - - - The type of the converter - - - - Gets or sets the type of the converter - - - - - - String keyed object map. - - - - While this collection is serializable only member - objects that are serializable will - be serialized along with this collection. - - - Nicko Cadell - Gert Driesen - - - - String keyed object map that is read only. - - - - This collection is readonly and cannot be modified. - - - While this collection is serializable only member - objects that are serializable will - be serialized along with this collection. - - - Nicko Cadell - Gert Driesen - - - - The Hashtable used to store the properties data - - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Copy Constructor - - properties to copy - - - Initializes a new instance of the class. - - - - - - Deserialization constructor - - The that holds the serialized object data. - The that contains contextual information about the source or destination. - - - Initializes a new instance of the class - with serialized data. - - - - - - Gets the key names. - - An array of all the keys. - - - Gets the key names. - - - - - - Test if the dictionary contains a specified key - - the key to look for - true if the dictionary contains the specified key - - - Test if the dictionary contains a specified key - - - - - - Serializes this object into the provided. - - The to populate with data. - The destination for this serialization. - - - Serializes this object into the provided. - - - - - - See - - - - - See - - - - - - See - - - - - - - Remove all properties from the properties collection - - - - - See - - - - - - - See - - - - - - - See - - - - - Gets or sets the value of the property with the specified key. - - - The value of the property with the specified key. - - The key of the property to get or set. - - - The property value will only be serialized if it is serializable. - If it cannot be serialized it will be silently ignored if - a serialization operation is performed. - - - - - - The hashtable used to store the properties - - - The internal collection used to store the properties - - - - The hashtable used to store the properties - - - - - - See - - - - - See - - - - - See - - - - - See - - - - - See - - - - - See - - - - - The number of properties in this collection - - - - - See - - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Constructor - - properties to copy - - - Initializes a new instance of the class. - - - - - - Initializes a new instance of the class - with serialized data. - - The that holds the serialized object data. - The that contains contextual information about the source or destination. - - - Because this class is sealed the serialization constructor is private. - - - - - - Remove the entry with the specified key from this dictionary - - the key for the entry to remove - - - Remove the entry with the specified key from this dictionary - - - - - - See - - an enumerator - - - Returns a over the contest of this collection. - - - - - - See - - the key to remove - - - Remove the entry with the specified key from this dictionary - - - - - - See - - the key to lookup in the collection - true if the collection contains the specified key - - - Test if this collection contains a specified key. - - - - - - Remove all properties from the properties collection - - - - Remove all properties from the properties collection - - - - - - See - - the key - the value to store for the key - - - Store a value for the specified . - - - Thrown if the is not a string - - - - See - - - - - - - See - - - - - Gets or sets the value of the property with the specified key. - - - The value of the property with the specified key. - - The key of the property to get or set. - - - The property value will only be serialized if it is serializable. - If it cannot be serialized it will be silently ignored if - a serialization operation is performed. - - - - - - See - - - false - - - - This collection is modifiable. This property always - returns false. - - - - - - See - - - The value for the key specified. - - - - Get or set a value for the specified . - - - Thrown if the is not a string - - - - See - - - - - See - - - - - See - - - - - See - - - - - See - - - - - A that ignores the message - - - - This writer is used in special cases where it is necessary - to protect a writer from being closed by a client. - - - Nicko Cadell - - - - Constructor - - the writer to actually write to - - - Create a new ProtectCloseTextWriter using a writer - - - - - - Attach this instance to a different underlying - - the writer to attach to - - - Attach this instance to a different underlying - - - - - - Does not close the underlying output writer. - - - - Does not close the underlying output writer. - This method does nothing. - - - - - - Defines a lock that supports single writers and multiple readers - - - - ReaderWriterLock is used to synchronize access to a resource. - At any given time, it allows either concurrent read access for - multiple threads, or write access for a single thread. In a - situation where a resource is changed infrequently, a - ReaderWriterLock provides better throughput than a simple - one-at-a-time lock, such as . - - - If a platform does not support a System.Threading.ReaderWriterLock - implementation then all readers and writers are serialized. Therefore - the caller must not rely on multiple simultaneous readers. - - - Nicko Cadell - - - - Constructor - - - - Initializes a new instance of the class. - - - - - - Acquires a reader lock - - - - blocks if a different thread has the writer - lock, or if at least one thread is waiting for the writer lock. - - - - - - Decrements the lock count - - - - decrements the lock count. When the count - reaches zero, the lock is released. - - - - - - Acquires the writer lock - - - - This method blocks if another thread has a reader lock or writer lock. - - - - - - Decrements the lock count on the writer lock - - - - ReleaseWriterLock decrements the writer lock count. - When the count reaches zero, the writer lock is released. - - - - - - A that can be and reused - - - - A that can be and reused. - This uses a single buffer for string operations. - - - Nicko Cadell - - - - Create an instance of - - the format provider to use - - - Create an instance of - - - - - - Override Dispose to prevent closing of writer - - flag - - - Override Dispose to prevent closing of writer - - - - - - Reset this string writer so that it can be reused. - - the maximum buffer capacity before it is trimmed - the default size to make the buffer - - - Reset this string writer so that it can be reused. - The internal buffers are cleared and reset. - - - - - - Utility class for system specific information. - - - - Utility class of static methods for system specific information. - - - Nicko Cadell - Gert Driesen - Alexey Solofnenko - - - - Private constructor to prevent instances. - - - - Only static methods are exposed from this type. - - - - - - Initialize default values for private static fields. - - - - Only static methods are exposed from this type. - - - - - - Gets the assembly location path for the specified assembly. - - The assembly to get the location for. - The location of the assembly. - - - This method does not guarantee to return the correct path - to the assembly. If only tries to give an indication as to - where the assembly was loaded from. - - - - - - Gets the fully qualified name of the , including - the name of the assembly from which the was - loaded. - - The to get the fully qualified name for. - The fully qualified name for the . - - - This is equivalent to the Type.AssemblyQualifiedName property, - but this method works on the .NET Compact Framework 1.0 as well as - the full .NET runtime. - - - - - - Gets the short name of the . - - The to get the name for. - The short name of the . - - - The short name of the assembly is the - without the version, culture, or public key. i.e. it is just the - assembly's file name without the extension. - - - Use this rather than Assembly.GetName().Name because that - is not available on the Compact Framework. - - - Because of a FileIOPermission security demand we cannot do - the obvious Assembly.GetName().Name. We are allowed to get - the of the assembly so we - start from there and strip out just the assembly name. - - - - - - Gets the file name portion of the , including the extension. - - The to get the file name for. - The file name of the assembly. - - - Gets the file name portion of the , including the extension. - - - - - - Loads the type specified in the type string. - - A sibling type to use to load the type. - The name of the type to load. - Flag set to true to throw an exception if the type cannot be loaded. - true to ignore the case of the type name; otherwise, false - The type loaded or null if it could not be loaded. - - - If the type name is fully qualified, i.e. if contains an assembly name in - the type name, the type will be loaded from the system using - . - - - If the type name is not fully qualified, it will be loaded from the assembly - containing the specified relative type. If the type is not found in the assembly - then all the loaded assemblies will be searched for the type. - - - - - - Loads the type specified in the type string. - - The name of the type to load. - Flag set to true to throw an exception if the type cannot be loaded. - true to ignore the case of the type name; otherwise, false - The type loaded or null if it could not be loaded. - - - If the type name is fully qualified, i.e. if contains an assembly name in - the type name, the type will be loaded from the system using - . - - - If the type name is not fully qualified it will be loaded from the - assembly that is directly calling this method. If the type is not found - in the assembly then all the loaded assemblies will be searched for the type. - - - - - - Loads the type specified in the type string. - - An assembly to load the type from. - The name of the type to load. - Flag set to true to throw an exception if the type cannot be loaded. - true to ignore the case of the type name; otherwise, false - The type loaded or null if it could not be loaded. - - - If the type name is fully qualified, i.e. if contains an assembly name in - the type name, the type will be loaded from the system using - . - - - If the type name is not fully qualified it will be loaded from the specified - assembly. If the type is not found in the assembly then all the loaded assemblies - will be searched for the type. - - - - - - Generate a new guid - - A new Guid - - - Generate a new guid - - - - - - Create an - - The name of the parameter that caused the exception - The value of the argument that causes this exception - The message that describes the error - the ArgumentOutOfRangeException object - - - Create a new instance of the class - with a specified error message, the parameter name, and the value - of the argument. - - - The Compact Framework does not support the 3 parameter constructor for the - type. This method provides an - implementation that works for all platforms. - - - - - - Parse a string into an value - - the string to parse - out param where the parsed value is placed - true if the string was able to be parsed into an integer - - - Attempts to parse the string into an integer. If the string cannot - be parsed then this method returns false. The method does not throw an exception. - - - - - - Parse a string into an value - - the string to parse - out param where the parsed value is placed - true if the string was able to be parsed into an integer - - - Attempts to parse the string into an integer. If the string cannot - be parsed then this method returns false. The method does not throw an exception. - - - - - - Lookup an application setting - - the application settings key to lookup - the value for the key, or null - - - Configuration APIs are not supported under the Compact Framework - - - - - - Convert a path into a fully qualified local file path. - - The path to convert. - The fully qualified path. - - - Converts the path specified to a fully - qualified path. If the path is relative it is - taken as relative from the application base - directory. - - - The path specified must be a local file path, a URI is not supported. - - - - - - Creates a new case-insensitive instance of the class with the default initial capacity. - - A new case-insensitive instance of the class with the default initial capacity - - - The new Hashtable instance uses the default load factor, the CaseInsensitiveHashCodeProvider, and the CaseInsensitiveComparer. - - - - - - Gets an empty array of types. - - - - The Type.EmptyTypes field is not available on - the .NET Compact Framework 1.0. - - - - - - Cache the host name for the current machine - - - - - Cache the application friendly name - - - - - Text to output when a null is encountered. - - - - - Text to output when an unsupported feature is requested. - - - - - Start time for the current process. - - - - - Gets the system dependent line terminator. - - - The system dependent line terminator. - - - - Gets the system dependent line terminator. - - - - - - Gets the base directory for this . - - The base directory path for the current . - - - Gets the base directory for this . - - - The value returned may be either a local file path or a URI. - - - - - - Gets the path to the configuration file for the current . - - The path to the configuration file for the current . - - - The .NET Compact Framework 1.0 does not have a concept of a configuration - file. For this runtime, we use the entry assembly location as the root for - the configuration file name. - - - The value returned may be either a local file path or a URI. - - - - - - Gets the path to the file that first executed in the current . - - The path to the entry assembly. - - - Gets the path to the file that first executed in the current . - - - - - - Gets the ID of the current thread. - - The ID of the current thread. - - - On the .NET framework, the AppDomain.GetCurrentThreadId method - is used to obtain the thread ID for the current thread. This is the - operating system ID for the thread. - - - On the .NET Compact Framework 1.0 it is not possible to get the - operating system thread ID for the current thread. The native method - GetCurrentThreadId is implemented inline in a header file - and cannot be called. - - - On the .NET Framework 2.0 the Thread.ManagedThreadId is used as this - gives a stable id unrelated to the operating system thread ID which may - change if the runtime is using fibers. - - - - - - Get the host name or machine name for the current machine - - - The hostname or machine name - - - - Get the host name or machine name for the current machine - - - The host name () or - the machine name (Environment.MachineName) for - the current machine, or if neither of these are available - then NOT AVAILABLE is returned. - - - - - - Get this application's friendly name - - - The friendly name of this application as a string - - - - If available the name of the application is retrieved from - the AppDomain using AppDomain.CurrentDomain.FriendlyName. - - - Otherwise the file name of the entry assembly is used. - - - - - - Get the start time for the current process. - - - - This is the time at which the log4net library was loaded into the - AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime - this is not the start time for the current process. - - - The log4net library should be loaded by an application early during its - startup, therefore this start time should be a good approximation for - the actual start time. - - - Note that AppDomains may be loaded and unloaded within the - same process without the process terminating, however this start time - will be set per AppDomain. - - - - - - Text to output when a null is encountered. - - - - Use this value to indicate a null has been encountered while - outputting a string representation of an item. - - - The default value is (null). This value can be overridden by specifying - a value for the log4net.NullText appSetting in the application's - .config file. - - - - - - Text to output when an unsupported feature is requested. - - - - Use this value when an unsupported feature is requested. - - - The default value is NOT AVAILABLE. This value can be overridden by specifying - a value for the log4net.NotAvailableText appSetting in the application's - .config file. - - - - - - Utility class that represents a format string. - - - - Utility class that represents a format string. - - - Nicko Cadell - - - - Initialise the - - An that supplies culture-specific formatting information. - A containing zero or more format items. - An array containing zero or more objects to format. - - - - Format the string and arguments - - the formatted string - - - - Replaces the format item in a specified with the text equivalent - of the value of a corresponding instance in a specified array. - A specified parameter supplies culture-specific formatting information. - - An that supplies culture-specific formatting information. - A containing zero or more format items. - An array containing zero or more objects to format. - - A copy of format in which the format items have been replaced by the - equivalent of the corresponding instances of in args. - - - - This method does not throw exceptions. If an exception thrown while formatting the result the - exception and arguments are returned in the result string. - - - - - - Process an error during StringFormat - - - - - Dump the contents of an array into a string builder - - - - - Dump an object to a string - - - - - Implementation of Properties collection for the - - - - Class implements a collection of properties that is specific to each thread. - The class is not synchronized as each thread has its own . - - - Nicko Cadell - - - - The thread local data slot to use to store a PropertiesDictionary. - - - - - Internal constructor - - - - Initializes a new instance of the class. - - - - - - Remove a property - - the key for the entry to remove - - - Remove a property - - - - - - Clear all properties - - - - Clear all properties - - - - - - Get the PropertiesDictionary for this thread. - - create the dictionary if it does not exist, otherwise return null if is does not exist - the properties for this thread - - - The collection returned is only to be used on the calling thread. If the - caller needs to share the collection between different threads then the - caller must clone the collection before doing so. - - - - - - Gets or sets the value of a property - - - The value for the property with the specified key - - - - Gets or sets the value of a property - - - - - - Implementation of Stack for the - - - - Implementation of Stack for the - - - Nicko Cadell - - - - The stack store. - - - - - Internal constructor - - - - Initializes a new instance of the class. - - - - - - Clears all the contextual information held in this stack. - - - - Clears all the contextual information held in this stack. - Only call this if you think that this tread is being reused after - a previous call execution which may not have completed correctly. - You do not need to use this method if you always guarantee to call - the method of the - returned from even in exceptional circumstances, - for example by using the using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) - syntax. - - - - - - Removes the top context from this stack. - - The message in the context that was removed from the top of this stack. - - - Remove the top context from this stack, and return - it to the caller. If this stack is empty then an - empty string (not ) is returned. - - - - - - Pushes a new context message into this stack. - - The new context message. - - An that can be used to clean up the context stack. - - - - Pushes a new context onto this stack. An - is returned that can be used to clean up this stack. This - can be easily combined with the using keyword to scope the - context. - - - Simple example of using the Push method with the using keyword. - - using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) - { - log.Warn("This should have an ThreadContext Stack message"); - } - - - - - - Gets the current context information for this stack. - - The current context information. - - - - Gets the current context information for this stack. - - Gets the current context information - - - Gets the current context information for this stack. - - - - - - Get a portable version of this object - - the portable instance of this object - - - Get a cross thread portable version of this object - - - - - - The number of messages in the stack - - - The current number of messages in the stack - - - - The current number of messages in the stack. That is - the number of times has been called - minus the number of times has been called. - - - - - - Gets and sets the internal stack used by this - - The internal storage stack - - - This property is provided only to support backward compatability - of the . Tytpically the internal stack should not - be modified. - - - - - - Inner class used to represent a single context frame in the stack. - - - - Inner class used to represent a single context frame in the stack. - - - - - - Constructor - - The message for this context. - The parent context in the chain. - - - Initializes a new instance of the class - with the specified message and parent context. - - - - - - Get the message. - - The message. - - - Get the message. - - - - - - Gets the full text of the context down to the root level. - - - The full text of the context down to the root level. - - - - Gets the full text of the context down to the root level. - - - - - - Struct returned from the method. - - - - This struct implements the and is designed to be used - with the pattern to remove the stack frame at the end of the scope. - - - - - - The ThreadContextStack internal stack - - - - - The depth to trim the stack to when this instance is disposed - - - - - Constructor - - The internal stack used by the ThreadContextStack. - The depth to return the stack to when this object is disposed. - - - Initializes a new instance of the class with - the specified stack and return depth. - - - - - - Returns the stack to the correct depth. - - - - Returns the stack to the correct depth. - - - - - - Implementation of Stacks collection for the - - - - Implementation of Stacks collection for the - - - Nicko Cadell - - - - Internal constructor - - - - Initializes a new instance of the class. - - - - - - Gets the named thread context stack - - - The named stack - - - - Gets the named thread context stack - - - - - - Utility class for transforming strings. - - - - Utility class for transforming strings. - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - Write a string to an - - the writer to write to - the string to write - The string to replace non XML compliant chars with - - - The test is escaped either using XML escape entities - or using CDATA sections. - - - - - - Replace invalid XML characters in text string - - the XML text input string - the string to use in place of invalid characters - A string that does not contain invalid XML characters. - - - Certain Unicode code points are not allowed in the XML InfoSet, for - details see: http://www.w3.org/TR/REC-xml/#charsets. - - - This method replaces any illegal characters in the input string - with the mask string specified. - - - - - - Count the number of times that the substring occurs in the text - - the text to search - the substring to find - the number of times the substring occurs in the text - - - The substring is assumed to be non repeating within itself. - - - - - - Impersonate a Windows Account - - - - This impersonates a Windows account. - - - How the impersonation is done depends on the value of . - This allows the context to either impersonate a set of user credentials specified - using username, domain name and password or to revert to the process credentials. - - - - - - Default constructor - - - - Default constructor - - - - - - Initialize the SecurityContext based on the options set. - - - - This is part of the delayed object - activation scheme. The method must - be called on this object after the configuration properties have - been set. Until is called this - object is in an undefined state and must not be used. - - - If any of the configuration properties are modified then - must be called again. - - - The security context will try to Logon the specified user account and - capture a primary token for impersonation. - - - The required , - or properties were not specified. - - - - Impersonate the Windows account specified by the and properties. - - caller provided state - - An instance that will revoke the impersonation of this SecurityContext - - - - Depending on the property either - impersonate a user using credentials supplied or revert - to the process credentials. - - - - - - Create a given the userName, domainName and password. - - the user name - the domain name - the password - the for the account specified - - - Uses the Windows API call LogonUser to get a principal token for the account. This - token is used to initialize the WindowsIdentity. - - - - - - Gets or sets the impersonation mode for this security context - - - The impersonation mode for this security context - - - - Impersonate either a user with user credentials or - revert this thread to the credentials of the process. - The value is one of the - enum. - - - The default value is - - - When the mode is set to - the user's credentials are established using the - , and - values. - - - When the mode is set to - no other properties need to be set. If the calling thread is - impersonating then it will be reverted back to the process credentials. - - - - - - Gets or sets the Windows username for this security context - - - The Windows username for this security context - - - - This property must be set if - is set to (the default setting). - - - - - - Gets or sets the Windows domain name for this security context - - - The Windows domain name for this security context - - - - The default value for is the local machine name - taken from the property. - - - This property must be set if - is set to (the default setting). - - - - - - Sets the password for the Windows account specified by the and properties. - - - The password for the Windows account specified by the and properties. - - - - This property must be set if - is set to (the default setting). - - - - - - The impersonation modes for the - - - - See the property for - details. - - - - - - Impersonate a user using the credentials supplied - - - - - Revert this the thread to the credentials of the process - - - - - Adds to - - - - Helper class to expose the - through the interface. - - - - - - Constructor - - the impersonation context being wrapped - - - Constructor - - - - - - Revert the impersonation - - - - Revert the impersonation - - - - - - The log4net Global Context. - - - - The GlobalContext provides a location for global debugging - information to be stored. - - - The global context has a properties map and these properties can - be included in the output of log messages. The - supports selecting and outputing these properties. - - - By default the log4net:HostName property is set to the name of - the current machine. - - - - - GlobalContext.Properties["hostname"] = Environment.MachineName; - - - - Nicko Cadell - - - - Private Constructor. - - - Uses a private access modifier to prevent instantiation of this class. - - - - - The global context properties instance - - - - - The global properties map. - - - The global properties map. - - - - The global properties map. - - - - - - The log4net Logical Thread Context. - - - - The LogicalThreadContext provides a location for specific debugging - information to be stored. - The LogicalThreadContext properties override any or - properties with the same name. - - - The Logical Thread Context has a properties map and a stack. - The properties and stack can - be included in the output of log messages. The - supports selecting and outputting these properties. - - - The Logical Thread Context provides a diagnostic context for the current call context. - This is an instrument for distinguishing interleaved log - output from different sources. Log output is typically interleaved - when a server handles multiple clients near-simultaneously. - - - The Logical Thread Context is managed on a per basis. - - - Example of using the thread context properties to store a username. - - LogicalThreadContext.Properties["user"] = userName; - log.Info("This log message has a LogicalThreadContext Property called 'user'"); - - - Example of how to push a message into the context stack - - using(LogicalThreadContext.Stacks["LDC"].Push("my context message")) - { - log.Info("This log message has a LogicalThreadContext Stack message that includes 'my context message'"); - - } // at the end of the using block the message is automatically popped - - - - Nicko Cadell - - - - Private Constructor. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - The thread context properties instance - - - - - The thread context stacks instance - - - - - The thread properties map - - - The thread properties map - - - - The LogicalThreadContext properties override any - or properties with the same name. - - - - - - The thread stacks - - - stack map - - - - The logical thread stacks. - - - - - - This class is used by client applications to request logger instances. - - - - This class has static methods that are used by a client to request - a logger instance. The method is - used to retrieve a logger. - - - See the interface for more details. - - - Simple example of logging messages - - ILog log = LogManager.GetLogger("application-log"); - - log.Info("Application Start"); - log.Debug("This is a debug message"); - - if (log.IsDebugEnabled) - { - log.Debug("This is another debug message"); - } - - - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - Uses a private access modifier to prevent instantiation of this class. - - - - Returns the named logger if it exists. - - Returns the named logger if it exists. - - - - If the named logger exists (in the default repository) then it - returns a reference to the logger, otherwise it returns null. - - - The fully qualified logger name to look for. - The logger found, or null if no logger could be found. - - - - Returns the named logger if it exists. - - - - If the named logger exists (in the specified repository) then it - returns a reference to the logger, otherwise it returns - null. - - - The repository to lookup in. - The fully qualified logger name to look for. - - The logger found, or null if the logger doesn't exist in the specified - repository. - - - - - Returns the named logger if it exists. - - - - If the named logger exists (in the repository for the specified assembly) then it - returns a reference to the logger, otherwise it returns - null. - - - The assembly to use to lookup the repository. - The fully qualified logger name to look for. - - The logger, or null if the logger doesn't exist in the specified - assembly's repository. - - - - Get the currently defined loggers. - - Returns all the currently defined loggers in the default repository. - - - The root logger is not included in the returned array. - - All the defined loggers. - - - - Returns all the currently defined loggers in the specified repository. - - The repository to lookup in. - - The root logger is not included in the returned array. - - All the defined loggers. - - - - Returns all the currently defined loggers in the specified assembly's repository. - - The assembly to use to lookup the repository. - - The root logger is not included in the returned array. - - All the defined loggers. - - - Get or create a logger. - - Retrieves or creates a named logger. - - - - Retrieves a logger named as the - parameter. If the named logger already exists, then the - existing instance will be returned. Otherwise, a new instance is - created. - - By default, loggers do not have a set level but inherit - it from the hierarchy. This is one of the central features of - log4net. - - - The name of the logger to retrieve. - The logger with the name specified. - - - - Retrieves or creates a named logger. - - - - Retrieve a logger named as the - parameter. If the named logger already exists, then the - existing instance will be returned. Otherwise, a new instance is - created. - - - By default, loggers do not have a set level but inherit - it from the hierarchy. This is one of the central features of - log4net. - - - The repository to lookup in. - The name of the logger to retrieve. - The logger with the name specified. - - - - Retrieves or creates a named logger. - - - - Retrieve a logger named as the - parameter. If the named logger already exists, then the - existing instance will be returned. Otherwise, a new instance is - created. - - - By default, loggers do not have a set level but inherit - it from the hierarchy. This is one of the central features of - log4net. - - - The assembly to use to lookup the repository. - The name of the logger to retrieve. - The logger with the name specified. - - - - Shorthand for . - - - Get the logger for the fully qualified name of the type specified. - - The full name of will be used as the name of the logger to retrieve. - The logger with the name specified. - - - - Shorthand for . - - - Gets the logger for the fully qualified name of the type specified. - - The repository to lookup in. - The full name of will be used as the name of the logger to retrieve. - The logger with the name specified. - - - - Shorthand for . - - - Gets the logger for the fully qualified name of the type specified. - - The assembly to use to lookup the repository. - The full name of will be used as the name of the logger to retrieve. - The logger with the name specified. - - - - Shuts down the log4net system. - - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in all the - default repositories. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - Shutdown a logger repository. - - Shuts down the default repository. - - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in the - default repository. - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - - - - Shuts down the repository for the repository specified. - - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in the - specified. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - The repository to shutdown. - - - - Shuts down the repository specified. - - - - Calling this method will safely close and remove all - appenders in all the loggers including root contained in the - repository. The repository is looked up using - the specified. - - - Some appenders need to be closed before the application exists. - Otherwise, pending logging events might be lost. - - - The shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - - - The assembly to use to lookup the repository. - - - Reset the configuration of a repository - - Resets all values contained in this repository instance to their defaults. - - - - Resets all values contained in the repository instance to their - defaults. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set to its default "off" value. - - - - - - Resets all values contained in this repository instance to their defaults. - - - - Reset all values contained in the repository instance to their - defaults. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set to its default "off" value. - - - The repository to reset. - - - - Resets all values contained in this repository instance to their defaults. - - - - Reset all values contained in the repository instance to their - defaults. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set to its default "off" value. - - - The assembly to use to lookup the repository to reset. - - - Get the logger repository. - - Returns the default instance. - - - - Gets the for the repository specified - by the callers assembly (). - - - The instance for the default repository. - - - - Returns the default instance. - - The default instance. - - - Gets the for the repository specified - by the argument. - - - The repository to lookup in. - - - - Returns the default instance. - - The default instance. - - - Gets the for the repository specified - by the argument. - - - The assembly to use to lookup the repository. - - - Get a logger repository. - - Returns the default instance. - - - - Gets the for the repository specified - by the callers assembly (). - - - The instance for the default repository. - - - - Returns the default instance. - - The default instance. - - - Gets the for the repository specified - by the argument. - - - The repository to lookup in. - - - - Returns the default instance. - - The default instance. - - - Gets the for the repository specified - by the argument. - - - The assembly to use to lookup the repository. - - - Create a domain - - Creates a repository with the specified repository type. - - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - The created will be associated with the repository - specified such that a call to will return - the same repository instance. - - - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - Create a logger repository. - - Creates a repository with the specified repository type. - - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - The created will be associated with the repository - specified such that a call to will return - the same repository instance. - - - - - - Creates a repository with the specified name. - - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - Creates the default type of which is a - object. - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The name of the repository, this must be unique amongst repositories. - The created for the repository. - The specified repository already exists. - - - - Creates a repository with the specified name. - - - - Creates the default type of which is a - object. - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The name of the repository, this must be unique amongst repositories. - The created for the repository. - The specified repository already exists. - - - - Creates a repository with the specified name and repository type. - - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The name of the repository, this must be unique to the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - The specified repository already exists. - - - - Creates a repository with the specified name and repository type. - - - - The name must be unique. Repositories cannot be redefined. - An will be thrown if the repository already exists. - - - The name of the repository, this must be unique to the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - The specified repository already exists. - - - - Creates a repository for the specified assembly and repository type. - - - - CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - The assembly to use to get the name of the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - - Creates a repository for the specified assembly and repository type. - - - - The created will be associated with the repository - specified such that a call to with the - same assembly specified will return the same repository instance. - - - The assembly to use to get the name of the repository. - A that implements - and has a no arg constructor. An instance of this type will be created to act - as the for the repository specified. - The created for the repository. - - - - Gets the list of currently defined repositories. - - - - Get an array of all the objects that have been created. - - - An array of all the known objects. - - - - Looks up the wrapper object for the logger specified. - - The logger to get the wrapper for. - The wrapper for the logger specified. - - - - Looks up the wrapper objects for the loggers specified. - - The loggers to get the wrappers for. - The wrapper objects for the loggers specified. - - - - Create the objects used by - this manager. - - The logger to wrap. - The wrapper for the logger specified. - - - - The wrapper map to use to hold the objects. - - - - - Implementation of Mapped Diagnostic Contexts. - - - - - The MDC is deprecated and has been replaced by the . - The current MDC implementation forwards to the ThreadContext.Properties. - - - - The MDC class is similar to the class except that it is - based on a map instead of a stack. It provides mapped - diagnostic contexts. A Mapped Diagnostic Context, or - MDC in short, is an instrument for distinguishing interleaved log - output from different sources. Log output is typically interleaved - when a server handles multiple clients near-simultaneously. - - - The MDC is managed on a per thread basis. - - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - Uses a private access modifier to prevent instantiation of this class. - - - - - Gets the context value identified by the parameter. - - The key to lookup in the MDC. - The string value held for the key, or a null reference if no corresponding value is found. - - - - The MDC is deprecated and has been replaced by the . - The current MDC implementation forwards to the ThreadContext.Properties. - - - - If the parameter does not look up to a - previously defined context then null will be returned. - - - - - - Add an entry to the MDC - - The key to store the value under. - The value to store. - - - - The MDC is deprecated and has been replaced by the . - The current MDC implementation forwards to the ThreadContext.Properties. - - - - Puts a context value (the parameter) as identified - with the parameter into the current thread's - context map. - - - If a value is already defined for the - specified then the value will be replaced. If the - is specified as null then the key value mapping will be removed. - - - - - - Removes the key value mapping for the key specified. - - The key to remove. - - - - The MDC is deprecated and has been replaced by the . - The current MDC implementation forwards to the ThreadContext.Properties. - - - - Remove the specified entry from this thread's MDC - - - - - - Clear all entries in the MDC - - - - - The MDC is deprecated and has been replaced by the . - The current MDC implementation forwards to the ThreadContext.Properties. - - - - Remove all the entries from this thread's MDC - - - - - - Implementation of Nested Diagnostic Contexts. - - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - A Nested Diagnostic Context, or NDC in short, is an instrument - to distinguish interleaved log output from different sources. Log - output is typically interleaved when a server handles multiple - clients near-simultaneously. - - - Interleaved log output can still be meaningful if each log entry - from different contexts had a distinctive stamp. This is where NDCs - come into play. - - - Note that NDCs are managed on a per thread basis. The NDC class - is made up of static methods that operate on the context of the - calling thread. - - - How to push a message into the context - - using(NDC.Push("my context message")) - { - ... all log calls will have 'my context message' included ... - - } // at the end of the using block the message is automatically removed - - - - Nicko Cadell - Gert Driesen - - - - Initializes a new instance of the class. - - - Uses a private access modifier to prevent instantiation of this class. - - - - - Clears all the contextual information held on the current thread. - - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - Clears the stack of NDC data held on the current thread. - - - - - - Creates a clone of the stack of context information. - - A clone of the context info for this thread. - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - The results of this method can be passed to the - method to allow child threads to inherit the context of their - parent thread. - - - - - - Inherits the contextual information from another thread. - - The context stack to inherit. - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - This thread will use the context information from the stack - supplied. This can be used to initialize child threads with - the same contextual information as their parent threads. These - contexts will NOT be shared. Any further contexts that - are pushed onto the stack will not be visible to the other. - Call to obtain a stack to pass to - this method. - - - - - - Removes the top context from the stack. - - - The message in the context that was removed from the top - of the stack. - - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - Remove the top context from the stack, and return - it to the caller. If the stack is empty then an - empty string (not null) is returned. - - - - - - Pushes a new context message. - - The new context message. - - An that can be used to clean up - the context stack. - - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - Pushes a new context onto the context stack. An - is returned that can be used to clean up the context stack. This - can be easily combined with the using keyword to scope the - context. - - - Simple example of using the Push method with the using keyword. - - using(log4net.NDC.Push("NDC_Message")) - { - log.Warn("This should have an NDC message"); - } - - - - - - Removes the context information for this thread. It is - not required to call this method. - - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - This method is not implemented. - - - - - - Forces the stack depth to be at most . - - The maximum depth of the stack - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - Forces the stack depth to be at most . - This may truncate the head of the stack. This only affects the - stack in the current thread. Also it does not prevent it from - growing, it only sets the maximum depth at the time of the - call. This can be used to return to a known context depth. - - - - - - Gets the current context depth. - - The current context depth. - - - - The NDC is deprecated and has been replaced by the . - The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. - - - - The number of context values pushed onto the context stack. - - - Used to record the current depth of the context. This can then - be restored using the method. - - - - - - - The log4net Thread Context. - - - - The ThreadContext provides a location for thread specific debugging - information to be stored. - The ThreadContext properties override any - properties with the same name. - - - The thread context has a properties map and a stack. - The properties and stack can - be included in the output of log messages. The - supports selecting and outputting these properties. - - - The Thread Context provides a diagnostic context for the current thread. - This is an instrument for distinguishing interleaved log - output from different sources. Log output is typically interleaved - when a server handles multiple clients near-simultaneously. - - - The Thread Context is managed on a per thread basis. - - - Example of using the thread context properties to store a username. - - ThreadContext.Properties["user"] = userName; - log.Info("This log message has a ThreadContext Property called 'user'"); - - - Example of how to push a message into the context stack - - using(ThreadContext.Stacks["NDC"].Push("my context message")) - { - log.Info("This log message has a ThreadContext Stack message that includes 'my context message'"); - - } // at the end of the using block the message is automatically popped - - - - Nicko Cadell - - - - Private Constructor. - - - - Uses a private access modifier to prevent instantiation of this class. - - - - - - The thread context properties instance - - - - - The thread context stacks instance - - - - - The thread properties map - - - The thread properties map - - - - The ThreadContext properties override any - properties with the same name. - - - - - - The thread stacks - - - stack map - - - - The thread local stacks. - - - - - + + + + + + log4net + + + + + Appender that logs to a database. + + + + appends logging events to a table within a + database. The appender can be configured to specify the connection + string by setting the property. + The connection type (provider) can be specified by setting the + property. For more information on database connection strings for + your specific database see http://www.connectionstrings.com/. + + + Records are written into the database either using a prepared + statement or a stored procedure. The property + is set to (System.Data.CommandType.Text) to specify a prepared statement + or to (System.Data.CommandType.StoredProcedure) to specify a stored + procedure. + + + The prepared statement text or the name of the stored procedure + must be set in the property. + + + The prepared statement or stored procedure can take a number + of parameters. Parameters are added using the + method. This adds a single to the + ordered list of parameters. The + type may be subclassed if required to provide database specific + functionality. The specifies + the parameter name, database type, size, and how the value should + be generated using a . + + + + An example of a SQL Server table that could be logged to: + + CREATE TABLE [dbo].[Log] ( + [ID] [int] IDENTITY (1, 1) NOT NULL , + [Date] [datetime] NOT NULL , + [Thread] [varchar] (255) NOT NULL , + [Level] [varchar] (20) NOT NULL , + [Logger] [varchar] (255) NOT NULL , + [Message] [varchar] (4000) NOT NULL + ) ON [PRIMARY] + + + + An example configuration to log to the above table: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Julian Biddle + Nicko Cadell + Gert Driesen + Lance Nehring + + + + Abstract base class implementation of that + buffers events in a fixed size buffer. + + + + This base class should be used by appenders that need to buffer a + number of events before logging them. For example the + buffers events and then submits the entire contents of the buffer to + the underlying database in one go. + + + Subclasses should override the + method to deliver the buffered events. + + The BufferingAppenderSkeleton maintains a fixed size cyclic + buffer of events. The size of the buffer is set using + the property. + + A is used to inspect + each event as it arrives in the appender. If the + triggers, then the current buffer is sent immediately + (see ). Otherwise the event + is stored in the buffer. For example, an evaluator can be used to + deliver the events immediately when an ERROR event arrives. + + + The buffering appender can be configured in a mode. + By default the appender is NOT lossy. When the buffer is full all + the buffered events are sent with . + If the property is set to true then the + buffer will not be sent when it is full, and new events arriving + in the appender will overwrite the oldest event in the buffer. + In lossy mode the buffer will only be sent when the + triggers. This can be useful behavior when you need to know about + ERROR events but not about events with a lower level, configure an + evaluator that will trigger when an ERROR event arrives, the whole + buffer will be sent which gives a history of events leading up to + the ERROR event. + + + Nicko Cadell + Gert Driesen + + + + Abstract base class implementation of . + + + + This class provides the code for common functionality, such + as support for threshold filtering and support for general filters. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface for your own strategies for printing log statements. + + + + Implementors should consider extending the + class which provides a default implementation of this interface. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Log the logging event in Appender specific way. + + The event to log + + + This method is called to log a message into this appender. + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + The name uniquely identifies the appender. + + + + + Interface for appenders that support bulk logging. + + + + This interface extends the interface to + support bulk logging of objects. Appenders + should only implement this interface if they can bulk log efficiently. + + + Nicko Cadell + + + + Log the array of logging events in Appender specific way. + + The events to log + + + This method is called to log an array of events into this appender. + + + + + + Interface used to delay activate a configured object. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then the method + must be called by the container after its all the configured properties have been set + and before the component can be used. + + + Nicko Cadell + + + + Activate the options that were previously set with calls to properties. + + + + This allows an object to defer activation of its options until all + options have been set. This is required for components which have + related options that remain ambiguous until all are set. + + + If a component implements this interface then this method must be called + after its properties have been set before the component can be used. + + + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Default constructor + + + Empty default constructor + + + + + Finalizes this appender by calling the implementation's + method. + + + + If this appender has not been closed then the Finalize method + will call . + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Closes the appender and release resources. + + + + Release any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + This method cannot be overridden by subclasses. This method + delegates the closing of the appender to the + method which must be overridden in the subclass. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The event to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the abstract method. + + + + + + Performs threshold checks and invokes filters before + delegating actual logging to the subclasses specific + method. + + The array of events to log. + + + This method cannot be overridden by derived classes. A + derived class should override the method + which is called by this method. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + Calls and checks that + it returns true. + + + + + If all of the above steps succeed then the + will be passed to the method. + + + + + + Test if the logging event should we output by this appender + + the event to test + true if the event should be output, false if the event should be ignored + + + This method checks the logging event against the threshold level set + on this appender and also against the filters specified on this + appender. + + + The implementation of this method is as follows: + + + + + + Checks that the severity of the + is greater than or equal to the of this + appender. + + + + Checks that the chain accepts the + . + + + + + + + + + Adds a filter to the end of the filter chain. + + the filter to add to this appender + + + The Filters are organized in a linked list. + + + Setting this property causes the new filter to be pushed onto the + back of the filter chain. + + + + + + Clears the filter list for this appender. + + + + Clears the filter list for this appender. + + + + + + Checks if the message level is below this appender's threshold. + + to test against. + + + If there is no threshold set, then the return value is always true. + + + + true if the meets the + requirements of this appender. + + + + + Is called when the appender is closed. Derived classes should override + this method if resources need to be released. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Subclasses of should implement this method + to perform actual logging. + + The event to append. + + + A subclass must implement this method to perform + logging of the . + + This method will be called by + if all the conditions listed for that method are met. + + + To restrict the logging of events in the appender + override the method. + + + + + + Append a bulk array of logging events. + + the array of logging events + + + This base class implementation calls the + method for each element in the bulk array. + + + A sub class that can better process a bulk array of events should + override this method in addition to . + + + + + + Called before as a precondition. + + + + This method is called by + before the call to the abstract method. + + + This method can be overridden in a subclass to extend the checks + made before the event is passed to the method. + + + A subclass should ensure that they delegate this call to + this base class if it is overridden. + + + true if the call to should proceed. + + + + Renders the to a string. + + The event to render. + The event rendered as a string. + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Where possible use the alternative version of this method + . + That method streams the rendering onto an existing Writer + which can give better performance if the caller already has + a open and ready for writing. + + + + + + Renders the to a string. + + The event to render. + The TextWriter to write the formatted event to + + + Helper method to render a to + a string. This appender must have a + set to render the to + a string. + + If there is exception data in the logging event and + the layout does not process the exception, this method + will append the exception text to the rendered string. + + + Use this method in preference to + where possible. If, however, the caller needs to render the event + to a string then does + provide an efficient mechanism for doing so. + + + + + + The layout of this appender. + + + See for more information. + + + + + The name of this appender. + + + See for more information. + + + + + The level threshold of this appender. + + + + There is no level threshold filtering by default. + + + See for more information. + + + + + + It is assumed and enforced that errorHandler is never null. + + + + It is assumed and enforced that errorHandler is never null. + + + See for more information. + + + + + + The first filter in the filter chain. + + + + Set to null initially. + + + See for more information. + + + + + + The last filter in the filter chain. + + + See for more information. + + + + + Flag indicating if this appender is closed. + + + See for more information. + + + + + The guard prevents an appender from repeatedly calling its own DoAppend method + + + + + StringWriter used to render events + + + + + Gets or sets the threshold of this appender. + + + The threshold of the appender. + + + + All log events with lower level than the threshold level are ignored + by the appender. + + + In configuration files this option is specified by setting the + value of the option to a level + string, such as "DEBUG", "INFO" and so on. + + + + + + Gets or sets the for this appender. + + The of the appender + + + The provides a default + implementation for the property. + + + + + + The filter chain. + + The head of the filter chain filter chain. + + + Returns the head Filter. The Filters are organized in a linked list + and so all Filters on this Appender are available through the result. + + + + + + Gets or sets the for this appender. + + The layout of the appender. + + + See for more information. + + + + + + + Gets or sets the name of this appender. + + The name of the appender. + + + The name uniquely identifies the appender. + + + + + + Tests if this appender requires a to be set. + + + + In the rather exceptional case, where the appender + implementation admits a layout but can also work without it, + then the appender should return true. + + + This default implementation always returns true. + + + + true if the appender requires a layout object, otherwise false. + + + + + The default buffer size. + + + The default size of the cyclic buffer used to store events. + This is set to 512 by default. + + + + + Initializes a new instance of the class. + + + + Protected default constructor to allow subclassing. + + + + + + Initializes a new instance of the class. + + the events passed through this appender must be + fixed by the time that they arrive in the derived class' SendBuffer method. + + + Protected constructor to allow subclassing. + + + The should be set if the subclass + expects the events delivered to be fixed even if the + is set to zero, i.e. when no buffering occurs. + + + + + + Flush the currently buffered events + + + + Flushes any events that have been buffered. + + + If the appender is buffering in mode then the contents + of the buffer will NOT be flushed to the appender. + + + + + + Flush the currently buffered events + + set to true to flush the buffer of lossy events + + + Flushes events that have been buffered. If is + false then events will only be flushed if this buffer is non-lossy mode. + + + If the appender is buffering in mode then the contents + of the buffer will only be flushed if is true. + In this case the contents of the buffer will be tested against the + and if triggering will be output. All other buffered + events will be discarded. + + + If is true then the buffer will always + be emptied by calling this method. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Close this appender instance. + + + + Close this appender instance. If this appender is marked + as not then the remaining events in + the buffer must be sent when the appender is closed. + + + + + + This method is called by the method. + + the event to log + + + Stores the in the cyclic buffer. + + + The buffer will be sent (i.e. passed to the + method) if one of the following conditions is met: + + + + The cyclic buffer is full and this appender is + marked as not lossy (see ) + + + An is set and + it is triggered for the + specified. + + + + Before the event is stored in the buffer it is fixed + (see ) to ensure that + any data referenced by the event will be valid when the buffer + is processed. + + + + + + Sends the contents of the buffer. + + The first logging event. + The buffer containing the events that need to be send. + + + The subclass must override . + + + + + + Sends the events. + + The events that need to be send. + + + The subclass must override this method to process the buffered events. + + + + + + The size of the cyclic buffer used to hold the logging events. + + + Set to by default. + + + + + The cyclic buffer used to store the logging events. + + + + + The triggering event evaluator that causes the buffer to be sent immediately. + + + The object that is used to determine if an event causes the entire + buffer to be sent immediately. This field can be null, which + indicates that event triggering is not to be done. The evaluator + can be set using the property. If this appender + has the ( property) set to + true then an must be set. + + + + + Indicates if the appender should overwrite events in the cyclic buffer + when it becomes full, or if the buffer should be flushed when the + buffer is full. + + + If this field is set to true then an must + be set. + + + + + The triggering event evaluator filters discarded events. + + + The object that is used to determine if an event that is discarded should + really be discarded or if it should be sent to the appenders. + This field can be null, which indicates that all discarded events will + be discarded. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + The events delivered to the subclass must be fixed. + + + + + Gets or sets a value that indicates whether the appender is lossy. + + + true if the appender is lossy, otherwise false. The default is false. + + + + This appender uses a buffer to store logging events before + delivering them. A triggering event causes the whole buffer + to be send to the remote sink. If the buffer overruns before + a triggering event then logging events could be lost. Set + to false to prevent logging events + from being lost. + + If is set to true then an + must be specified. + + + + + Gets or sets the size of the cyclic buffer used to hold the + logging events. + + + The size of the cyclic buffer used to hold the logging events. + + + + The option takes a positive integer + representing the maximum number of logging events to collect in + a cyclic buffer. When the is reached, + oldest events are deleted as new events are added to the + buffer. By default the size of the cyclic buffer is 512 events. + + + If the is set to a value less than + or equal to 1 then no buffering will occur. The logging event + will be delivered synchronously (depending on the + and properties). Otherwise the event will + be buffered. + + + + + + Gets or sets the that causes the + buffer to be sent immediately. + + + The that causes the buffer to be + sent immediately. + + + + The evaluator will be called for each event that is appended to this + appender. If the evaluator triggers then the current buffer will + immediately be sent (see ). + + If is set to true then an + must be specified. + + + + + Gets or sets the value of the to use. + + + The value of the to use. + + + + The evaluator will be called for each event that is discarded from this + appender. If the evaluator triggers then the current buffer will immediately + be sent (see ). + + + + + + Gets or sets a value indicating if only part of the logging event data + should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the + event data to be fixed and serialized. This will improve performance. + + + See for more information. + + + + + + Gets or sets a the fields that will be fixed in the event + + + The event fields that will be fixed before the event is buffered + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + + Initializes a new instance of the class. + + + Public default constructor to initialize a new instance of this class. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Override the parent method to close the database + + + + Closes the database command and database connection. + + + + + + Inserts the events into the database. + + The events to insert into the database. + + + Insert all the events specified in the + array into the database. + + + + + + Adds a parameter to the command. + + The parameter to add to the command. + + + Adds a parameter to the ordered list of command parameters. + + + + + + Writes the events to the database using the transaction specified. + + The transaction that the events will be executed under. + The array of events to insert into the database. + + + The transaction argument can be null if the appender has been + configured not to use transactions. See + property for more information. + + + + + + Formats the log message into database statement text. + + The event being logged. + + This method can be overridden by subclasses to provide + more control over the format of the database statement. + + + Text that can be passed to a . + + + + + Connects to the database. + + + + + Retrieves the class type of the ADO.NET provider. + + + + Gets the Type of the ADO.NET provider to use to connect to the + database. This method resolves the type specified in the + property. + + + Subclasses can override this method to return a different type + if necessary. + + + The of the ADO.NET provider + + + + Prepares the database command and initialize the parameters. + + + + + Flag to indicate if we are using a command object + + + + Set to true when the appender is to use a prepared + statement or stored procedure to insert into the database. + + + + + + The list of objects. + + + + The list of objects. + + + + + + The security context to use for privileged calls + + + + + The that will be used + to insert logging events into a database. + + + + + The database command. + + + + + Database connection string. + + + + + String type name of the type name. + + + + + The text of the command. + + + + + The command type. + + + + + Indicates whether to use transactions when writing to the database. + + + + + Indicates whether to use transactions when writing to the database. + + + + + Gets or sets the database connection string that is used to connect to + the database. + + + The database connection string used to connect to the database. + + + + The connections string is specific to the connection type. + See for more information. + + + Connection string for MS Access via ODBC: + "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb" + + Another connection string for MS Access via ODBC: + "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;" + + Connection string for MS Access via OLE DB: + "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" + + + + + Gets or sets the type name of the connection + that should be created. + + + The type name of the connection. + + + + The type name of the ADO.NET provider to use. + + + The default is to use the OLE DB provider. + + + Use the OLE DB Provider. This is the default value. + System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the MS SQL Server Provider. + System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Use the ODBC Provider. + Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for ODBC .NET Data Provider. + + Use the Oracle Provider. + System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + This is an optional package that you can download from + http://msdn.microsoft.com/downloads + search for .NET Managed Provider for Oracle. + + + + + Gets or sets the command text that is used to insert logging events + into the database. + + + The command text used to insert logging events into the database. + + + + Either the text of the prepared statement or the + name of the stored procedure to execute to write into + the database. + + + The property determines if + this text is a prepared statement or a stored procedure. + + + + + + Gets or sets the command type to execute. + + + The command type to execute. + + + + This value may be either (System.Data.CommandType.Text) to specify + that the is a prepared statement to execute, + or (System.Data.CommandType.StoredProcedure) to specify that the + property is the name of a stored procedure + to execute. + + + The default value is (System.Data.CommandType.Text). + + + + + + Should transactions be used to insert logging events in the database. + + + true if transactions should be used to insert logging events in + the database, otherwise false. The default value is true. + + + + Gets or sets a value that indicates whether transactions should be used + to insert logging events in the database. + + + When set a single transaction will be used to insert the buffered events + into the database. Otherwise each event will be inserted without using + an explicit transaction. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Should this appender try to reconnect to the database on error. + + + true if the appender should try to reconnect to the database after an + error has occurred, otherwise false. The default value is false, + i.e. not to try to reconnect. + + + + The default behaviour is for the appender not to try to reconnect to the + database if an error occurs. Subsequent logging events are discarded. + + + To force the appender to attempt to reconnect to the database set this + property to true. + + + When the appender attempts to connect to the database there may be a + delay of up to the connection timeout specified in the connection string. + This delay will block the calling application's thread. + Until the connection can be reestablished this potential delay may occur multiple times. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to insert + logging events into a database. Classes deriving from + can use this property to get or set this . Use the + underlying returned from if + you require access beyond that which provides. + + + + + Parameter type used by the . + + + + This class provides the basic database parameter properties + as defined by the interface. + + This type can be subclassed to provide database specific + functionality. The two methods that are called externally are + and . + + + + + + Initializes a new instance of the class. + + + Default constructor for the AdoNetAppenderParameter class. + + + + + Prepare the specified database command object. + + The command to prepare. + + + Prepares the database command object by adding + this parameter to its collection of parameters. + + + + + + Renders the logging event and set the parameter value in the command. + + The command containing the parameter. + The event to be rendered. + + + Renders the logging event using this parameters layout + object. Sets the value of the parameter on the command object. + + + + + + The name of this parameter. + + + + + The database type for this parameter. + + + + + Flag to infer type rather than use the DbType + + + + + The precision for this parameter. + + + + + The scale for this parameter. + + + + + The size for this parameter. + + + + + The to use to render the + logging event into an object for this parameter. + + + + + Gets or sets the name of this parameter. + + + The name of this parameter. + + + + The name of this parameter. The parameter name + must match up to a named parameter to the SQL stored procedure + or prepared statement. + + + + + + Gets or sets the database type for this parameter. + + + The database type for this parameter. + + + + The database type for this parameter. This property should + be set to the database type from the + enumeration. See . + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the type from the value. + + + + + + + Gets or sets the precision for this parameter. + + + The precision for this parameter. + + + + The maximum number of digits used to represent the Value. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the precision from the value. + + + + + + + Gets or sets the scale for this parameter. + + + The scale for this parameter. + + + + The number of decimal places to which Value is resolved. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the scale from the value. + + + + + + + Gets or sets the size for this parameter. + + + The size for this parameter. + + + + The maximum size, in bytes, of the data within the column. + + + This property is optional. If not specified the ADO.NET provider + will attempt to infer the size from the value. + + + + + + + Gets or sets the to use to + render the logging event into an object for this + parameter. + + + The used to render the + logging event into an object for this parameter. + + + + The that renders the value for this + parameter. + + + The can be used to adapt + any into a + for use in the property. + + + + + + Appends logging events to the terminal using ANSI color escape sequences. + + + + AnsiColorTerminalAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific level of message to be set. + + + This appender expects the terminal to understand the VT100 control set + in order to interpret the color codes. If the terminal or console does not + understand the control codes the behavior is not defined. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + When configuring the ANSI colored terminal appender, a mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + + These color values cannot be combined together to make new colors. + + + The attributes can be any combination of the following: + + Brightforeground is brighter + Dimforeground is dimmer + Underscoremessage is underlined + Blinkforeground is blinking (does not work on all terminals) + Reverseforeground and background are reversed + Hiddenoutput is hidden + Strikethroughmessage has a line through it + + While any of these attributes may be combined together not all combinations + work well together, for example setting both Bright and Dim attributes makes + no sense. + + + Patrick Wagstrom + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Ansi code to reset terminal + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Add a mapping of level to color + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colours + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + Target is the value of the console output stream. + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible display attributes + + + + The following flags can be combined together to + form the ANSI color attributes. + + + + + + + text is bright + + + + + text is dim + + + + + text is underlined + + + + + text is blinking + + + Not all terminals support this attribute + + + + + text and background colors are reversed + + + + + text is hidden + + + + + text is displayed with a strikethrough + + + + + The enum of possible foreground or background color values for + use with the color mapping method + + + + The output can be in one for the following ANSI colors. + + + + + + + color is black + + + + + color is red + + + + + color is green + + + + + color is yellow + + + + + color is blue + + + + + color is magenta + + + + + color is cyan + + + + + color is white + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + An entry in the + + + + This is an abstract base class for types that are stored in the + object. + + + Nicko Cadell + + + + Default protected constructor + + + + Default protected constructor + + + + + + Initialize any options defined on this entry + + + + Should be overridden by any classes that need to initialise based on their options + + + + + + The level that is the key for this mapping + + + The that is the key for this mapping + + + + Get or set the that is the key for this + mapping subclass. + + + + + + Initialize the options for the object + + + + Combine the and together + and append the attributes. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level + + + + + + The color attributes for the specified level + + + + Required property. + The color attributes for the specified level + + + + + + The combined , and + suitable for setting the ansi terminal color. + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a AppenderCollection instance. + + list to create a readonly wrapper arround + + An AppenderCollection wrapper that is read-only. + + + + + An empty readonly static AppenderCollection + + + + + Initializes a new instance of the AppenderCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the AppenderCollection class + that has the specified initial capacity. + + + The number of elements that the new AppenderCollection is initially capable of storing. + + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified AppenderCollection. + + The AppenderCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the AppenderCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire AppenderCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire AppenderCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the AppenderCollection. + + The to be added to the end of the AppenderCollection. + The index at which the value has been added. + + + + Removes all elements from the AppenderCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the AppenderCollection. + + The to check for. + true if is found in the AppenderCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the AppenderCollection. + + The to locate in the AppenderCollection. + + The zero-based index of the first occurrence of + in the entire AppenderCollection, if found; otherwise, -1. + + + + + Inserts an element into the AppenderCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the AppenderCollection. + + The to remove from the AppenderCollection. + + The specified was not found in the AppenderCollection. + + + + + Removes the element at the specified index of the AppenderCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the AppenderCollection. + + An for the entire AppenderCollection. + + + + Adds the elements of another AppenderCollection to the current AppenderCollection. + + The AppenderCollection whose elements should be added to the end of the current AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a array to the current AppenderCollection. + + The array whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Adds the elements of a collection to the current AppenderCollection. + + The collection whose elements should be added to the end of the AppenderCollection. + The new of the AppenderCollection. + + + + Sets the capacity to the actual number of elements. + + + + + Return the collection elements as an array + + the array + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the AppenderCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the AppenderCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + + + + + Appends log events to the ASP.NET system. + + + + + Diagnostic information and tracing messages that you specify are appended to the output + of the page that is sent to the requesting browser. Optionally, you can view this information + from a separate trace viewer (Trace.axd) that displays trace information for every page in a + given application. + + + Trace statements are processed and displayed only when tracing is enabled. You can control + whether tracing is displayed to a page, to the trace viewer, or both. + + + The logging event is passed to the or + method depending on the level of the logging event. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the ASP.NET trace + + the event to log + + + Write the logging event to the ASP.NET trace + HttpContext.Current.Trace + (). + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Buffers events and then forwards them to attached appenders. + + + + The events are buffered in this appender until conditions are + met to allow the appender to deliver the events to the attached + appenders. See for the + conditions that cause the buffer to be sent. + + The forwarding appender can be used to specify different + thresholds and filters for the same appender at different locations + within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Interface for attaching appenders to objects. + + + + Interface for attaching, removing and retrieving appenders. + + + Nicko Cadell + Gert Driesen + + + + Attaches an appender. + + The appender to add. + + + Add the specified appender. The implementation may + choose to allow or deny duplicate appenders. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Returns an attached appender with the specified. + If no appender with the specified name is found null will be + returned. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Gets all attached appenders. + + + A collection of attached appenders. + + + + Gets a collection of attached appenders. + If there are no attached appenders the + implementation should return an empty + collection rather than null. + + + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Send the events. + + The events that need to be send. + + + Forwards the events to the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this buffering appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Appends logging events to the console. + + + + ColoredConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. It also allows the color of a specific type of message to be set. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes directly to the application's attached console + not to the System.Console.Out or System.Console.Error TextWriter. + The System.Console.Out and System.Console.Error streams can be + programmatically redirected (for example NUnit does this to capture program output). + This appender will ignore these redirections because it needs to use Win32 + API calls to colorize the output. To respect these redirections the + must be used. + + + When configuring the colored console appender, mapping should be + specified to map a logging level to a color. For example: + + + + + + + + + + + + + + The Level is the standard log4net logging level and ForeColor and BackColor can be any + combination of the following values: + + Blue + Green + Red + White + Yellow + Purple + Cyan + HighIntensity + + + + Rick Hobbs + Nicko Cadell + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + Add a mapping of level to color - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the foreground and background colors + for a level. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to color mappings set on this appender. + + + + + + Flag to write output to the error stream rather than the standard output stream + + + + + Mapping from level object to color value + + + + + The console output stream writer to write to + + + + This writer is not thread safe. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + The enum of possible color values for use with the color mapping method + + + + The following flags can be combined together to + form the colors. + + + + + + + color is blue + + + + + color is green + + + + + color is red + + + + + color is white + + + + + color is yellow + + + + + color is purple + + + + + color is cyan + + + + + color is intensified + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and the color it should be displayed in. + + + + + + Initialize the options for the object + + + + Combine the and together. + + + + + + The mapped foreground color for the specified level + + + + Required property. + The mapped foreground color for the specified level. + + + + + + The mapped background color for the specified level + + + + Required property. + The mapped background color for the specified level. + + + + + + The combined and suitable for + setting the console color. + + + + + Appends logging events to the console. + + + + ConsoleAppender appends log events to the standard output stream + or the error output stream using a layout specified by the + user. + + + By default, all output is written to the console's standard output stream. + The property can be set to direct the output to the + error stream. + + + NOTE: This appender writes each message to the System.Console.Out or + System.Console.Error that is set at the time the event is appended. + Therefore it is possible to programmatically redirect the output of this appender + (for example NUnit does this to capture program output). While this is the desired + behavior of this appender it may have security implications in your application. + + + Nicko Cadell + Gert Driesen + + + + The to use when writing to the Console + standard output stream. + + + + The to use when writing to the Console + standard output stream. + + + + + + The to use when writing to the Console + standard error output stream. + + + + The to use when writing to the Console + standard error output stream. + + + + + + Initializes a new instance of the class. + + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + + The instance of the class is set up to write + to the standard output stream. + + + + + Initializes a new instance of the class + with the specified layout. + + the layout to use for this appender + flag set to true to write to the console error stream + + When is set to true, output is written to + the standard error output stream. Otherwise, output is written to the standard + output stream. + + + + + This method is called by the method. + + The event to log. + + + Writes the event to the console. + + + The format of the output will depend on the appender's layout. + + + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + Target is the value of the console output stream. + This is either "Console.Out" or "Console.Error". + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + debug system. + + + Events are written using the + method. The event's logger name is passed as the value for the category name to the Write method. + + + Nicko Cadell + + + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + If is true then the + is called. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Writes events to the system event log. + + + + The EventID of the event log entry can be + set using the EventLogEventID property () + on the . + + + There is a limit of 32K characters for an event log message + + + When configuring the EventLogAppender a mapping can be + specified to map a logging level to an event log entry type. For example: + + + <mapping> + <level value="ERROR" /> + <eventLogEntryType value="Error" /> + </mapping> + <mapping> + <level value="DEBUG" /> + <eventLogEntryType value="Information" /> + </mapping> + + + The Level is the standard log4net logging level and eventLogEntryType can be any value + from the enum, i.e.: + + Erroran error event + Warninga warning event + Informationan informational event + + + + Aspi Havewala + Douglas de la Torre + Nicko Cadell + Gert Driesen + Thomas Voss + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class + with the specified . + + The to use with this appender. + + + Obsolete constructor. + + + + + + Add a mapping of level to - done by the config file + + The mapping to add + + + Add a mapping to this appender. + Each mapping defines the event log entry type for a level. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create an event log source + + + Uses different API calls under NET_2_0 + + + + + This method is called by the + method. + + the event to log + + Writes the event to the system event log using the + . + + If the event has an EventID property (see ) + set then this integer will be used as the event log event id. + + + There is a limit of 32K characters for an event log message + + + + + + Get the equivalent for a + + the Level to convert to an EventLogEntryType + The equivalent for a + + Because there are fewer applicable + values to use in logging levels than there are in the + this is a one way mapping. There is + a loss of information during the conversion. + + + + + The log name is the section in the event logs where the messages + are stored. + + + + + Name of the application to use when logging. This appears in the + application column of the event log named by . + + + + + The name of the machine which holds the event log. This is + currently only allowed to be '.' i.e. the current machine. + + + + + Mapping from level object to EventLogEntryType + + + + + The security context to use for privileged calls + + + + + The name of the log where messages will be stored. + + + The string name of the log where messages will be stored. + + + This is the name of the log as it appears in the Event Viewer + tree. The default value is to log into the Application + log, this is where most applications write their events. However + if you need a separate log for your application (or applications) + then you should set the appropriately. + This should not be used to distinguish your event log messages + from those of other applications, the + property should be used to distinguish events. This property should be + used to group together events into a single log. + + + + + + Property used to set the Application name. This appears in the + event logs when logging. + + + The string used to distinguish events from different sources. + + + Sets the event log source property. + + + + + This property is used to return the name of the computer to use + when accessing the event logs. Currently, this is the current + computer, denoted by a dot "." + + + The string name of the machine holding the event log that + will be logged into. + + + This property cannot be changed. It is currently set to '.' + i.e. the local machine. This may be changed in future. + + + + + Gets or sets the used to write to the EventLog. + + + The used to write to the EventLog. + + + + The system security context used to write to the EventLog. + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + A class to act as a mapping between the level that a logging call is made at and + the color it should be displayed as. + + + + Defines the mapping between a level and its event log entry type. + + + + + + The for this entry + + + + Required property. + The for this entry + + + + + + Appends logging events to a file. + + + + Logging events are sent to the file specified by + the property. + + + The file can be opened in either append or overwrite mode + by specifying the property. + If the file path is relative it is taken as relative from + the application base directory. The file encoding can be + specified by setting the property. + + + The layout's and + values will be written each time the file is opened and closed + respectively. If the property is + then the file may contain multiple copies of the header and footer. + + + This appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + The supports pluggable file locking models via + the property. + The default behavior, implemented by + is to obtain an exclusive write lock on the file until this appender is closed. + The alternative model, , only holds a + write lock while the appender is writing a logging event. + + + Nicko Cadell + Gert Driesen + Rodrigo B. de Oliveira + Douglas de la Torre + Niall Daley + + + + Sends logging events to a . + + + + An Appender that writes to a . + + + This appender may be used stand alone if initialized with an appropriate + writer, however it is typically used as a base class for an appender that + can open a to write to. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initializes a new instance of the class and + sets the output destination to a new initialized + with the specified . + + The layout to use with this appender. + The to output to. + + + Obsolete constructor. + + + + + + Initializes a new instance of the class and sets + the output destination to the specified . + + The layout to use with this appender + The to output to + + The must have been previously opened. + + + + Obsolete constructor. + + + + + + This method determines if there is a sense in attempting to append. + + + + This method checked if an output target has been set and if a + layout has been set. + + + false if any of the preconditions fail. + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + This method writes all the bulk logged events to the output writer + before flushing the stream. + + + + + + Close this appender instance. The underlying stream or writer is also closed. + + + Closed appenders cannot be reused. + + + + + Writes the footer and closes the underlying . + + + + Writes the footer and closes the underlying . + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Clears internal references to the underlying + and other variables. + + + + Subclasses can override this method for an alternate closing behavior. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Called to allow a subclass to lazily initialize the writer + + + + This method is called when an event is logged and the or + have not been set. This allows a subclass to + attempt to initialize the writer multiple times. + + + + + + This is the where logging events + will be written to. + + + + + Immediate flush means that the underlying + or output stream will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logging events are not actually persisted if and when the application + crashes. + + + The default value is true. + + + + + + Gets or set whether the appender will flush at the end + of each append operation. + + + + The default behavior is to flush at the end of each + append operation. + + + If this option is set to false, then the underlying + stream can defer persisting the logging event to a later + time. + + + + Avoiding the flush operation at the end of each append results in + a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + Sets the where the log output will go. + + + + The specified must be open and writable. + + + The will be closed when the appender + instance is closed. + + + Note: Logging to an unopened will fail. + + + + + + Gets or set the and the underlying + , if any, for this appender. + + + The for this appender. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Gets or sets the where logging events + will be written to. + + + The where logging events are written. + + + + This is the where logging events + will be written to. + + + + + + Default constructor + + + + Default constructor + + + + + + Construct a new appender using the layout, file and append mode. + + the layout to use with this appender + the full path to the file to write to + flag to indicate if the file should be appended to + + + Obsolete constructor. + + + + + + Construct a new appender using the layout and file specified. + The file will be appended to. + + the layout to use with this appender + the full path to the file to write to + + + Obsolete constructor. + + + + + + Activate the options on the file appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This will cause the file to be opened. + + + + + + Closes any previously opened file and calls the parent's . + + + + Resets the filename and the file stream. + + + + + + Called to initialize the file writer + + + + Will be called for each logged message until the file is + successfully opened. + + + + + + This method is called by the + method. + + The event to log. + + + Writes a log statement to the output stream if the output stream exists + and is writable. + + + The format of the output will depend on the appender's layout. + + + + + + This method is called by the + method. + + The array of events to log. + + + Acquires the output file locks once before writing all the events to + the stream. + + + + + + Writes a footer as produced by the embedded layout's property. + + + + Writes a footer as produced by the embedded layout's property. + + + + + + Writes a header produced by the embedded layout's property. + + + + Writes a header produced by the embedded layout's property. + + + + + + Closes the underlying . + + + + Closes the underlying . + + + + + + Closes the previously opened file. + + + + Writes the to the file and then + closes the file. + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + Calls but guarantees not to throw an exception. + Errors are passed to the . + + + + + + Sets and opens the file where the log output will go. The specified file must be writable. + + The path to the log file. Must be a fully qualified path. + If true will append to fileName. Otherwise will truncate fileName + + + If there was already an opened file, then the previous file + is closed first. + + + This method will ensure that the directory structure + for the specified exists. + + + + + + Sets the quiet writer used for file output + + the file stream that has been opened for writing + + + This implementation of creates a + over the and passes it to the + method. + + + This method can be overridden by sub classes that want to wrap the + in some way, for example to encrypt the output + data using a System.Security.Cryptography.CryptoStream. + + + + + + Sets the quiet writer being used. + + the writer over the file stream that has been opened for writing + + + This method can be overridden by sub classes that want to + wrap the in some way. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + Flag to indicate if we should append to the file + or overwrite the file. The default is to append. + + + + + The name of the log file. + + + + + The encoding to use for the file stream. + + + + + The security context to use for privileged calls + + + + + The stream to log to. Has added locking semantics + + + + + The locking model to use + + + + + Gets or sets the path to the file that logging will be written to. + + + The path to the file that logging will be written to. + + + + If the path is relative it is taken as relative from + the application base directory. + + + + + + Gets or sets a flag that indicates whether the file should be + appended to or overwritten. + + + Indicates whether the file should be appended to or overwritten. + + + + If the value is set to false then the file will be overwritten, if + it is set to true then the file will be appended to. + + The default value is true. + + + + + Gets or sets used to write to the file. + + + The used to write to the file. + + + + The default encoding set is + which is the encoding for the system's current ANSI code page. + + + + + + Gets or sets the used to write to the file. + + + The used to write to the file. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + Gets or sets the used to handle locking of the file. + + + The used to lock the file. + + + + Gets or sets the used to handle locking of the file. + + + There are two built in locking models, and . + The former locks the file from the start of logging to the end and the + later lock only for the minimal amount of time when logging each message. + + + The default locking model is the . + + + + + + Write only that uses the + to manage access to an underlying resource. + + + + + True asynchronous writes are not supported, the implementation forces a synchronous write. + + + + + Exception base type for log4net. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class with + the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Locking model base class + + + + Base class for the locking models available to the derived loggers. + + + + + + Open the output file + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + Gets or sets the for this LockingModel + + + The for this LockingModel + + + + The file appender this locking model is attached to and working on + behalf of. + + + The file appender is used to locate the security context and the error handler to use. + + + The value of this property will be set before is + called. + + + + + + Hold an exclusive lock on the output file + + + + Open the file once for writing and hold it open until is called. + Maintains an exclusive lock on the file during this time. + + + + + + Open the file specified and prepare for logging. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Does nothing. The lock is already taken + + + + + + Release the lock on the file + + + + Does nothing. The lock will be released when the file is closed. + + + + + + Acquires the file lock for each write + + + + Opens the file once for each / cycle, + thus holding the lock for the minimal amount of time. This method of locking + is considerably slower than but allows + other processes to move/delete the log file whilst logging continues. + + + + + + Prepares to open the file when the first message is logged. + + The filename to use + Whether to append to the file, or overwrite + The encoding to use + + + Open the file specified and prepare for logging. + No writes will be made until is called. + Must be called before any calls to , + and . + + + + + + Close the file + + + + Close the file. No further writes will be made. + + + + + + Acquire the lock on the file + + A stream that is ready to be written to. + + + Acquire the lock on the file in preparation for writing to it. + Return a stream pointing to the file. + must be called to release the lock on the output file. + + + + + + Release the lock on the file + + + + Release the lock on the file. No further writes will be made to the + stream until is called again. + + + + + + This appender forwards logging events to attached appenders. + + + + The forwarding appender can be used to specify different thresholds + and filters for the same appender at different locations within the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Closes the appender and releases resources. + + + + Releases any resources allocated within the appender such as file handles, + network connections, etc. + + + It is a programming error to append to a closed appender. + + + + + + Forward the logging event to the attached appenders + + The event to log. + + + Delivers the logging event to all the attached appenders. + + + + + + Forward the logging events to the attached appenders + + The array of events to log. + + + Delivers the logging events to all the attached appenders. + + + + + + Adds an to the list of appenders of this + instance. + + The to add to this appender. + + + If the specified is already in the list of + appenders, then it won't be added again. + + + + + + Looks for the appender with the specified name. + + The name of the appender to lookup. + + The appender with the specified name, or null. + + + + Get the named appender attached to this appender. + + + + + + Removes all previously added appenders from this appender. + + + + This is useful when re-reading configuration information. + + + + + + Removes the specified appender from the list of appenders. + + The appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + Implementation of the interface + + + + + Gets the appenders contained in this appender as an + . + + + If no appenders can be found, then an + is returned. + + + A collection of the appenders in this appender. + + + + + Logs events to a local syslog service. + + + + This appender uses the POSIX libc library functions openlog, syslog, and closelog. + If these functions are not available on the local system then this appender will not work! + + + The functions openlog, syslog, and closelog are specified in SUSv2 and + POSIX 1003.1-2001 standards. These are used to log messages to the local syslog service. + + + This appender talks to a local syslog service. If you need to log to a remote syslog + daemon and you cannot configure your local syslog service to do this you may be + able to use the to log via UDP. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a local syslog service. + + + + + Add a mapping of level to severity + + The mapping to add + + + Adds a to this appender. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Close the syslog when the appender is closed + + + + Close the syslog when the appender is closed + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + + The facility. The default facility is . + + + + + The message identity + + + + + Marshaled handle to the identity string. We have to hold on to the + string as the openlog and syslog APIs just hold the + pointer to the ident and dereference it for each log message. + + + + + Mapping from level object to syslog severity + + + + + Open connection to system logger. + + + + + Generate a log message. + + + + The libc syslog method takes a format string and a variable argument list similar + to the classic printf function. As this type of vararg list is not supported + by C# we need to specify the arguments explicitly. Here we have specified the + format string with a single message argument. The caller must set the format + string to "%s". + + + + + + Close descriptor used to write to system logger. + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + syslog severities + + + + The log4net Level maps to a syslog severity using the + method and the + class. The severity is set on . + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facility defines which subsystem the logging comes from. + This is set on the property. + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Stores logging events in an array. + + + + The memory appender stores all the logging events + that are appended in an in-memory array. + + + Use the method to get + the current list of events that have been appended. + + + Use the method to clear the + current list of events. + + + Julian Biddle + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Gets the events that have been logged. + + The events that have been logged + + + Gets the events that have been logged. + + + + + + This method is called by the method. + + the event to log + + Stores the in the events list. + + + + + Clear the list of events + + + Clear the list of events + + + + + The list of events that have been appended. + + + + + Value indicating which fields in the event should be fixed + + + By default all fields are fixed + + + + + Gets or sets a value indicating whether only part of the logging event + data should be fixed. + + + true if the appender should only fix part of the logging event + data, otherwise false. The default is false. + + + + Setting this property to true will cause only part of the event + data to be fixed and stored in the appender, hereby improving performance. + + + See for more information. + + + + + + Gets or sets the fields that will be fixed in the event + + + + The logging event needs to have certain thread specific values + captured before it can be buffered. See + for details. + + + + + + Logs entries by sending network messages using the + native function. + + + + You can send messages only to names that are active + on the network. If you send the message to a user name, + that user must be logged on and running the Messenger + service to receive the message. + + + The receiver will get a top most window displaying the + messages one at a time, therefore this appender should + not be used to deliver a high volume of messages. + + + The following table lists some possible uses for this appender : + + + + + Action + Property Value(s) + + + Send a message to a user account on the local machine + + + = <name of the local machine> + + + = <user name> + + + + + Send a message to a user account on a remote machine + + + = <name of the remote machine> + + + = <user name> + + + + + Send a message to a domain user account + + + = <name of a domain controller | uninitialized> + + + = <user name> + + + + + Send a message to all the names in a workgroup or domain + + + = <workgroup name | domain name>* + + + + + Send a message from the local machine to a remote machine + + + = <name of the local machine | uninitialized> + + + = <name of the remote machine> + + + + + + + Note : security restrictions apply for sending + network messages, see + for more information. + + + + + An example configuration section to log information + using this appender from the local machine, named + LOCAL_PC, to machine OPERATOR_PC : + + + + + + + + + + Nicko Cadell + Gert Driesen + + + + The DNS or NetBIOS name of the server on which the function is to execute. + + + + + The sender of the network message. + + + + + The message alias to which the message should be sent. + + + + + The security context to use for privileged calls + + + + + Initializes the appender. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified. + + + The required property was not specified. + + + + This method is called by the method. + + The event to log. + + + Sends the event using a network message. + + + + + + Sends a buffer of information to a registered message alias. + + The DNS or NetBIOS name of the server on which the function is to execute. + The message alias to which the message buffer should be sent + The originator of the message. + The message text. + The length, in bytes, of the message text. + + + The following restrictions apply for sending network messages: + + + + + Platform + Requirements + + + Windows NT + + + No special group membership is required to send a network message. + + + Admin, Accounts, Print, or Server Operator group membership is required to + successfully send a network message on a remote server. + + + + + Windows 2000 or later + + + If you send a message on a domain controller that is running Active Directory, + access is allowed or denied based on the access control list (ACL) for the securable + object. The default ACL permits only Domain Admins and Account Operators to send a network message. + + + On a member server or workstation, only Administrators and Server Operators can send a network message. + + + + + + + For more information see Security Requirements for the Network Management Functions. + + + + + If the function succeeds, the return value is zero. + + + + + + Gets or sets the sender of the message. + + + The sender of the message. + + + If this property is not specified, the message is sent from the local computer. + + + + + Gets or sets the message alias to which the message should be sent. + + + The recipient of the message. + + + This property should always be specified in order to send a message. + + + + + Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute. + + + DNS or NetBIOS name of the remote server on which the function is to execute. + + + + For Windows NT 4.0 and earlier, the string should begin with \\. + + + If this property is not specified, the local computer is used. + + + + + + Gets or sets the used to call the NetSend method. + + + The used to call the NetSend method. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appends log events to the OutputDebugString system. + + + + OutputDebugStringAppender appends log events to the + OutputDebugString system. + + + The string is passed to the native OutputDebugString + function. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Write the logging event to the output debug string API + + the event to log + + + Write the logging event to the output debug string API + + + + + + Stub for OutputDebugString native method + + the string to output + + + Stub for OutputDebugString native method + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Logs events to a remote syslog daemon. + + + + The BSD syslog protocol is used to remotely log to + a syslog daemon. The syslogd listens for for messages + on UDP port 514. + + + The syslog UDP protocol is not authenticated. Most syslog daemons + do not accept remote log messages because of the security implications. + You may be able to use the LocalSyslogAppender to talk to a local + syslog service. + + + There is an RFC 3164 that claims to document the BSD Syslog Protocol. + This RFC can be seen here: http://www.faqs.org/rfcs/rfc3164.html. + This appender generates what the RFC calls an "Original Device Message", + i.e. does not include the TIMESTAMP or HOSTNAME fields. By observation + this format of message will be accepted by all current syslog daemon + implementations. The daemon will attach the current time and the source + hostname or IP address to any messages received. + + + Syslog messages must have a facility and and a severity. The severity + is derived from the Level of the logging event. + The facility must be chosen from the set of defined syslog + values. The facilities list is predefined + and cannot be extended. + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + Rob Lyon + Nicko Cadell + + + + Sends logging events as connectionless UDP datagrams to a remote host or a + multicast group using an . + + + + UDP guarantees neither that messages arrive, nor that they arrive in the correct order. + + + To view the logging results, a custom application can be developed that listens for logging + events. + + + When decoding events send via this appender remember to use the same encoding + to decode the events as was used to send the events. See the + property to specify the encoding to use. + + + + This example shows how to log receive logging events that are sent + on IP address 244.0.0.1 and port 8080 to the console. The event is + encoded in the packet as a unicode string and it is decoded as such. + + IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0); + UdpClient udpClient; + byte[] buffer; + string loggingEvent; + + try + { + udpClient = new UdpClient(8080); + + while(true) + { + buffer = udpClient.Receive(ref remoteEndPoint); + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer); + Console.WriteLine(loggingEvent); + } + } + catch(Exception e) + { + Console.WriteLine(e.ToString()); + } + + + Dim remoteEndPoint as IPEndPoint + Dim udpClient as UdpClient + Dim buffer as Byte() + Dim loggingEvent as String + + Try + remoteEndPoint = new IPEndPoint(IPAddress.Any, 0) + udpClient = new UdpClient(8080) + + While True + buffer = udpClient.Receive(ByRef remoteEndPoint) + loggingEvent = System.Text.Encoding.Unicode.GetString(buffer) + Console.WriteLine(loggingEvent) + Wend + Catch e As Exception + Console.WriteLine(e.ToString()) + End Try + + + An example configuration section to log information using this appender to the + IP 224.0.0.1 on port 8080: + + + + + + + + + + Gert Driesen + Nicko Cadell + + + + Initializes a new instance of the class. + + + The default constructor initializes all fields to their default values. + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The appender will be ignored if no was specified or + an invalid remote or local TCP port number was specified. + + + The required property was not specified. + The TCP port number assigned to or is less than or greater than . + + + + This method is called by the method. + + The event to log. + + + Sends the event using an UDP datagram. + + + Exceptions are passed to the . + + + + + + Closes the UDP connection and releases all resources associated with + this instance. + + + + Disables the underlying and releases all managed + and unmanaged resources associated with the . + + + + + + Initializes the underlying connection. + + + + The underlying is initialized and binds to the + port number from which you intend to communicate. + + + Exceptions are passed to the . + + + + + + The IP address of the remote host or multicast group to which + the logging event will be sent. + + + + + The TCP port number of the remote host or multicast group to + which the logging event will be sent. + + + + + The cached remote endpoint to which the logging events will be sent. + + + + + The TCP port number from which the will communicate. + + + + + The instance that will be used for sending the + logging events. + + + + + The encoding to use for the packet. + + + + + Gets or sets the IP address of the remote host or multicast group to which + the underlying should sent the logging event. + + + The IP address of the remote host or multicast group to which the logging event + will be sent. + + + + Multicast addresses are identified by IP class D addresses (in the range 224.0.0.0 to + 239.255.255.255). Multicast packets can pass across different networks through routers, so + it is possible to use multicasts in an Internet scenario as long as your network provider + supports multicasting. + + + Hosts that want to receive particular multicast messages must register their interest by joining + the multicast group. Multicast messages are not sent to networks where no host has joined + the multicast group. Class D IP addresses are used for multicast groups, to differentiate + them from normal host addresses, allowing nodes to easily detect if a message is of interest. + + + Static multicast addresses that are needed globally are assigned by IANA. A few examples are listed in the table below: + + + + + IP Address + Description + + + 224.0.0.1 + + + Sends a message to all system on the subnet. + + + + + 224.0.0.2 + + + Sends a message to all routers on the subnet. + + + + + 224.0.0.12 + + + The DHCP server answers messages on the IP address 224.0.0.12, but only on a subnet. + + + + + + + A complete list of actually reserved multicast addresses and their owners in the ranges + defined by RFC 3171 can be found at the IANA web site. + + + The address range 239.0.0.0 to 239.255.255.255 is reserved for administrative scope-relative + addresses. These addresses can be reused with other local groups. Routers are typically + configured with filters to prevent multicast traffic in this range from flowing outside + of the local network. + + + + + + Gets or sets the TCP port number of the remote host or multicast group to which + the underlying should sent the logging event. + + + An integer value in the range to + indicating the TCP port number of the remote host or multicast group to which the logging event + will be sent. + + + The underlying will send messages to this TCP port number + on the remote host or multicast group. + + The value specified is less than or greater than . + + + + Gets or sets the TCP port number from which the underlying will communicate. + + + An integer value in the range to + indicating the TCP port number from which the underlying will communicate. + + + + The underlying will bind to this port for sending messages. + + + Setting the value to 0 (the default) will cause the udp client not to bind to + a local port. + + + The value specified is less than or greater than . + + + + Gets or sets used to write the packets. + + + The used to write the packets. + + + + The used to write the packets. + + + + + + Gets or sets the underlying . + + + The underlying . + + + creates a to send logging events + over a network. Classes deriving from can use this + property to get or set this . Use the underlying + returned from if you require access beyond that which + provides. + + + + + Gets or sets the cached remote endpoint to which the logging events should be sent. + + + The cached remote endpoint to which the logging events will be sent. + + + The method will initialize the remote endpoint + with the values of the and + properties. + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Syslog port 514 + + + + + Initializes a new instance of the class. + + + This instance of the class is set up to write + to a remote syslog daemon. + + + + + Add a mapping of level to severity + + The mapping to add + + + Add a mapping to this appender. + + + + + + This method is called by the method. + + The event to log. + + + Writes the event to a remote syslog daemon. + + + The format of the output will depend on the appender's layout. + + + + + + Initialize the options for this appender + + + + Initialize the level to syslog severity mappings set on this appender. + + + + + + Translates a log4net level to a syslog severity. + + A log4net level. + A syslog severity. + + + Translates a log4net level to a syslog severity. + + + + + + Generate a syslog priority. + + The syslog facility. + The syslog severity. + A syslog priority. + + + Generate a syslog priority. + + + + + + The facility. The default facility is . + + + + + The message identity + + + + + Mapping from level object to syslog severity + + + + + Message identity + + + + An identifier is specified with each log message. This can be specified + by setting the property. The identity (also know + as the tag) must not contain white space. The default value for the + identity is the application name (from ). + + + + + + Syslog facility + + + Set to one of the values. The list of + facilities is predefined and cannot be extended. The default value + is . + + + + + syslog severities + + + + The syslog severities. + + + + + + system is unusable + + + + + action must be taken immediately + + + + + critical conditions + + + + + error conditions + + + + + warning conditions + + + + + normal but significant condition + + + + + informational + + + + + debug-level messages + + + + + syslog facilities + + + + The syslog facilities + + + + + + kernel messages + + + + + random user-level messages + + + + + mail system + + + + + system daemons + + + + + security/authorization messages + + + + + messages generated internally by syslogd + + + + + line printer subsystem + + + + + network news subsystem + + + + + UUCP subsystem + + + + + clock (cron/at) daemon + + + + + security/authorization messages (private) + + + + + ftp daemon + + + + + NTP subsystem + + + + + log audit + + + + + log alert + + + + + clock daemon + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + reserved for local use + + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + A class to act as a mapping between the level that a logging call is made at and + the syslog severity that is should be logged at. + + + + + + The mapped syslog severity for the specified level + + + + Required property. + The mapped syslog severity for the specified level + + + + + + Delivers logging events to a remote logging sink. + + + + This Appender is designed to deliver events to a remote sink. + That is any object that implements the + interface. It delivers the events using .NET remoting. The + object to deliver events to is specified by setting the + appenders property. + + The RemotingAppender buffers events before sending them. This allows it to + make more efficient use of the remoting infrastructure. + + Once the buffer is full the events are still not sent immediately. + They are scheduled to be sent using a pool thread. The effect is that + the send occurs asynchronously. This is very important for a + number of non obvious reasons. The remoting infrastructure will + flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + Because the events are sent asynchronously using pool threads it is possible to close + this appender before all the queued events have been sent. + When closing the appender attempts to wait until all the queued events have been sent, but + this will timeout after 30 seconds regardless. + + If this appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. If the runtime terminates the threads before + the queued events have been sent then they will be lost. To ensure that all events + are sent the appender must be closed before the application exits. See + for details on how to shutdown + log4net programmatically. + + + Nicko Cadell + Gert Driesen + Daniel Cazzulino + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Send the contents of the buffer to the remote sink. + + + The events are not sent immediately. They are scheduled to be sent + using a pool thread. The effect is that the send occurs asynchronously. + This is very important for a number of non obvious reasons. The remoting + infrastructure will flow thread local variables (stored in the ), + if they are marked as , across the + remoting boundary. If the server is not contactable then + the remoting infrastructure will clear the + objects from the . To prevent a logging failure from + having side effects on the calling application the remoting call must be made + from a separate thread to the one used by the application. A + thread is used for this. If no thread is available then + the events will block in the thread pool manager until a thread is available. + + The events to send. + + + + Override base class close. + + + + This method waits while there are queued work items. The events are + sent asynchronously using work items. These items + will be sent once a thread pool thread is available to send them, therefore + it is possible to close the appender before all the queued events have been + sent. + + This method attempts to wait until all the queued events have been sent, but this + method will timeout after 30 seconds regardless. + + If the appender is being closed because the + event has fired it may not be possible to send all the queued events. During process + exit the runtime limits the time that a + event handler is allowed to run for. + + + + + A work item is being queued into the thread pool + + + + + A work item from the thread pool has completed + + + + + Send the contents of the buffer to the remote sink. + + + This method is designed to be used with the . + This method expects to be passed an array of + objects in the state param. + + the logging events to send + + + + The URL of the remote sink. + + + + + The local proxy (.NET remoting) for the remote logging sink. + + + + + The number of queued callbacks currently waiting or executing + + + + + Event used to signal when there are no queued work items + + + This event is set when there are no queued work items. In this + state it is safe to close the appender. + + + + + Gets or sets the URL of the well-known object that will accept + the logging events. + + + The well-known URL of the remote sink. + + + + The URL of the remoting sink that will accept logging events. + The sink must implement the + interface. + + + + + + Interface used to deliver objects to a remote sink. + + + This interface must be implemented by a remoting sink + if the is to be used + to deliver logging events to the sink. + + + + + Delivers logging events to the remote sink + + Array of events to log. + + + Delivers logging events to the remote sink + + + + + + Appender that rolls log files based on size or date or both. + + + + RollingFileAppender can roll log files based on size or date or both + depending on the setting of the property. + When set to the log file will be rolled + once its size exceeds the . + When set to the log file will be rolled + once the date boundary specified in the property + is crossed. + When set to the log file will be + rolled once the date boundary specified in the property + is crossed, but within a date boundary the file will also be rolled + once its size exceeds the . + When set to the log file will be rolled when + the appender is configured. This effectively means that the log file can be + rolled once per program execution. + + + A of few additional optional features have been added: + + Attach date pattern for current log file + Backup number increments for newer files + Infinite number of backups by file size + + + + + + For large or infinite numbers of backup files a + greater than zero is highly recommended, otherwise all the backup files need + to be renamed each time a new backup is created. + + + When Date/Time based rolling is used setting + to will reduce the number of file renamings to few or none. + + + + + + Changing or without clearing + the log file directory of backup files will cause unexpected and unwanted side effects. + + + + + If Date/Time based rolling is enabled this appender will attempt to roll existing files + in the directory without a Date/Time tag based on the last write date of the base log file. + The appender only rolls the log file when a message is logged. If Date/Time based rolling + is enabled then the appender will not roll the log file at the Date/Time boundary but + at the point when the next message is logged after the boundary has been crossed. + + + + The extends the and + has the same behavior when opening the log file. + The appender will first try to open the file for writing when + is called. This will typically be during configuration. + If the file cannot be opened for writing the appender will attempt + to open the file again each time a message is logged to the appender. + If the file cannot be opened for writing when a message is logged then + the message will be discarded by this appender. + + + When rolling a backup file necessitates deleting an older backup file the + file to be deleted is moved to a temporary name before being deleted. + + + + + A maximum number of backup files when rolling on date/time boundaries is not supported. + + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + Edward Smit + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Sets the quiet writer being used. + + + This method can be overridden by sub classes. + + the writer to set + + + + Write out a logging event. + + the event to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Write out an array of logging events. + + the events to write to file. + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Performs any required rolling before outputting the next event + + + + Handles append time behavior for RollingFileAppender. This checks + if a roll over either by date (checked first) or time (checked second) + is need and then appends to the file last. + + + + + + Creates and opens the file for logging. If + is false then the fully qualified name is determined and used. + + the name of the file to open + true to append to existing file + + This method will ensure that the directory structure + for the specified exists. + + + + + Get the current output file name + + the base file name + the output file name + + The output file name is based on the base fileName specified. + If is set then the output + file name is the same as the base file passed in. Otherwise + the output file depends on the date pattern, on the count + direction or both. + + + + + Determines curSizeRollBackups (only within the current roll point) + + + + + Generates a wildcard pattern that can be used to find all files + that are similar to the base file name. + + + + + + + Builds a list of filenames for all files matching the base filename plus a file + pattern. + + + + + + + Initiates a roll over if needed for crossing a date boundary since the last run. + + + + + Initializes based on existing conditions at time of . + + + + Initializes based on existing conditions at time of . + The following is done + + determine curSizeRollBackups (only within the current roll point) + initiates a roll over if needed for crossing a date boundary since the last run. + + + + + + + Does the work of bumping the 'current' file counter higher + to the highest count when an incremental file name is seen. + The highest count is either the first file (when count direction + is greater than 0) or the last file (when count direction less than 0). + In either case, we want to know the highest count that is present. + + + + + + + Takes a list of files and a base file name, and looks for + 'incremented' versions of the base file. Bumps the max + count up to the highest count seen. + + + + + + + Calculates the RollPoint for the datePattern supplied. + + the date pattern to calculate the check period for + The RollPoint that is most accurate for the date pattern supplied + + Essentially the date pattern is examined to determine what the + most suitable roll point is. The roll point chosen is the roll point + with the smallest period that can be detected using the date pattern + supplied. i.e. if the date pattern only outputs the year, month, day + and hour then the smallest roll point that can be detected would be + and hourly roll point as minutes could not be detected. + + + + + Initialize the appender based on the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Sets initial conditions including date/time roll over information, first check, + scheduledFilename, and calls to initialize + the current number of backups. + + + + + + Rollover the file(s) to date/time tagged file(s). + + set to true if the file to be rolled is currently open + + + Rollover the file(s) to date/time tagged file(s). + Resets curSizeRollBackups. + If fileIsOpen is set then the new file is opened (through SafeOpenFile). + + + + + + Renames file to file . + + Name of existing file to roll. + New name for file. + + + Renames file to file . It + also checks for existence of target file and deletes if it does. + + + + + + Test if a file exists at a specified path + + the path to the file + true if the file exists + + + Test if a file exists at a specified path + + + + + + Deletes the specified file if it exists. + + The file to delete. + + + Delete a file if is exists. + The file is first moved to a new filename then deleted. + This allows the file to be removed even when it cannot + be deleted, but it still can be moved. + + + + + + Implements file roll base on file size. + + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. Moreover, File is + renamed File.1 and closed. + + + A new file is created to receive further log output. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + + + + Implements file roll. + + the base name to rename + + + If the maximum number of size based backups is reached + (curSizeRollBackups == maxSizeRollBackups) then the oldest + file is deleted -- its index determined by the sign of countDirection. + If countDirection < 0, then files + {File.1, ..., File.curSizeRollBackups -1} + are renamed to {File.2, ..., + File.curSizeRollBackups}. + + + If maxSizeRollBackups is equal to zero, then the + File is truncated with no backup files created. + + + If maxSizeRollBackups < 0, then File is + renamed if needed and no files are deleted. + + + This is called by to rename the files. + + + + + + Get the start time of the next window for the current rollpoint + + the current date + the type of roll point we are working with + the start time for the next roll point an interval after the currentDateTime date + + + Returns the date of the next roll point after the currentDateTime date passed to the method. + + + The basic strategy is to subtract the time parts that are less significant + than the rollpoint from the current time. This should roll the time back to + the start of the time window for the current rollpoint. Then we add 1 window + worth of time and get the start time of the next window for the rollpoint. + + + + + + This object supplies the current date/time. Allows test code to plug in + a method to control this class when testing date/time based rolling. + + + + + The date pattern. By default, the pattern is set to ".yyyy-MM-dd" + meaning daily rollover. + + + + + The actual formatted filename that is currently being written to + or will be the file transferred to on roll over + (based on staticLogFileName). + + + + + The timestamp when we shall next recompute the filename. + + + + + Holds date of last roll over + + + + + The type of rolling done + + + + + The default maximum file size is 10MB + + + + + There is zero backup files by default + + + + + How many sized based backups have been made so far + + + + + The rolling file count direction. + + + + + The rolling mode used in this appender. + + + + + Cache flag set if we are rolling by date. + + + + + Cache flag set if we are rolling by size. + + + + + Value indicating whether to always log to the same file. + + + + + FileName provided in configuration. Used for rolling properly + + + + + The 1st of January 1970 in UTC + + + + + Gets or sets the date pattern to be used for generating file names + when rolling over on date. + + + The date pattern to be used for generating file names when rolling + over on date. + + + + Takes a string in the same format as expected by + . + + + This property determines the rollover schedule when rolling over + on date. + + + + + + Gets or sets the maximum number of backup files that are kept before + the oldest is erased. + + + The maximum number of backup files that are kept before the oldest is + erased. + + + + If set to zero, then there will be no backup files and the log file + will be truncated when it reaches . + + + If a negative number is supplied then no deletions will be made. Note + that this could result in very slow performance as a large number of + files are rolled over unless is used. + + + The maximum applies to each time based group of files and + not the total. + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size in bytes that the output file is allowed to reach before being + rolled over to backup files. + + + + This property is equivalent to except + that it is required for differentiating the setter taking a + argument from the setter taking a + argument. + + + The default maximum file size is 10MB (10*1024*1024). + + + + + + Gets or sets the maximum size that the output file is allowed to reach + before being rolled over to backup files. + + + The maximum size that the output file is allowed to reach before being + rolled over to backup files. + + + + This property allows you to specify the maximum size with the + suffixes "KB", "MB" or "GB" so that the size is interpreted being + expressed respectively in kilobytes, megabytes or gigabytes. + + + For example, the value "10KB" will be interpreted as 10240 bytes. + + + The default maximum file size is 10MB. + + + If you have the option to set the maximum file size programmatically + consider using the property instead as this + allows you to set the size in bytes as a . + + + + + + Gets or sets the rolling file count direction. + + + The rolling file count direction. + + + + Indicates if the current file is the lowest numbered file or the + highest numbered file. + + + By default newer files have lower numbers ( < 0), + i.e. log.1 is most recent, log.5 is the 5th backup, etc... + + + >= 0 does the opposite i.e. + log.1 is the first backup made, log.5 is the 5th backup made, etc. + For infinite backups use >= 0 to reduce + rollover costs. + + The default file count direction is -1. + + + + + Gets or sets the rolling style. + + The rolling style. + + + The default rolling style is . + + + When set to this appender's + property is set to false, otherwise + the appender would append to a single file rather than rolling + the file each time it is opened. + + + + + + Gets or sets a value indicating whether to always log to + the same file. + + + true if always should be logged to the same file, otherwise false. + + + + By default file.log is always the current file. Optionally + file.log.yyyy-mm-dd for current formatted datePattern can by the currently + logging file (or file.log.curSizeRollBackup or even + file.log.yyyy-mm-dd.curSizeRollBackup). + + + This will make time based rollovers with a large number of backups + much faster as the appender it won't have to rename all the backups! + + + + + + Style of rolling to use + + + + Style of rolling to use + + + + + + Roll files once per program execution + + + + Roll files once per program execution. + Well really once each time this appender is + configured. + + + Setting this option also sets AppendToFile to + false on the RollingFileAppender, otherwise + this appender would just be a normal file appender. + + + + + + Roll files based only on the size of the file + + + + + Roll files based only on the date + + + + + Roll files based on both the size and date of the file + + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + The code assumes that the following 'time' constants are in a increasing sequence. + + + + + + Roll the log not based on the date + + + + + Roll the log for each minute + + + + + Roll the log for each hour + + + + + Roll the log twice a day (midday and midnight) + + + + + Roll the log each day (midnight) + + + + + Roll the log each week + + + + + Roll the log each month + + + + + This interface is used to supply Date/Time information to the . + + + This interface is used to supply Date/Time information to the . + Used primarily to allow test classes to plug themselves in so they can + supply test date/times. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Default implementation of that returns the current time. + + + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Send an e-mail when a specific logging event occurs, typically on errors + or fatal errors. + + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Authentication and setting the server Port are only available on the MS .NET 1.1 runtime. + For these features to be enabled you need to ensure that you are using a version of + the log4net assembly that is built against the MS .NET 1.1 framework and that you are + running the your application on the MS .NET 1.1 runtime. On all other platforms only sending + unauthenticated messages to a server listening on port 25 (the default) is supported. + + + Authentication is supported by setting the property to + either or . + If using authentication then the + and properties must also be set. + + + To set the SMTP server port use the property. The default port is 25. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + + Send the email message + + the body text to include in the mail + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of recipient e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the name of the SMTP relay mail server to use to send + the e-mail messages. + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + The name of the e-mail relay server. If SmtpServer is not set, the + name of the local SMTP server is used. + + + + + + Obsolete + + + Use the BufferingAppenderSkeleton Fix methods instead + + + + Obsolete property. + + + + + + The mode to use to authentication with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + Valid Authentication mode values are: , + , and . + The default value is . When using + you must specify the + and to use to authenticate. + When using the Windows credentials for the current + thread, if impersonating, or the process will be used to authenticate. + + + + + + The username to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the username will be ignored. + + + + + + The password to use to authenticate with the SMTP server + + + Authentication is only available on the MS .NET 1.1 runtime. + + A and must be specified when + is set to , + otherwise the password will be ignored. + + + + + + The port on which the SMTP server is listening + + + Server Port is only available on the MS .NET 1.1 runtime. + + The port on which the SMTP server is listening. The default + port is 25. The Port can only be changed when running on + the MS .NET 1.1 runtime. + + + + + + Gets or sets the priority of the e-mail message + + + One of the values. + + + + Sets the priority of the e-mails generated by this + appender. The default priority is . + + + If you are using this appender to report errors then + you may want to set the priority to . + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Values for the property. + + + + SMTP authentication modes. + + + + + + No authentication + + + + + Basic authentication. + + + Requires a username and password to be supplied + + + + + Integrated authentication + + + Uses the Windows credentials from the current thread or process to authenticate. + + + + + Send an email when a specific logging event occurs, typically on errors + or fatal errors. Rather than sending via smtp it writes a file into the + directory specified by . This allows services such + as the IIS SMTP agent to manage sending the messages. + + + + The configuration for this appender is identical to that of the SMTPAppender, + except that instead of specifying the SMTPAppender.SMTPHost you specify + . + + + The number of logging events delivered in this e-mail depend on + the value of option. The + keeps only the last + logging events in its + cyclic buffer. This keeps memory requirements at a reasonable level while + still delivering useful application context. + + + Niall Daley + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + Sends the contents of the cyclic buffer as an e-mail message. + + The logging events to send. + + + Sends the contents of the cyclic buffer as an e-mail message. + + + + + + Activate the options on this appender. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert a path into a fully qualified path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + + + + The security context to use for privileged calls + + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses. + + + A semicolon-delimited list of e-mail addresses. + + + + A semicolon-delimited list of e-mail addresses. + + + + + + Gets or sets the e-mail address of the sender. + + + The e-mail address of the sender. + + + + The e-mail address of the sender. + + + + + + Gets or sets the subject line of the e-mail message. + + + The subject line of the e-mail message. + + + + The subject line of the e-mail message. + + + + + + Gets or sets the path to write the messages to. + + + + Gets or sets the path to write the messages to. This should be the same + as that used by the agent sending the messages. + + + + + + Gets or sets the used to write to the pickup directory. + + + The used to write to the pickup directory. + + + + Unless a specified here for this appender + the is queried for the + security context to use. The default behavior is to use the security context + of the current thread. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Appender that allows clients to connect via Telnet to receive log messages + + + + The TelnetAppender accepts socket connections and streams logging messages + back to the client. + The output is provided in a telnet-friendly way so that a log can be monitored + over a TCP/IP socket. + This allows simple remote monitoring of application logging. + + + The default is 23 (the telnet port). + + + Keith Long + Nicko Cadell + + + + Default constructor + + + + Default constructor + + + + + + Overrides the parent method to close the socket handler + + + + Closes all the outstanding connections. + + + + + + Initialize the appender based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Create the socket handler and wait for connections + + + + + + Writes the logging event to each connected client. + + The event to log. + + + Writes the logging event to each connected client. + + + + + + Gets or sets the TCP port number on which this will listen for connections. + + + An integer value in the range to + indicating the TCP port number on which this will listen for connections. + + + + The default value is 23 (the telnet port). + + + The value specified is less than + or greater than . + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Helper class to manage connected clients + + + + The SocketHandler class is used to accept connections from + clients. It is threaded so that clients can connect/disconnect + asynchronously. + + + + + + Opens a new server port on + + the local port to listen on for connections + + + Creates a socket handler on the specified local server port. + + + + + + Sends a string message to each of the connected clients + + the text to send + + + Sends a string message to each of the connected clients + + + + + + Add a client to the internal clients list + + client to add + + + + Remove a client from the internal clients list + + client to remove + + + + Callback used to accept a connection on the server socket + + The result of the asynchronous operation + + + On connection adds to the list of connections + if there are two many open connections you will be disconnected + + + + + + Close all network connections + + + + Make sure we close all network connections + + + + + + Test if this handler has active connections + + + true if this handler has active connections + + + + This property will be true while this handler has + active connections, that is at least one connection that + the handler will attempt to send a message to. + + + + + + Class that represents a client connected to this handler + + + + Class that represents a client connected to this handler + + + + + + Create this for the specified + + the client's socket + + + Opens a stream writer on the socket. + + + + + + Write a string to the client + + string to send + + + Write a string to the client + + + + + + Cleanup the clients connection + + + + Close the socket connection. + + + + + + Appends log events to the system. + + + + The application configuration file can be used to control what listeners + are actually used. See the MSDN documentation for the + class for details on configuring the + trace system. + + + Events are written using the System.Diagnostics.Trace.Write(string,string) + method. The event's logger name is passed as the value for the category name to the Write method. + + + Compact Framework
+ The Compact Framework does not support the + class for any operation except Assert. When using the Compact Framework this + appender will write to the system rather than + the Trace system. This appender will therefore behave like the . +
+
+ Douglas de la Torre + Nicko Cadell + Gert Driesen +
+ + + Initializes a new instance of the . + + + + Default constructor. + + + + + + Initializes a new instance of the + with a specified layout. + + The layout to use with this appender. + + + Obsolete constructor. + + + + + + Writes the logging event to the system. + + The event to log. + + + Writes the logging event to the system. + + + + + + Immediate flush means that the underlying writer or output stream + will be flushed at the end of each append operation. + + + + Immediate flush is slower but ensures that each append request is + actually written. If is set to + false, then there is a good chance that the last few + logs events are not actually written to persistent media if and + when the application crashes. + + + The default value is true. + + + + + Gets or sets a value that indicates whether the appender will + flush at the end of each write. + + + The default behavior is to flush at the end of each + write. If the option is set tofalse, then the underlying + stream can defer writing to physical medium to a later time. + + + Avoiding the flush operation at the end of each append results + in a performance gain of 10 to 20 percent. However, there is safety + trade-off involved in skipping flushing. Indeed, when flushing is + skipped, then it is likely that the last few log events will not + be recorded on disk when the application exits. This is a high + price to pay even for a 20% performance gain. + + + + + + This appender requires a to be set. + + true + + + This appender requires a to be set. + + + + + + Assembly level attribute that specifies a domain to alias to this assembly's repository. + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's domain to its repository by + specifying this attribute with the name of the target domain. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required domains. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies a repository to alias to this assembly's repository. + + + + An assembly's logger repository is defined by its , + however this can be overridden by an assembly loaded before the target assembly. + + + An assembly can alias another assembly's repository to its repository by + specifying this attribute with the name of the target repository. + + + This attribute can only be specified on the assembly and may be used + as many times as necessary to alias all the required repositories. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + The repository to alias to this assemby's repository. + + + Initializes a new instance of the class with + the specified repository to alias to this assembly's repository. + + + + + + Gets or sets the repository to alias to this assemby's repository. + + + The repository to alias to this assemby's repository. + + + + The name of the repository to alias to this assemby's repository. + + + + + + Initializes a new instance of the class with + the specified domain to alias to this assembly's repository. + + The domain to alias to this assemby's repository. + + + Obsolete. Use instead of . + + + + + + Use this class to quickly configure a . + + + + Allows very simple programmatic configuration of log4net. + + + Only one appender can be configured using this configurator. + The appender is set at the root of the hierarchy and all logging + events will be delivered to that appender. + + + Appenders can also implement the interface. Therefore + they would require that the method + be called after the appenders properties have been configured. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Initializes the log4net system with a default configuration. + + + + Initializes the log4net logging system using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the log4net system using the specified appender. + + The appender to use to log all logging events. + + + Initializes the log4net system using the specified appender. + + + + + + Initializes the with a default configuration. + + The repository to configure. + + + Initializes the specified repository using a + that will write to Console.Out. The log messages are + formatted using the layout object + with the + layout style. + + + + + + Initializes the using the specified appender. + + The repository to configure. + The appender to use to log all logging events. + + + Initializes the using the specified appender. + + + + + + Base class for all log4net configuration attributes. + + + This is an abstract class that must be extended by + specific configurators. This attribute allows the + configurator to be parameterized by an assembly level + attribute. + + Nicko Cadell + Gert Driesen + + + + Constructor used by subclasses. + + the ordering priority for this configurator + + + The is used to order the configurator + attributes before they are invoked. Higher priority configurators are executed + before lower priority ones. + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Abstract method implemented by a subclass. When this method is called + the subclass should configure the . + + + + + + Compare this instance to another ConfiguratorAttribute + + the object to compare to + see + + + Compares the priorities of the two instances. + Sorts by priority in descending order. Objects with the same priority are + randomly ordered. + + + + + + Assembly level attribute that specifies the logging domain for the assembly. + + + + DomainAttribute is obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + Assemblies are mapped to logging domains. Each domain has its own + logging repository. This attribute specified on the assembly controls + the configuration of the domain. The property specifies the name + of the domain that this assembly is a part of. The + specifies the type of the repository objects to create for the domain. If + this attribute is not specified and a is not specified + then the assembly will be part of the default shared logging domain. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute that specifies the logging repository for the assembly. + + + + Assemblies are mapped to logging repository. This attribute specified + on the assembly controls + the configuration of the repository. The property specifies the name + of the repository that this assembly is a part of. The + specifies the type of the object + to create for the assembly. If this attribute is not specified or a + is not specified then the assembly will be part of the default shared logging repository. + + + This attribute can only be specified on the assembly and may only be used + once per assembly. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Initialize a new instance of the class + with the name of the repository. + + The name of the repository. + + + Initialize the attribute with the name for the assembly's repository. + + + + + + Gets or sets the name of the logging repository. + + + The string name to use as the name of the repository associated with this + assembly. + + + + This value does not have to be unique. Several assemblies can share the + same repository. They will share the logging configuration of the repository. + + + + + + Gets or sets the type of repository to create for this assembly. + + + The type of repository to create for this assembly. + + + + The type of the repository to create for the assembly. + The type must implement the + interface. + + + This will be the type of repository created when + the repository is created. If multiple assemblies reference the + same repository then the repository is only created once using the + of the first assembly to call into the + repository. + + + + + + Initializes a new instance of the class. + + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Initialize a new instance of the class + with the name of the domain. + + The name of the domain. + + + Obsolete. Use RepositoryAttribute instead of DomainAttribute. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + The repository to configure. + + + + Configures log4net using a log4net element + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The element to parse. + + + + Configures the using the specified XML + element. + + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration file. + + A stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Assembly level attribute to configure the . + + + + AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute. + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + Gert Driesen + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + If neither of the or + properties are set the configuration is loaded from the application's .config file. + If set the property takes priority over the + property. The property + specifies a path to a file to load the config from. The path is relative to the + application's base directory; . + The property is used as a postfix to the assembly file name. + The config file must be located in the application's base directory; . + For example in a console application setting the to + config has the same effect as not specifying the or + properties. + + + The property can be set to cause the + to watch the configuration file for changes. + + + + Log4net will only look for assembly level configuration attributes once. + When using the log4net assembly level attributes to control the configuration + of log4net you must ensure that the first call to any of the + methods is made from the assembly with the configuration + attributes. + + + If you cannot guarantee the order in which log4net calls will be made from + different assemblies you must use programmatic configuration instead, i.e. + call the method directly. + + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Default constructor + + + + + + Configures the for the specified assembly. + + The assembly that this attribute was defined on. + The repository to configure. + + + Configure the repository using the . + The specified must extend the + class otherwise the will not be able to + configure it. + + + The does not extend . + + + + Attempt to load configuration from the local file system + + The assembly that this attribute was defined on. + The repository to configure. + + + + Configure the specified repository using a + + The repository to configure. + the FileInfo pointing to the config file + + + + Attempt to load configuration from a URI + + The assembly that this attribute was defined on. + The repository to configure. + + + + Gets or sets the filename of the configuration file. + + + The filename of the configuration file. + + + + If specified, this is the name of the configuration file to use with + the . This file path is relative to the + application base directory (). + + + The takes priority over the . + + + + + + Gets or sets the extension of the configuration file. + + + The extension of the configuration file. + + + + If specified this is the extension for the configuration file. + The path to the config file is built by using the application + base directory (), + the assembly file name and the config file extension. + + + If the is set to MyExt then + possible config file names would be: MyConsoleApp.exe.MyExt or + MyClassLibrary.dll.MyExt. + + + The takes priority over the . + + + + + + Gets or sets a value indicating whether to watch the configuration file. + + + true if the configuration should be watched, false otherwise. + + + + If this flag is specified and set to true then the framework + will watch the configuration file and will reload the config each time + the file is modified. + + + The config file can only be watched if it is loaded from local disk. + In a No-Touch (Smart Client) deployment where the application is downloaded + from a web server the config file may not reside on the local disk + and therefore it may not be able to watch it. + + + Watching configuration is not supported on the SSCLI. + + + + + + Class to register for the log4net section of the configuration file + + + The log4net section of the configuration file needs to have a section + handler registered. This is the section handler used. It simply returns + the XML element that is the root of the section. + + + Example of registering the log4net section handler : + + + +
+ + + log4net configuration XML goes here + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Default constructor. + + + + + + Parses the configuration section. + + The configuration settings in a corresponding parent configuration section. + The configuration context when called from the ASP.NET configuration system. Otherwise, this parameter is reserved and is a null reference. + The for the log4net section. + The for the log4net section. + + + Returns the containing the configuration data, + + + + + + Assembly level attribute that specifies a plugin to attach to + the repository. + + + + Specifies the type of a plugin to create and attach to the + assembly's repository. The plugin type must implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Interface used to create plugins. + + + + Interface used to create a plugin. + + + Nicko Cadell + Gert Driesen + + + + Creates the plugin object. + + the new plugin instance + + + Create and return a new plugin instance. + + + + + + Initializes a new instance of the class + with the specified type. + + The type name of plugin to create. + + + Create the attribute with the plugin type specified. + + + Where possible use the constructor that takes a . + + + + + + Initializes a new instance of the class + with the specified type. + + The type of plugin to create. + + + Create the attribute with the plugin type specified. + + + + + + Creates the plugin object defined by this attribute. + + + + Creates the instance of the object as + specified by this attribute. + + + The plugin object. + + + + Returns a representation of the properties of this object. + + + + Overrides base class method to + return a representation of the properties of this object. + + + A representation of the properties of this object + + + + Gets or sets the type for the plugin. + + + The type for the plugin. + + + + The type for the plugin. + + + + + + Gets or sets the type name for the plugin. + + + The type name for the plugin. + + + + The type name for the plugin. + + + Where possible use the property instead. + + + + + + Assembly level attribute to configure the . + + + + This attribute may only be used at the assembly scope and can only + be used once per assembly. + + + Use this attribute to configure the + without calling one of the + methods. + + + Nicko Cadell + + + + Construct provider attribute with type specified + + the type of the provider to use + + + The provider specified must subclass the + class. + + + + + + Configures the SecurityContextProvider + + The assembly that this attribute was defined on. + The repository to configure. + + + Creates a provider instance from the specified. + Sets this as the default security context provider . + + + + + + Gets or sets the type of the provider to use. + + + the type of the provider to use. + + + + The provider specified must subclass the + class. + + + + + + Use this class to initialize the log4net environment using an Xml tree. + + + + Configures a using an Xml tree. + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + + + Automatically configures the log4net system based on the + application's configuration settings. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + + + + + Automatically configures the using settings + stored in the application's configuration file. + + + + Each application has a configuration file. This has the + same name as the application with '.config' appended. + This file is XML and calling this function prompts the + configurator to look in that file for a section called + log4net that contains the configuration data. + + + To use this method to configure log4net you must specify + the section + handler for the log4net configuration section. See the + for an example. + + + The repository to configure. + + + + Configures log4net using a log4net element + + + + Loads the log4net configuration from the XML element + supplied as . + + + The element to parse. + + + + Configures the using the specified XML + element. + + + Loads the log4net configuration from the XML element + supplied as . + + The repository to configure. + The element to parse. + + + + Configures log4net using the specified configuration file. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures log4net using the specified configuration URI. + + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + The must support the URI scheme specified. + + + + + + Configures log4net using the specified configuration data stream. + + A stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the log4net configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The log4net configuration file can possible be specified in the application's + configuration file (either MyAppName.exe.config for a + normal application on Web.config for an ASP.NET application). + + + The first element matching <configuration> will be read as the + configuration. If this file is also a .NET .config file then you must specify + a configuration section for the log4net element otherwise .NET will + complain. Set the type for the section handler to , for example: + + +
+ + + + + The following example configures log4net using a configuration file, of which the + location is stored in the application's configuration file : + + + using log4net.Config; + using System.IO; + using System.Configuration; + + ... + + XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"])); + + + In the .config file, the path to the log4net can be specified like this : + + + + + + + + + + + + + Configures the using the specified configuration + URI. + + The repository to configure. + A URI to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The must support the URI scheme specified. + + + + + + Configures the using the specified configuration + file. + + The repository to configure. + The stream to load the XML configuration from. + + + The configuration data must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + Note that this method will NOT close the stream parameter. + + + + + + Configures log4net using the file specified, monitors the file for changes + and reloads the configuration if a change is detected. + + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the using the file specified, + monitors the file for changes and reloads the configuration if a change + is detected. + + The repository to configure. + The XML file to load the configuration from. + + + The configuration file must be valid XML. It must contain + at least one element called log4net that holds + the configuration data. + + + The configuration file will be monitored using a + and depends on the behavior of that class. + + + For more information on how to configure log4net using + a separate configuration file, see . + + + + + + + Configures the specified repository using a log4net element. + + The hierarchy to configure. + The element to parse. + + + Loads the log4net configuration from the XML element + supplied as . + + + This method is ultimately called by one of the Configure methods + to load the configuration from an . + + + + + + Class used to watch config files. + + + + Uses the to monitor + changes to a specified file. Because multiple change notifications + may be raised when the file is modified, a timer is used to + compress the notifications into a single event. The timer + waits for time before delivering + the event notification. If any further + change notifications arrive while the timer is waiting it + is reset and waits again for to + elapse. + + + + + + The default amount of time to wait after receiving notification + before reloading the config file. + + + + + Watch a specified config file used to configure a repository + + The repository to configure. + The configuration file to watch. + + + Watch a specified config file used to configure a repository + + + + + + Holds the FileInfo used to configure the XmlConfigurator + + + + + Holds the repository being configured. + + + + + The timer used to compress the notification events. + + + + + Initializes a new instance of the class. + + The repository to configure. + The configuration file to watch. + + + Initializes a new instance of the class. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Event handler used by . + + The firing the event. + The argument indicates the file that caused the event to be fired. + + + This handler reloads the configuration from the file when the event is fired. + + + + + + Called by the timer when the configuration has been updated. + + null + + + + The implementation of the interface suitable + for use with the compact framework + + + + This implementation is a simple + mapping between repository name and + object. + + + The .NET Compact Framework 1.0 does not support retrieving assembly + level attributes therefore unlike the DefaultRepositorySelector + this selector does not examine the calling assembly for attributes. + + + Nicko Cadell + + + + Interface used by the to select the . + + + + The uses a + to specify the policy for selecting the correct + to return to the caller. + + + Nicko Cadell + Gert Driesen + + + + Gets the for the specified assembly. + + The assembly to use to lookup to the + The for the assembly. + + + Gets the for the specified assembly. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. The results of this method must be repeatable, i.e. + when called again with the same arguments the result must be the + save value. + + + + + + Gets the named . + + The name to use to lookup to the . + The named + + Lookup a named . This is the repository created by + calling . + + + + + Creates a new repository for the assembly specified. + + The assembly to use to create the domain to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the domain + specified such that a call to with the + same assembly specified will return the same repository instance. + + + How the association between and + is made is not defined. The implementation may choose any method for + this association. + + + + + + Creates a new repository with the name specified. + + The name to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the name + specified such that a call to with the + same name will return the same repository instance. + + + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets an array of all currently defined repositories. + + + An array of the instances created by + this . + + + Gets an array of all of the repositories created by this selector. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Create a new repository selector + + the type of the repositories to create, must implement + + + Create an new compact repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + throw if is null + throw if does not implement + + + + Get the for the specified assembly + + not used + The default + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Get the named + + the name of the repository to lookup + The named + + + Get the named . The default + repository is log4net-default-repository. Other repositories + must be created using the . + If the named repository does not exist an exception is thrown. + + + throw if is null + throw if the does not exist + + + + Create a new repository for the assembly specified + + not used + the type of repository to create, must implement + the repository created + + + The argument is not used. This selector does not create a + separate repository for each assembly. + + + If the is null then the + default repository type specified to the constructor is used. + + + As a named repository is not specified the default repository is + returned. The default repository is named log4net-default-repository. + + + + + + Create a new repository for the repository specified + + the repository to associate with the + the type of repository to create, must implement . + If this param is null then the default repository type is used. + the repository created + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + If the named repository already exists an exception will be thrown. + + + If is null then the default + repository type specified to the constructor is used. + + + throw if is null + throw if the already exists + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + Notify the registered listeners that the repository has been created + + The repository that has been created + + + Raises the LoggerRepositoryCreatedEvent + event. + + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + The default implementation of the interface. + + + + Uses attributes defined on the calling assembly to determine how to + configure the hierarchy for the repository. + + + Nicko Cadell + Gert Driesen + + + + Creates a new repository selector. + + The type of the repositories to create, must implement + + + Create an new repository selector. + The default type for repositories must be specified, + an appropriate value would be . + + + is . + does not implement . + + + + Gets the for the specified assembly. + + The assembly use to lookup the . + + + The type of the created and the repository + to create can be overridden by specifying the + attribute on the . + + + The default values are to use the + implementation of the interface and to use the + as the name of the repository. + + + The created will be automatically configured using + any attributes defined on + the . + + + The for the assembly + is . + + + + Gets the for the specified repository. + + The repository to use to lookup the . + The for the specified repository. + + + Returns the named repository. If is null + a is thrown. If the repository + does not exist a is thrown. + + + Use to create a repository. + + + is . + does not exist. + + + + Create a new repository for the assembly specified + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the assembly specified. + + the assembly to use to create the repository to associate with the . + The type of repository to create, must implement . + The name to assign to the created repository + Set to true to read and apply the assembly attributes + The repository created. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The type of the created and + the repository to create can be overridden by specifying the + attribute on the + . The default values are to use the + implementation of the + interface and to use the + as the name of the repository. + + + The created will be automatically + configured using any + attributes defined on the . + + + If a repository for the already exists + that repository will be returned. An error will not be raised and that + repository may be of a different type to that specified in . + Also the attribute on the + assembly may be used to override the repository type specified in + . + + + is . + + + + Creates a new repository for the specified repository. + + The repository to associate with the . + The type of repository to create, must implement . + If this param is then the default repository type is used. + The new repository. + + + The created will be associated with the repository + specified such that a call to with the + same repository specified will return the same repository instance. + + + is . + already exists. + + + + Test if a named repository exists + + the named repository to check + true if the repository exists + + + Test if a named repository exists. Use + to create a new repository and to retrieve + a repository. + + + + + + Gets a list of objects + + an array of all known objects + + + Gets an array of all of the repositories created by this selector. + + + + + + Aliases a repository to an existing repository. + + The repository to alias. + The repository that the repository is aliased to. + + + The repository specified will be aliased to the repository when created. + The repository must not already exist. + + + When the repository is created it must utilize the same repository type as + the repository it is aliased to, otherwise the aliasing will fail. + + + + is . + -or- + is . + + + + + Notifies the registered listeners that the repository has been created. + + The repository that has been created. + + + Raises the event. + + + + + + Gets the repository name and repository type for the specified assembly. + + The assembly that has a . + in/out param to hold the repository name to use for the assembly, caller should set this to the default value before calling. + in/out param to hold the type of the repository to create for the assembly, caller should set this to the default value before calling. + is . + + + + Configures the repository using information from the assembly. + + The assembly containing + attributes which define the configuration for the repository. + The repository to configure. + + is . + -or- + is . + + + + + Loads the attribute defined plugins on the assembly. + + The assembly that contains the attributes. + The repository to add the plugins to. + + is . + -or- + is . + + + + + Loads the attribute defined aliases on the assembly. + + The assembly that contains the attributes. + The repository to alias to. + + is . + -or- + is . + + + + + Event to notify that a logger repository has been created. + + + Event to notify that a logger repository has been created. + + + + Event raised when a new repository is created. + The event source will be this selector. The event args will + be a which + holds the newly created . + + + + + + Defined error codes that can be passed to the method. + + + + Values passed to the method. + + + Nicko Cadell + + + + A general error + + + + + Error while writing output + + + + + Failed to flush file + + + + + Failed to close file + + + + + Unable to open output file + + + + + No layout specified + + + + + Failed to parse address + + + + + Appenders may delegate their error handling to an . + + + + Error handling is a particularly tedious to get right because by + definition errors are hard to predict and to reproduce. + + + Nicko Cadell + Gert Driesen + + + + Handles the error and information about the error condition is passed as + a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + The error code associated with the error. + + + Handles the error and information about the error condition is passed as + a parameter. + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + The that was thrown when the error occurred. + + + See . + + + + + + Prints the error message passed as a parameter. + + The message associated with the error. + + + See . + + + + + + Interface for objects that require fixing. + + + + Interface that indicates that the object requires fixing before it + can be taken outside the context of the appender's + method. + + + When objects that implement this interface are stored + in the context properties maps + and + are fixed + (see ) the + method will be called. + + + Nicko Cadell + + + + Get a portable version of this object + + the portable instance of this object + + + Get a portable instance object that represents the current + state of this object. The portable object can be stored + and logged from any thread with identical results. + + + + + + Interface that all loggers implement + + + + This interface supports logging events and testing if a level + is enabled for logging. + + + These methods will not throw exceptions. Note to implementor, ensure + that the implementation of these methods cannot allow an exception + to be thrown to the caller. + + + Nicko Cadell + Gert Driesen + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + the exception to log, including its stack trace. Pass null to not log an exception. + + + Generates a logging event for the specified using + the and . + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + + + + Gets the name of the logger. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Base interface for all wrappers + + + + Base interface for all wrappers. + + + All wrappers must implement this interface. + + + Nicko Cadell + + + + Get the implementation behind this wrapper object. + + + The object that in implementing this object. + + + + The object that in implementing this + object. The Logger object may not + be the same object as this object because of logger decorators. + This gets the actual underlying objects that is used to process + the log events. + + + + + + Delegate used to handle logger repository creation event notifications + + The which created the repository. + The event args + that holds the instance that has been created. + + + Delegate used to handle logger repository creation event notifications. + + + + + + Provides data for the event. + + + + A + event is raised every time a is created. + + + + + + The created + + + + + Construct instance using specified + + the that has been created + + + Construct instance using specified + + + + + + The that has been created + + + The that has been created + + + + The that has been created + + + + + + Test if an triggers an action + + + + Implementations of this interface allow certain appenders to decide + when to perform an appender specific action. + + + The action or behavior triggered is defined by the implementation. + + + Nicko Cadell + + + + Test if this event triggers the action + + The event to check + true if this event triggers the action, otherwise false + + + Return true if this event triggers the action + + + + + + Defines the default set of levels recognized by the system. + + + + Each has an associated . + + + Levels have a numeric that defines the relative + ordering between levels. Two Levels with the same + are deemed to be equivalent. + + + The levels that are recognized by log4net are set for each + and each repository can have different levels defined. The levels are stored + in the on the repository. Levels are + looked up by name from the . + + + When logging at level INFO the actual level used is not but + the value of LoggerRepository.LevelMap["INFO"]. The default value for this is + , but this can be changed by reconfiguring the level map. + + + Each level has a in addition to its . The + is the string that is written into the output log. By default + the display name is the same as the level name, but this can be used to alias levels + or to localize the log output. + + + Some of the predefined levels recognized by the system are: + + + + . + + + . + + + . + + + . + + + . + + + . + + + . + + + + Nicko Cadell + Gert Driesen + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + The display name for this level. This may be localized or otherwise different from the name + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Constructor + + Integer value for this level, higher values represent more severe levels. + The string name of this level. + + + Initializes a new instance of the class with + the specified level name and value. + + + + + + Returns the representation of the current + . + + + A representation of the current . + + + + Returns the level . + + + + + + Compares levels. + + The object to compare against. + true if the objects are equal. + + + Compares the levels of instances, and + defers to base class if the target object is not a + instance. + + + + + + Returns a hash code + + A hash code for the current . + + + Returns a hash code suitable for use in hashing algorithms and data + structures like a hash table. + + + Returns the hash code of the level . + + + + + + Compares this instance to a specified object and returns an + indication of their relative values. + + A instance or to compare with this instance. + + A 32-bit signed integer that indicates the relative order of the + values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + This instance is less than . + + + Zero + This instance is equal to . + + + Greater than zero + + This instance is greater than . + -or- + is . + + + + + + + must be an instance of + or ; otherwise, an exception is thrown. + + + is not a . + + + + Returns a value indicating whether a specified + is greater than another specified . + + A + A + + true if is greater than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than another specified . + + A + A + + true if is less than + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is greater than or equal to another specified . + + A + A + + true if is greater than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether a specified + is less than or equal to another specified . + + A + A + + true if is less than or equal to + ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have the same value. + + A or . + A or . + + true if the value of is the same as the + value of ; otherwise, false. + + + + Compares two levels. + + + + + + Returns a value indicating whether two specified + objects have different values. + + A or . + A or . + + true if the value of is different from + the value of ; otherwise, false. + + + + Compares two levels. + + + + + + Compares two specified instances. + + The first to compare. + The second to compare. + + A 32-bit signed integer that indicates the relative order of the + two values compared. The return value has these meanings: + + + Value + Meaning + + + Less than zero + is less than . + + + Zero + is equal to . + + + Greater than zero + is greater than . + + + + + + Compares two levels. + + + + + + The level designates a higher level than all the rest. + + + + + The level designates very severe error events. + System unusable, emergencies. + + + + + The level designates very severe error events + that will presumably lead the application to abort. + + + + + The level designates very severe error events. + Take immediate action, alerts. + + + + + The level designates very severe error events. + Critical condition, critical. + + + + + The level designates very severe error events. + + + + + The level designates error events that might + still allow the application to continue running. + + + + + The level designates potentially harmful + situations. + + + + + The level designates informational messages + that highlight the progress of the application at the highest level. + + + + + The level designates informational messages that + highlight the progress of the application at coarse-grained level. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates fine-grained informational + events that are most useful to debug an application. + + + + + The level designates the lowest level possible. + + + + + Gets the name of this level. + + + The name of this level. + + + + Gets the name of this level. + + + + + + Gets the value of this level. + + + The value of this level. + + + + Gets the value of this level. + + + + + + Gets the display name of this level. + + + The display name of this level. + + + + Gets the display name of this level. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a LevelCollection instance. + + list to create a readonly wrapper arround + + A LevelCollection wrapper that is read-only. + + + + + Initializes a new instance of the LevelCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the LevelCollection class + that has the specified initial capacity. + + + The number of elements that the new LevelCollection is initially capable of storing. + + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified LevelCollection. + + The LevelCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the LevelCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + Copies the entire LevelCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire LevelCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the LevelCollection. + + The to be added to the end of the LevelCollection. + The index at which the value has been added. + + + + Removes all elements from the LevelCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the LevelCollection. + + The to check for. + true if is found in the LevelCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the LevelCollection. + + The to locate in the LevelCollection. + + The zero-based index of the first occurrence of + in the entire LevelCollection, if found; otherwise, -1. + + + + + Inserts an element into the LevelCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the LevelCollection. + + The to remove from the LevelCollection. + + The specified was not found in the LevelCollection. + + + + + Removes the element at the specified index of the LevelCollection. + + The zero-based index of the element to remove. + + is less than zero + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the LevelCollection. + + An for the entire LevelCollection. + + + + Adds the elements of another LevelCollection to the current LevelCollection. + + The LevelCollection whose elements should be added to the end of the current LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a array to the current LevelCollection. + + The array whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Adds the elements of a collection to the current LevelCollection. + + The collection whose elements should be added to the end of the LevelCollection. + The new of the LevelCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero + -or- + is equal to or greater than . + + + + + is less than zero + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the LevelCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + The zero-based index of the element to get or set. + + is less than zero + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false + + + + Gets or sets the number of elements the LevelCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + A value + + + + + Supports simple iteration over a . + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + An evaluator that triggers at a threshold level + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + Nicko Cadell + + + + The threshold for triggering + + + + + Create a new evaluator using the threshold. + + + + Create a new evaluator using the threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Create a new evaluator using the specified threshold. + + the threshold to trigger at + + + Create a new evaluator using the specified threshold. + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Is this the triggering event? + + The event to check + This method returns true, if the event level + is equal or higher than the . + Otherwise it returns false + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + the threshold to trigger at + + + The that will cause this evaluator to trigger + + + + This evaluator will trigger if the level of the event + passed to + is equal to or greater than the + level. + + + + + + Mapping between string name and Level object + + + + Mapping between string name and object. + This mapping is held separately for each . + The level name is case insensitive. + + + Nicko Cadell + + + + Mapping from level name to Level object. The + level name is case insensitive + + + + + Construct the level map + + + + Construct the level map. + + + + + + Clear the internal maps of all levels + + + + Clear the internal maps of all levels + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + + + Create a new Level and add it to the map + + + + + + + Create a new Level and add it to the map + + the string to display for the Level + the level value to give to the Level + the display name to give to the Level + + + Create a new Level and add it to the map + + + + + + Add a Level to the map + + the Level to add + + + Add a Level to the map + + + + + + Lookup a named level from the map + + the name of the level to lookup is taken from this level. + If the level is not set on the map then this level is added + the level in the map with the name specified + + + Lookup a named level from the map. The name of the level to lookup is taken + from the property of the + argument. + + + If no level with the specified name is found then the + argument is added to the level map + and returned. + + + + + + Lookup a by name + + The name of the Level to lookup + a Level from the map with the name specified + + + Returns the from the + map with the name specified. If the no level is + found then null is returned. + + + + + + Return all possible levels as a list of Level objects. + + all possible levels as a list of Level objects + + + Return all possible levels as a list of Level objects. + + + + + + The internal representation of caller location information. + + + + This class uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. + + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + Nicko Cadell + Gert Driesen + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + Constructor + + The declaring type of the method that is + the stack boundary into the logging system for this call. + + + Initializes a new instance of the + class based on the current thread. + + + + + + Constructor + + The fully qualified class name. + The method name. + The file name. + The line number of the method within the file. + + + Initializes a new instance of the + class with the specified data. + + + + + + Gets the fully qualified class name of the caller making the logging + request. + + + The fully qualified class name of the caller making the logging + request. + + + + Gets the fully qualified class name of the caller making the logging + request. + + + + + + Gets the file name of the caller. + + + The file name of the caller. + + + + Gets the file name of the caller. + + + + + + Gets the line number of the caller. + + + The line number of the caller. + + + + Gets the line number of the caller. + + + + + + Gets the method name of the caller. + + + The method name of the caller. + + + + Gets the method name of the caller. + + + + + + Gets all available caller information + + + All available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + Gets all available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + + + Static manager that controls the creation of repositories + + + + Static manager that controls the creation of repositories + + + This class is used by the wrapper managers (e.g. ) + to provide access to the objects. + + + This manager also holds the that is used to + lookup and create repositories. The selector can be set either programmatically using + the property, or by setting the log4net.RepositorySelector + AppSetting in the applications config file to the fully qualified type name of the + selector to use. + + + Nicko Cadell + Gert Driesen + + + + Private constructor to prevent instances. Only static methods should be used. + + + + Private constructor to prevent instances. Only static methods should be used. + + + + + + Hook the shutdown event + + + + On the full .NET runtime, the static constructor hooks up the + AppDomain.ProcessExit and AppDomain.DomainUnload> events. + These are used to shutdown the log4net system as the application exits. + + + + + + Register for ProcessExit and DomainUnload events on the AppDomain + + + + This needs to be in a separate method because the events make + a LinkDemand for the ControlAppDomain SecurityPermission. Because + this is a LinkDemand it is demanded at JIT time. Therefore we cannot + catch the exception in the method itself, we have to catch it in the + caller. + + + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + + Return the default instance. + + the repository to lookup in + Return the default instance + + + Gets the for the repository specified + by the argument. + + + + + + Returns the default instance. + + The assembly to use to lookup the repository. + The default instance. + + + Returns the default instance. + + + + + + Returns the named logger if it exists. + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified repository. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns the named logger if it exists. + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger found, or null if the named logger does not exist in the + specified assembly's repository. + + + + If the named logger exists (in the specified assembly's repository) then it + returns a reference to the logger, otherwise it returns + null. + + + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + All the defined loggers. + + + The root logger is not included in the returned array. + + + + + + Retrieves or creates a named logger. + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Retrieves or creates a named logger. + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + + + + Shorthand for . + + The repository to lookup in. + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shorthand for . + + the assembly to use to lookup the repository + The of which the fullname will be used as the name of the logger to retrieve. + The logger with the name specified. + + + Gets the logger for the fully qualified name of the type specified. + + + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The repository to shutdown. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + The assembly to use to lookup the repository. + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository for the repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Resets all values contained in this repository instance to their defaults. + + The repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + The assembly to use to lookup the repository to reset. + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name. + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The name must be unique. Repositories cannot be redefined. + An Exception will be thrown if the repository already exists. + + + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Creates a repository for the specified assembly and repository type. + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + + + + Gets an array of all currently defined repositories. + + An array of all the known objects. + + + Gets an array of all currently defined repositories. + + + + + + Internal method to get pertinent version info. + + A string of version info. + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + Called when the event fires + + the that is exiting + null + + + Called when the event fires. + + + When the event is triggered the log4net system is . + + + + + + Initialize the default repository selector + + + + + Gets or sets the repository selector used by the . + + + The repository selector used by the . + + + + The repository selector () is used by + the to create and select repositories + (). + + + The caller to supplies either a string name + or an assembly (if not supplied the assembly is inferred using + ). + + + This context is used by the selector to lookup a specific repository. + + + For the full .NET Framework, the default repository is DefaultRepositorySelector; + for the .NET Compact Framework CompactRepositorySelector is the default + repository. + + + + + + Implementation of the interface. + + + + This class should be used as the base for all wrapper implementations. + + + Nicko Cadell + Gert Driesen + + + + Constructs a new wrapper for the specified logger. + + The logger to wrap. + + + Constructs a new wrapper for the specified logger. + + + + + + The logger that this object is wrapping + + + + + Gets the implementation behind this wrapper object. + + + The object that this object is implementing. + + + + The Logger object may not be the same object as this object + because of logger decorators. + + + This gets the actual underlying objects that is used to process + the log events. + + + + + + Portable data structure used by + + + + Portable data structure used by + + + Nicko Cadell + + + + The logger name. + + + + The logger name. + + + + + + Level of logging event. + + + + Level of logging event. Level cannot be Serializable + because it is a flyweight. Due to its special serialization it + cannot be declared final either. + + + + + + The application supplied message. + + + + The application supplied message of logging event. + + + + + + The name of thread + + + + The name of thread in which this logging event was generated + + + + + + The time the event was logged + + + + The TimeStamp is stored in the local time zone for this computer. + + + + + + Location information for the caller. + + + + Location information for the caller. + + + + + + String representation of the user + + + + String representation of the user's windows name, + like DOMAIN\username + + + + + + String representation of the identity. + + + + String representation of the current thread's principal identity. + + + + + + The string representation of the exception + + + + The string representation of the exception + + + + + + String representation of the AppDomain. + + + + String representation of the AppDomain. + + + + + + Additional event specific properties + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + + + + Flags passed to the property + + + + Flags passed to the property + + + Nicko Cadell + + + + Fix the MDC + + + + + Fix the NDC + + + + + Fix the rendered message + + + + + Fix the thread name + + + + + Fix the callers location information + + + CAUTION: Very slow to generate + + + + + Fix the callers windows user name + + + CAUTION: Slow to generate + + + + + Fix the domain friendly name + + + + + Fix the callers principal name + + + CAUTION: May be slow to generate + + + + + Fix the exception text + + + + + Fix the event properties + + + + + No fields fixed + + + + + All fields fixed + + + + + Partial fields fixed + + + + This set of partial fields gives good performance. The following fields are fixed: + + + + + + + + + + + + + The internal representation of logging events. + + + + When an affirmative decision is made to log then a + instance is created. This instance + is passed around to the different log4net components. + + + This class is of concern to those wishing to extend log4net. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino + + + + The key into the Properties map for the host name value. + + + + + The key into the Properties map for the thread identity value. + + + + + The key into the Properties map for the user name value. + + + + + Initializes a new instance of the class + from the supplied parameters. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + The name of the logger of this event. + The level of this event. + The message of this event. + The exception for this event. + + + Except , and , + all fields of LoggingEvent are filled when actually needed. Call + to cache all data locally + to prevent inconsistencies. + + This method is called by the log4net framework + to create a logging event. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + The fields in the struct that have already been fixed. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + The parameter should be used to specify which fields in the + struct have been preset. Fields not specified in the + will be captured from the environment if requested or fixed. + + + + + + Initializes a new instance of the class + using specific data. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The repository this event is logged in. + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Initializes a new instance of the class + using specific data. + + Data used to initialize the logging event. + + + This constructor is provided to allow a + to be created independently of the log4net framework. This can + be useful if you require a custom serialization scheme. + + + Use the method to obtain an + instance of the class. + + + This constructor sets this objects flags to , + this assumes that all the data relating to this event is passed in via the + parameter and no other data should be captured from the environment. + + + + + + Serialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Ensure that the repository is set. + + the value for the repository + + + + Write the rendered message to a TextWriter + + the writer to write the message to + + + Unlike the property this method + does store the message data in the internal cache. Therefore + if called only once this method should be faster than the + property, however if the message is + to be accessed multiple times then the property will be more efficient. + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + The data in this event must be fixed before it can be serialized. + + + The method must be called during the + method call if this event + is to be used outside that method. + + + + + + Gets the portable data for this . + + The for this event. + + + A new can be constructed using a + instance. + + + Does a fix of the data + in the logging event before returning the event data. + + + + + + Gets the portable data for this . + + The set of data to ensure is fixed in the LoggingEventData + The for this event. + + + A new can be constructed using a + instance. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Obsolete. Use instead. + + + + + + Returns this event's exception's rendered using the + . + + + This event's exception's rendered using the . + + + + Returns this event's exception's rendered using the + . + + + + + + Fix instance fields that hold volatile data. + + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + incurred by calling but it + is essential to maintaining data consistency. + + + Calling is equivalent to + calling passing the parameter + false. + + + See for more + information. + + + + + + Fixes instance fields that hold volatile data. + + Set to true to not fix data that takes a long time to fix. + + + Some of the values in instances of + are considered volatile, that is the values are correct at the + time the event is delivered to appenders, but will not be consistent + at any time afterwards. If an event is to be stored and then processed + at a later time these volatile values must be fixed by calling + . There is a performance penalty + for incurred by calling but it + is essential to maintaining data consistency. + + + The param controls the data that + is fixed. Some of the data that can be fixed takes a long time to + generate, therefore if you do not require those settings to be fixed + they can be ignored by setting the param + to true. This setting will ignore the + and settings. + + + Set to false to ensure that all + settings are fixed. + + + + + + Fix the fields specified by the parameter + + the fields to fix + + + Only fields specified in the will be fixed. + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Lookup a composite property in this event + + the key for the property to lookup + the value for the property + + + This event has composite properties that combine together properties from + several different contexts in the following order: + + + this events properties + + This event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + + Get all the composite properties in this event + + the containing all the properties + + + See for details of the composite properties + stored by the event. + + + This method returns a single containing all the + properties defined for this event. + + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The internal logging event data. + + + + + The fully qualified Type of the calling + logger class in the stack frame (i.e. the declaring type of the method). + + + + + The application supplied message of logging event. + + + + + The exception that was thrown. + + + This is not serialized. The string representation + is serialized instead. + + + + + The repository that generated the logging event + + + This is not serialized. + + + + + The fix state for this event + + + These flags indicate which fields have been fixed. + Not serialized. + + + + + Indicated that the internal cache is updateable (ie not fixed) + + + This is a seperate flag to m_fixFlags as it allows incrementel fixing and simpler + changes in the caching strategy. + + + + + Gets the time when the current process started. + + + This is the time when this process started. + + + + The TimeStamp is stored in the local time zone for this computer. + + + Tries to get the start time for the current process. + Failing that it returns the time of the first call to + this property. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating and therefore + without the process start time being reset. + + + + + + Gets the of the logging event. + + + The of the logging event. + + + + Gets the of the logging event. + + + + + + Gets the time of the logging event. + + + The time of the logging event. + + + + The TimeStamp is stored in the local time zone for this computer. + + + + + + Gets the name of the logger that logged the event. + + + The name of the logger that logged the event. + + + + Gets the name of the logger that logged the event. + + + + + + Gets the location information for this logging event. + + + The location information for this logging event. + + + + The collected information is cached for future use. + + + See the class for more information on + supported frameworks and the different behavior in Debug and + Release builds. + + + + + + Gets the message object used to initialize this event. + + + The message object used to initialize this event. + + + + Gets the message object used to initialize this event. + Note that this event may not have a valid message object. + If the event is serialized the message object will not + be transferred. To get the text of the message the + property must be used + not this property. + + + If there is no defined message object for this event then + null will be returned. + + + + + + Gets the exception object used to initialize this event. + + + The exception object used to initialize this event. + + + + Gets the exception object used to initialize this event. + Note that this event may not have a valid exception object. + If the event is serialized the exception object will not + be transferred. To get the text of the exception the + method must be used + not this property. + + + If there is no defined exception object for this event then + null will be returned. + + + + + + The that this event was created in. + + + + The that this event was created in. + + + + + + Gets the message, rendered through the . + + + The message rendered through the . + + + + The collected information is cached for future use. + + + + + + Gets the name of the current thread. + + + The name of the current thread, or the thread ID when + the name is not available. + + + + The collected information is cached for future use. + + + + + + Gets the name of the current user. + + + The name of the current user, or NOT AVAILABLE when the + underlying runtime has no support for retrieving the name of the + current user. + + + + Calls WindowsIdentity.GetCurrent().Name to get the name of + the current windows user. + + + To improve performance, we could cache the string representation of + the name, and reuse that as long as the identity stayed constant. + Once the identity changed, we would need to re-assign and re-render + the string. + + + However, the WindowsIdentity.GetCurrent() call seems to + return different objects every time, so the current implementation + doesn't do this type of caching. + + + Timing for these operations: + + + + Method + Results + + + WindowsIdentity.GetCurrent() + 10000 loops, 00:00:00.2031250 seconds + + + WindowsIdentity.GetCurrent().Name + 10000 loops, 00:00:08.0468750 seconds + + + + This means we could speed things up almost 40 times by caching the + value of the WindowsIdentity.GetCurrent().Name property, since + this takes (8.04-0.20) = 7.84375 seconds. + + + + + + Gets the identity of the current thread principal. + + + The string name of the identity of the current thread principal. + + + + Calls System.Threading.Thread.CurrentPrincipal.Identity.Name to get + the name of the current thread principal. + + + + + + Gets the AppDomain friendly name. + + + The AppDomain friendly name. + + + + Gets the AppDomain friendly name. + + + + + + Additional event specific properties. + + + Additional event specific properties. + + + + A logger or an appender may attach additional + properties to specific events. These properties + have a string key and an object value. + + + This property is for events that have been added directly to + this event. The aggregate properties (which include these + event properties) can be retrieved using + and . + + + Once the properties have been fixed this property + returns the combined cached properties. This ensures that updates to + this property are always reflected in the underlying storage. When + returning the combined properties there may be more keys in the + Dictionary than expected. + + + + + + The fixed fields in this event + + + The set of fields that are fixed in this event + + + + Fields will not be fixed if they have previously been fixed. + It is not possible to 'unfix' a field. + + + + + + Implementation of wrapper interface. + + + + This implementation of the interface + forwards to the held by the base class. + + + This logger has methods to allow the caller to log at the following + levels: + + + + DEBUG + + The and methods log messages + at the DEBUG level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + INFO + + The and methods log messages + at the INFO level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + WARN + + The and methods log messages + at the WARN level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + ERROR + + The and methods log messages + at the ERROR level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + FATAL + + The and methods log messages + at the FATAL level. That is the level with that name defined in the + repositories . The default value + for this level is . The + property tests if this level is enabled for logging. + + + + + The values for these levels and their semantic meanings can be changed by + configuring the for the repository. + + + Nicko Cadell + Gert Driesen + + + + The ILog interface is use by application to log messages into + the log4net framework. + + + + Use the to obtain logger instances + that implement this interface. The + static method is used to get logger instances. + + + This class contains methods for logging at different levels and also + has properties for determining if those logging levels are + enabled in the current configuration. + + + This interface can be implemented in different ways. This documentation + specifies reasonable behavior that a caller can expect from the actual + implementation, however different implementations reserve the right to + do things differently. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + Log a message object with the level. + + Log a message object with the level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Logs a message object with the INFO level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Logs a message object with the level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + Log a message object with the level. + + Log a message object with the level. + + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + The message object to log. + + + + + + Log a message object with the level including + the stack trace of the passed + as a parameter. + + The message object to log. + The exception to log, including its stack trace. + + + See the form for more detailed information. + + + + + + + Log a formatted message string with the level. + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Logs a formatted message string with the level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + For some ILog interface log, when you write: + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, string construction and concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed (who isn't), then you should write: + + + if (log.IsDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in and once in + the . This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. This is the preferred style of logging. + + Alternatively if your logger is available statically then the is debug + enabled state can be stored in a static variable like this: + + + private static readonly bool isDebugEnabled = log.IsDebugEnabled; + + + Then when you come to log you can write: + + + if (isDebugEnabled) + { + log.Debug("This is entry number: " + i ); + } + + + This way the debug enabled state is only queried once + when the class is loaded. Using a private static readonly + variable is the most efficient because it is a run time constant + and can be heavily optimized by the JIT compiler. + + + Of course if you use a static readonly variable to + hold the enabled state of the logger then you cannot + change the enabled state at runtime to vary the logging + that is produced. You have to decide if you need absolute + speed or runtime flexibility. + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Checks if this logger is enabled for the level. + + + true if this logger is enabled for events, false otherwise. + + + For more information see . + + + + + + + + Construct a new wrapper for the specified logger. + + The logger to wrap. + + + Construct a new wrapper for the specified logger. + + + + + + Virtual method called when the configuration of the repository changes + + the repository holding the levels + + + Virtual method called when the configuration of the repository changes + + + + + + Logs a message object with the DEBUG level. + + The message object to log. + + + This method first checks if this logger is DEBUG + enabled by comparing the level of this logger with the + DEBUG level. If this logger is + DEBUG enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the DEBUG level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the DEBUG level including + the stack trace of the passed + as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the DEBUG level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + + + This method first checks if this logger is INFO + enabled by comparing the level of this logger with the + INFO level. If this logger is + INFO enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the INFO level. + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the INFO level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the INFO level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the WARN level. + + the message object to log + + + This method first checks if this logger is WARN + enabled by comparing the level of this logger with the + WARN level. If this logger is + WARN enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the WARN level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the WARN level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the WARN level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the ERROR level. + + The message object to log. + + + This method first checks if this logger is ERROR + enabled by comparing the level of this logger with the + ERROR level. If this logger is + ERROR enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the ERROR level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the ERROR level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the ERROR level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a message object with the FATAL level. + + The message object to log. + + + This method first checks if this logger is FATAL + enabled by comparing the level of this logger with the + FATAL level. If this logger is + FATAL enabled, then it converts the message object + (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger and + also higher in the hierarchy depending on the value of the + additivity flag. + + + WARNING Note that passing an to this + method will print the name of the but no + stack trace. To print a stack trace use the + form instead. + + + + + + Logs a message object with the FATAL level + + The message object to log. + The exception to log, including its stack trace. + + + Logs a message object with the FATAL level including + the stack trace of the + passed as a parameter. + + + See the form for more detailed information. + + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + A String containing zero or more format items + An Object to format + An Object to format + An Object to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + The string is formatted using the + format provider. To specify a localized provider use the + method. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Logs a formatted message string with the FATAL level. + + An that supplies culture-specific formatting information + A String containing zero or more format items + An Object array containing zero or more objects to format + + + The message is formatted using the method. See + String.Format for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + + + + + Event handler for the event + + the repository + Empty + + + + The fully qualified name of this declaring type not the type of any subclass. + + + + + Checks if this logger is enabled for the DEBUG + level. + + + true if this logger is enabled for DEBUG events, + false otherwise. + + + + This function is intended to lessen the computational cost of + disabled log debug statements. + + + For some log Logger object, when you write: + + + log.Debug("This is entry number: " + i ); + + + You incur the cost constructing the message, concatenation in + this case, regardless of whether the message is logged or not. + + + If you are worried about speed, then you should write: + + + if (log.IsDebugEnabled()) + { + log.Debug("This is entry number: " + i ); + } + + + This way you will not incur the cost of parameter + construction if debugging is disabled for log. On + the other hand, if the log is debug enabled, you + will incur the cost of evaluating whether the logger is debug + enabled twice. Once in IsDebugEnabled and once in + the Debug. This is an insignificant overhead + since evaluating a logger takes about 1% of the time it + takes to actually log. + + + + + + Checks if this logger is enabled for the INFO level. + + + true if this logger is enabled for INFO events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the WARN level. + + + true if this logger is enabled for WARN events, + false otherwise. + + + + See for more information and examples + of using this method. + + + + + + + Checks if this logger is enabled for the ERROR level. + + + true if this logger is enabled for ERROR events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + Checks if this logger is enabled for the FATAL level. + + + true if this logger is enabled for FATAL events, + false otherwise. + + + + See for more information and examples of using this method. + + + + + + + A SecurityContext used by log4net when interacting with protected resources + + + + A SecurityContext used by log4net when interacting with protected resources + for example with operating system services. This can be used to impersonate + a principal that has been granted privileges on the system resources. + + + Nicko Cadell + + + + Impersonate this SecurityContext + + State supplied by the caller + An instance that will + revoke the impersonation of this SecurityContext, or null + + + Impersonate this security context. Further calls on the current + thread should now be made in the security context provided + by this object. When the result + method is called the security + context of the thread should be reverted to the state it was in + before was called. + + + + + + The providers default instances. + + + + A configured component that interacts with potentially protected system + resources uses a to provide the elevated + privileges required. If the object has + been not been explicitly provided to the component then the component + will request one from this . + + + By default the is + an instance of which returns only + objects. This is a reasonable default + where the privileges required are not know by the system. + + + This default behavior can be overridden by subclassing the + and overriding the method to return + the desired objects. The default provider + can be replaced by programmatically setting the value of the + property. + + + An alternative is to use the log4net.Config.SecurityContextProviderAttribute + This attribute can be applied to an assembly in the same way as the + log4net.Config.XmlConfiguratorAttribute". The attribute takes + the type to use as the as an argument. + + + Nicko Cadell + + + + The default provider + + + + + Protected default constructor to allow subclassing + + + + Protected default constructor to allow subclassing + + + + + + Create a SecurityContext for a consumer + + The consumer requesting the SecurityContext + An impersonation context + + + The default implementation is to return a . + + + Subclasses should override this method to provide their own + behavior. + + + + + + Gets or sets the default SecurityContextProvider + + + The default SecurityContextProvider + + + + The default provider is used by configured components that + require a and have not had one + given to them. + + + By default this is an instance of + that returns objects. + + + The default provider can be set programmatically by setting + the value of this property to a sub class of + that has the desired behavior. + + + + + + Delegate used to handle creation of new wrappers. + + The logger to wrap in a wrapper. + + + Delegate used to handle creation of new wrappers. This delegate + is called from the + method to construct the wrapper for the specified logger. + + + The delegate to use is supplied to the + constructor. + + + + + + Maps between logger objects and wrapper objects. + + + + This class maintains a mapping between objects and + objects. Use the method to + lookup the for the specified . + + + New wrapper instances are created by the + method. The default behavior is for this method to delegate construction + of the wrapper to the delegate supplied + to the constructor. This allows specialization of the behavior without + requiring subclassing of this type. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the + + The handler to use to create the wrapper objects. + + + Initializes a new instance of the class with + the specified handler to create the wrapper objects. + + + + + + Gets the wrapper object for the specified logger. + + The wrapper object for the specified logger + + + If the logger is null then the corresponding wrapper is null. + + + Looks up the wrapper it it has previously been requested and + returns it. If the wrapper has never been requested before then + the virtual method is + called. + + + + + + Creates the wrapper object for the specified logger. + + The logger to wrap in a wrapper. + The wrapper object for the logger. + + + This implementation uses the + passed to the constructor to create the wrapper. This method + can be overridden in a subclass. + + + + + + Called when a monitored repository shutdown event is received. + + The that is shutting down + + + This method is called when a that this + is holding loggers for has signaled its shutdown + event . The default + behavior of this method is to release the references to the loggers + and their wrappers generated for this repository. + + + + + + Event handler for repository shutdown event. + + The sender of the event. + The event args. + + + + Map of logger repositories to hashtables of ILogger to ILoggerWrapper mappings + + + + + The handler to use to create the extension wrapper objects. + + + + + Internal reference to the delegate used to register for repository shutdown events. + + + + + Gets the map of logger repositories. + + + Map of logger repositories. + + + + Gets the hashtable that is keyed on . The + values are hashtables keyed on with the + value being the corresponding . + + + + + + Formats a as "HH:mm:ss,fff". + + + + Formats a in the format "HH:mm:ss,fff" for example, "15:49:37,459". + + + Nicko Cadell + Gert Driesen + + + + Render a as a string. + + + + Interface to abstract the rendering of a + instance into a string. + + + The method is used to render the + date to a text writer. + + + Nicko Cadell + Gert Driesen + + + + Formats the specified date as a string. + + The date to format. + The writer to write to. + + + Format the as a string and write it + to the provided. + + + + + + String constant used to specify AbsoluteTimeDateFormat in layouts. Current value is ABSOLUTE. + + + + + String constant used to specify DateTimeDateFormat in layouts. Current value is DATE. + + + + + String constant used to specify ISO8601DateFormat in layouts. Current value is ISO8601. + + + + + Renders the date into a string. Format is "HH:mm:ss". + + The date to render into a string. + The string builder to write to. + + + Subclasses should override this method to render the date + into a string using a precision up to the second. This method + will be called at most once per second and the result will be + reused if it is needed again during the same second. + + + + + + Renders the date into a string. Format is "HH:mm:ss,fff". + + The date to render into a string. + The writer to write to. + + + Uses the method to generate the + time string up to the seconds and then appends the current + milliseconds. The results from are + cached and is called at most once + per second. + + + Sub classes should override + rather than . + + + + + + Last stored time with precision up to the second. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Last stored time with precision up to the second, formatted + as a string. + + + + + Formats a as "dd MMM yyyy HH:mm:ss,fff" + + + + Formats a in the format + "dd MMM yyyy HH:mm:ss,fff" for example, + "06 Nov 1994 15:49:37,459". + + + Nicko Cadell + Gert Driesen + Angelika Schnagl + + + + Default constructor. + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats a DateTime in the format "dd MMM yyyy HH:mm:ss" + for example, "06 Nov 1994 15:49:37". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + The format info for the invariant culture. + + + + + Formats the as "yyyy-MM-dd HH:mm:ss,fff". + + + + Formats the specified as a string: "yyyy-MM-dd HH:mm:ss,fff". + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Formats the date without the milliseconds part + + The date to format. + The string builder to write to. + + + Formats the date specified as a string: "yyyy-MM-dd HH:mm:ss". + + + The base class will append the ",fff" milliseconds section. + This method will only be called at most once per second. + + + + + + Formats the using the method. + + + + Formats the using the method. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The format string. + + + Initializes a new instance of the class + with the specified format string. + + + The format string must be compatible with the options + that can be supplied to . + + + + + + Formats the date using . + + The date to convert to a string. + The writer to write to. + + + Uses the date format string supplied to the constructor to call + the method to format the date. + + + + + + The format string used to format the . + + + + The format string must be compatible with the options + that can be supplied to . + + + + + + This filter drops all . + + + + You can add this filter to the end of a filter chain to + switch from the default "accept all unless instructed otherwise" + filtering behavior to a "deny all unless instructed otherwise" + behavior. + + + Nicko Cadell + Gert Driesen + + + + Subclass this type to implement customized logging event filtering + + + + Users should extend this class to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface to provide customized logging event filtering + + + + Users should implement this interface to implement customized logging + event filtering. Note that and + , the parent class of all standard + appenders, have built-in filtering rules. It is suggested that you + first use and understand the built-in rules before rushing to write + your own custom filters. + + + This abstract class assumes and also imposes that filters be + organized in a linear chain. The + method of each filter is called sequentially, in the order of their + addition to the chain. + + + The method must return one + of the integer constants , + or . + + + If the value is returned, then the log event is dropped + immediately without consulting with the remaining filters. + + + If the value is returned, then the next filter + in the chain is consulted. If there are no more filters in the + chain, then the log event is logged. Thus, in the presence of no + filters, the default behavior is to log all logging events. + + + If the value is returned, then the log + event is logged without consulting the remaining filters. + + + The philosophy of log4net filters is largely inspired from the + Linux ipchains. + + + Nicko Cadell + Gert Driesen + + + + Decide if the logging event should be logged through an appender. + + The LoggingEvent to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Points to the next filter in the filter chain. + + + + See for more information. + + + + + + Initialize the filter with the options set + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Typically filter's options become active immediately on set, + however this method must still be called. + + + + + + Decide if the should be logged through an appender. + + The to decide upon + The decision of the filter + + + If the decision is , then the event will be + dropped. If the decision is , then the next + filter, if any, will be invoked. If the decision is then + the event will be logged without consulting with other filters in + the chain. + + + This method is marked abstract and must be implemented + in a subclass. + + + + + + Property to get and set the next filter + + + The next filter in the chain + + + + Filters are typically composed into chains. This property allows the next filter in + the chain to be accessed. + + + + + + Default constructor + + + + + Always returns the integer constant + + the LoggingEvent to filter + Always returns + + + Ignores the event being logged and just returns + . This can be used to change the default filter + chain behavior from to . This filter + should only be used as the last filter in the chain + as any further filters will be ignored! + + + + + + The return result from + + + + The return result from + + + + + + The log event must be dropped immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This filter is neutral with respect to the log event. + The remaining filters, if any, should be consulted for a final decision. + + + + + The log event must be logged immediately without + consulting with the remaining filters, if any, in the chain. + + + + + This is a very simple filter based on matching. + + + + The filter admits two options and + . If there is an exact match between the value + of the option and the of the + , then the method returns in + case the option value is set + to true, if it is false then + is returned. If the does not match then + the result will be . + + + Nicko Cadell + Gert Driesen + + + + flag to indicate if the filter should on a match + + + + + the to match against + + + + + Default constructor + + + + + Tests if the of the logging event matches that of the filter + + the event to filter + see remarks + + + If the of the event matches the level of the + filter then the result of the function depends on the + value of . If it is true then + the function will return , it it is false then it + will return . If the does not match then + the result will be . + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + The level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + This is a simple filter based on matching. + + + + The filter admits three options and + that determine the range of priorities that are matched, and + . If there is a match between the range + of priorities and the of the , then the + method returns in case the + option value is set to true, if it is false + then is returned. If there is no match, is returned. + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when matching a + + + + + the minimum value to match + + + + + the maximum value to match + + + + + Default constructor + + + + + Check if the event should be logged. + + the logging event to check + see remarks + + + If the of the logging event is outside the range + matched by this filter then + is returned. If the is matched then the value of + is checked. If it is true then + is returned, otherwise + is returned. + + + + + + when matching and + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Set the minimum matched + + + + The minimum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Sets the maximum matched + + + + The maximum level that this filter will attempt to match against the + level. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a string in the event's logger name. + + + + The works very similar to the . It admits two + options and . If the + of the starts + with the value of the option, then the + method returns in + case the option value is set to true, + if it is false then is returned. + + + Daniel Cazzulino + + + + Flag to indicate the behavior when we have a match + + + + + The logger name string to substring match against the event + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the equals the beginning of + the incoming () + then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + The that the filter will match + + + + This filter will attempt to match this value against logger name in + the following way. The match will be done against the beginning of the + logger name (using ). The match is + case sensitive. If a match is found then + the result depends on the value of . + + + + + + Simple filter to match a keyed string in the + + + + Simple filter to match a keyed string in the + + + As the MDC has been replaced with layered properties the + should be used instead. + + + Nicko Cadell + Gert Driesen + + + + Simple filter to match a string an event property + + + + Simple filter to match a string in the value for a + specific event property + + + Nicko Cadell + + + + Simple filter to match a string in the rendered message + + + + Simple filter to match a string in the rendered message + + + Nicko Cadell + Gert Driesen + + + + Flag to indicate the behavior when we have a match + + + + + The string to substring match against the message + + + + + A string regex to match + + + + + A regex object to match (generated from m_stringRegexToMatch) + + + + + Default constructor + + + + + Initialize and precompile the Regex if required + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The rendered message is matched against the . + If the occurs as a substring within + the message then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + when matching or + + + + The property is a flag that determines + the behavior when a matching is found. If the + flag is set to true then the filter will the + logging event, otherwise it will the event. + + + The default is true i.e. to the event. + + + + + + Sets the static string to match + + + + The string that will be substring matched against + the rendered message. If the message contains this + string then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + Sets the regular expression to match + + + + The regular expression pattern that will be matched against + the rendered message. If the message matches this + pattern then the filter will match. If a match is found then + the result depends on the value of . + + + One of or + must be specified. + + + + + + The key to use to lookup the string from the event properties + + + + + Default constructor + + + + + Check if this filter should allow the event to be logged + + the event being logged + see remarks + + + The event property for the is matched against + the . + If the occurs as a substring within + the property value then a match will have occurred. If no match occurs + this function will return + allowing other filters to check the event. If a match occurs then + the value of is checked. If it is + true then is returned otherwise + is returned. + + + + + + The key to lookup in the event properties and then match against. + + + + The key name to use to lookup in the properties map of the + . The match will be performed against + the value of this property if it exists. + + + + + + Simple filter to match a string in the + + + + Simple filter to match a string in the + + + As the MDC has been replaced with named stacks stored in the + properties collections the should + be used instead. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Sets the to "NDC". + + + + + + Write the event appdomain name to the output + + + + Writes the to the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + Nicko Cadell + + + + Abstract class that provides the formatting functionality that + derived classes need. + + + + Conversion specifiers in a conversion patterns are parsed to + individual PatternConverters. Each of which is responsible for + converting a logging event in a converter specific manner. + + + Nicko Cadell + Gert Driesen + + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + + + + Protected constructor + + + + Initializes a new instance of the class. + + + + + + Evaluate this pattern converter and write the output to a writer. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the appropriate way. + + + + + + Set the next pattern converter in the chains + + the pattern converter that should follow this converter in the chain + the next converter + + + The PatternConverter can merge with its neighbor during this method (or a sub class). + Therefore the return value may or may not be the value of the argument passed in. + + + + + + Write the pattern converter to the writer with appropriate formatting + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + This method calls to allow the subclass to perform + appropriate conversion of the pattern converter. If formatting options have + been specified via the then this method will + apply those formattings before writing the output. + + + + + + Fast space padding method. + + to which the spaces will be appended. + The number of spaces to be padded. + + + Fast space padding method. + + + + + + The option string to the converter + + + + + Write an dictionary to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the to a writer in the form: + + + {key1=value1, key2=value2, key3=value3} + + + If the specified + is not null then it is used to render the key and value to text, otherwise + the object's ToString method is called. + + + + + + Write an object to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the Object to a writer. If the specified + is not null then it is used to render the object to text, otherwise + the object's ToString method is called. + + + + + + Get the next pattern converter in the chain + + + the next pattern converter in the chain + + + + Get the next pattern converter in the chain + + + + + + Gets or sets the formatting info for this converter + + + The formatting info for this converter + + + + Gets or sets the formatting info for this converter + + + + + + Gets or sets the option value for this converter + + + The option for this converter + + + + Gets or sets the option value for this converter + + + + + + Initializes a new instance of the class. + + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The on which the pattern converter should be executed. + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The state object on which the pattern converter should be executed. + + + + Flag indicating if this converter handles exceptions + + + false if this converter handles exceptions + + + + + Flag indicating if this converter handles the logging event exception + + false if this converter handles the logging event exception + + + If this converter handles the exception object contained within + , then this property should be set to + false. Otherwise, if the layout ignores the exception + object, then the property should be set to true. + + + Set this value to override a this default setting. The default + value is true, this converter does not handle the exception. + + + + + + Write the event appdomain name to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output . + + + + + + Date pattern converter, uses a to format + the date of a . + + + + Render the to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,yyyy" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter pattern based on the property. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Convert the pattern into the rendered message + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone. + + + + + + Write the exception text to the output + + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + Nicko Cadell + + + + Default constructor + + + + + Write the exception text to the output + + that will receive the formatted result. + the event being logged + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + + + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + + + + Writes the caller location file name to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location file name to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Write the caller location info to the output + + + + Writes the to the output writer. + + + Nicko Cadell + + + + Write the caller location info to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output writer. + + + + + + Writes the event identity to the output + + + + Writes the value of the to + the output writer. + + + Daniel Cazzulino + Nicko Cadell + + + + Writes the event identity to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the + to + the output . + + + + + + Write the event level to the output + + + + Writes the display name of the event + to the writer. + + + Nicko Cadell + + + + Write the event level to the output + + that will receive the formatted result. + the event being logged + + + Writes the of the + to the . + + + + + + Write the caller location line number to the output + + + + Writes the value of the for + the event to the output writer. + + + Nicko Cadell + + + + Write the caller location line number to the output + + that will receive the formatted result. + the event being logged + + + Writes the value of the for + the to the output . + + + + + + Converter for logger name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Converter to output and truncate '.' separated strings + + + + This abstract class supports truncating a '.' separated string + to show a specified number of elements from the right hand side. + This is used to truncate class names that are fully qualified. + + + Subclasses should override the method to + return the fully qualified string. + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Get the fully qualified string data + + the event being logged + the fully qualified name + + + Overridden by subclasses to get the fully qualified name before the + precision is applied to it. + + + Return the fully qualified '.' (dot/period) separated string. + + + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + Render the to the precision + specified by the property. + + + + + Gets the fully qualified name of the logger + + the event being logged + The fully qualified logger name + + + Returns the of the . + + + + + + Writes the event message to the output + + + + Uses the method + to write out the event message. + + + Nicko Cadell + + + + Writes the event message to the output + + that will receive the formatted result. + the event being logged + + + Uses the method + to write out the event message. + + + + + + Write the method name to the output + + + + Writes the caller location to + the output. + + + Nicko Cadell + + + + Write the method name to the output + + that will receive the formatted result. + the event being logged + + + Writes the caller location to + the output. + + + + + + Converter to include event NDC + + + + Outputs the value of the event property named NDC. + + + The should be used instead. + + + Nicko Cadell + + + + Write the event NDC to the output + + that will receive the formatted result. + the event being logged + + + As the thread context stacks are now stored in named event properties + this converter simply looks up the value of the NDC property. + + + The should be used instead. + + + + + + Property pattern converter + + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + the event being logged + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + Converter to output the relative time of the event + + + + Converter to output the time of the event relative to the start of the program. + + + Nicko Cadell + + + + Write the relative time to the output + + that will receive the formatted result. + the event being logged + + + Writes out the relative time of the event in milliseconds. + That is the number of milliseconds between the event + and the . + + + + + + Helper method to get the time difference between two DateTime objects + + start time (in the current local time zone) + end time (in the current local time zone) + the time difference in milliseconds + + + + Converter to include event thread name + + + + Writes the to the output. + + + Nicko Cadell + + + + Write the ThreadName to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the . + + + + + + Pattern converter for the class name + + + + Outputs the of the event. + + + Nicko Cadell + + + + Gets the fully qualified name of the class + + the event being logged + The fully qualified type name for the caller location + + + Returns the of the . + + + + + + Converter to include event user name + + Douglas de la Torre + Nicko Cadell + + + + Convert the pattern to the rendered message + + that will receive the formatted result. + the event being logged + + + + Write the TimeStamp to the output + + + + Date pattern converter, uses a to format + the date of a . + + + Uses a to format the + in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the TimeStamp to the output + + that will receive the formatted result. + the event being logged + + + Pass the to the + for it to render it to the writer. + + + The passed is in the local time zone, this is converted + to Universal time before it is rendered. + + + + + + + A Layout that renders only the Exception text from the logging event + + + + A Layout that renders only the Exception text from the logging event. + + + This Layout should only be used with appenders that utilize multiple + layouts (e.g. ). + + + Nicko Cadell + Gert Driesen + + + + Extend this abstract class to create your own log layout format. + + + + This is the base implementation of the + interface. Most layout objects should extend this class. + + + + + + Subclasses must implement the + method. + + + Subclasses should set the in their default + constructor. + + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by layout objects + + + + An object is used to format a + as text. The method is called by an + appender to transform the into a string. + + + The layout can also supply and + text that is appender before any events and after all the events respectively. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text and output to a writer. + + + If the caller does not have a and prefers the + event to be formatted as a then the following + code can be used to format the event into a . + + + StringWriter writer = new StringWriter(); + Layout.Format(writer, loggingEvent); + string formattedEvent = writer.ToString(); + + + + + + The content type output by this layout. + + The content type + + + The content type output by this layout. + + + This is a MIME type e.g. "text/plain". + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handle exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + + + + The header text + + + + See for more information. + + + + + + The footer text + + + + See for more information. + + + + + + Flag indicating if this layout handles exceptions + + + + false if this layout handles exceptions + + + + + + Empty default constructor + + + + Empty default constructor + + + + + + Activate component options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + This method must be implemented by the subclass. + + + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text. + + + + + + The content type output by this layout. + + The content type is "text/plain" + + + The content type output by this layout. + + + This base class uses the value "text/plain". + To change this value a subclass must override this + property. + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handles exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + Set this value to override a this default setting. The default + value is true, this layout does not handle the exception. + + + + + + Default constructor + + + + Constructs a ExceptionLayout + + + + + + Activate component options + + + + Part of the component activation + framework. + + + This method does nothing as options become effective immediately. + + + + + + Gets the exception text from the logging event + + The TextWriter to write the formatted event to + the event being logged + + + Write the exception string to the . + The exception string is retrieved from . + + + + + + Interface for raw layout objects + + + + Interface used to format a + to an object. + + + This interface should not be confused with the + interface. This interface is used in + only certain specialized situations where a raw object is + required rather than a formatted string. The + is not generally useful than this interface. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The event to format + returns the formatted event + + + Implement this method to create your own layout format. + + + + + + Adapts any to a + + + + Where an is required this adapter + allows a to be specified. + + + Nicko Cadell + Gert Driesen + + + + The layout to adapt + + + + + Construct a new adapter + + the layout to adapt + + + Create the adapter for the specified . + + + + + + Format the logging event as an object. + + The event to format + returns the formatted event + + + Format the logging event as an object. + + + Uses the object supplied to + the constructor to perform the formatting. + + + + + + A flexible layout configurable with pattern string. + + + + The goal of this class is to a + as a string. The results + depend on the conversion pattern. + + + The conversion pattern is closely related to the conversion + pattern of the printf function in C. A conversion pattern is + composed of literal text and format control expressions called + conversion specifiers. + + + You are free to insert any literal text within the conversion + pattern. + + + Each conversion specifier starts with a percent sign (%) and is + followed by optional format modifiers and a conversion + pattern name. The conversion pattern name specifies the type of + data, e.g. logger, level, date, thread name. The format + modifiers control such things as field width, padding, left and + right justification. The following is a simple example. + + + Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume + that the log4net environment was set to use a PatternLayout. Then the + statements + + + ILog log = LogManager.GetLogger(typeof(TestApp)); + log.Debug("Message 1"); + log.Warn("Message 2"); + + would yield the output + + DEBUG [main]: Message 1 + WARN [main]: Message 2 + + + Note that there is no explicit separator between text and + conversion specifiers. The pattern parser knows when it has reached + the end of a conversion specifier when it reads a conversion + character. In the example above the conversion specifier + %-5level means the level of the logging event should be left + justified to a width of five characters. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + a + Equivalent to appdomain + + + appdomain + + Used to output the friendly name of the AppDomain where the + logging event was generated. + + + + c + Equivalent to logger + + + C + Equivalent to type + + + class + Equivalent to type + + + d + Equivalent to date + + + date + + + Used to output the date of the logging event in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + exception + + + Used to output the exception passed in with the log message. + + + If an exception object is stored in the logging event + it will be rendered into the pattern output with a + trailing newline. + If there is no exception then nothing will be output + and no trailing newline will be appended. + It is typical to put a newline before the exception + and to have the exception as the last data in the pattern. + + + + + F + Equivalent to file + + + file + + + Used to output the file name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + WARNING Generating caller information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + l + Equivalent to location + + + L + Equivalent to line + + + location + + + Used to output location information of the caller which generated + the logging event. + + + The location information depends on the CLI implementation but + usually consists of the fully qualified name of the calling + method followed by the callers source the file name and line + number between parentheses. + + + The location information can be very useful. However, its + generation is extremely slow. Its use should be avoided + unless execution speed is not an issue. + + + See the note below on the availability of caller location information. + + + + + level + + + Used to output the level of the logging event. + + + + + line + + + Used to output the line number from where the logging request + was issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + logger + + + Used to output the logger of the logging event. The + logger conversion specifier can be optionally followed by + precision specifier, that is a decimal constant in + brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the logger name will be + printed. By default the logger name is printed in full. + + + For example, for the logger name "a.b.c" the pattern + %logger{2} will output "b.c". + + + + + m + Equivalent to message + + + M + Equivalent to method + + + message + + + Used to output the application supplied message associated with + the logging event. + + + + + mdc + + + The MDC (old name for the ThreadContext.Properties) is now part of the + combined event properties. This pattern is supported for compatibility + but is equivalent to property. + + + + + method + + + Used to output the method name where the logging request was + issued. + + + WARNING Generating caller location information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + See the note below on the availability of caller location information. + + + + + n + Equivalent to newline + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + ndc + + + Used to output the NDC (nested diagnostic context) associated + with the thread that generated the logging event. + + + + + p + Equivalent to level + + + P + Equivalent to property + + + properties + Equivalent to property + + + property + + + Used to output the an event specific property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are added to events by loggers or appenders. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the event properties + + The event has that can be set. These + properties are specific to this event only. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + + r + Equivalent to timestamp + + + t + Equivalent to thread + + + timestamp + + + Used to output the number of milliseconds elapsed since the start + of the application until the creation of the logging event. + + + + + thread + + + Used to output the name of the thread that generated the + logging event. Uses the thread number if no name is available. + + + + + type + + + Used to output the fully qualified type name of the caller + issuing the logging request. This conversion specifier + can be optionally followed by precision specifier, that + is a decimal constant in brackets. + + + If a precision specifier is given, then only the corresponding + number of right most components of the class name will be + printed. By default the class name is output in fully qualified form. + + + For example, for the class name "log4net.Layout.PatternLayout", the + pattern %type{1} will output "PatternLayout". + + + WARNING Generating the caller class information is + slow. Thus, its use should be avoided unless execution speed is + not an issue. + + + See the note below on the availability of caller location information. + + + + + u + Equivalent to identity + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + WARNING Generating caller WindowsIdentity information is + extremely slow. Its use should be avoided unless execution speed + is not an issue. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + w + Equivalent to username + + + x + Equivalent to ndc + + + X + Equivalent to mdc + + + % + + + The sequence %% outputs a single percent sign. + + + + + + The single letter patterns are deprecated in favor of the + longer more descriptive pattern names. + + + By default the relevant information is output as is. However, + with the aid of format modifiers it is possible to change the + minimum field width, the maximum field width and justification. + + + The optional format modifier is placed between the percent sign + and the conversion pattern name. + + + The first optional format modifier is the left justification + flag which is just the minus (-) character. Then comes the + optional minimum field width modifier. This is a decimal + constant that represents the minimum number of characters to + output. If the data item requires fewer characters, it is padded on + either the left or the right until the minimum width is + reached. The default is to pad on the left (right justify) but you + can specify right padding with the left justification flag. The + padding character is space. If the data item is larger than the + minimum field width, the field is expanded to accommodate the + data. The value is never truncated. + + + This behavior can be changed using the maximum field + width modifier which is designated by a period followed by a + decimal constant. If the data item is longer than the maximum + field, then the extra characters are removed from the + beginning of the data item and not from the end. For + example, it the maximum field width is eight and the data item is + ten characters long, then the first two characters of the data item + are dropped. This behavior deviates from the printf function in C + where truncation is done from the end. + + + Below are various format modifier examples for the logger + conversion specifier. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none + + Left pad with spaces if the logger name is less than 20 + characters long. + +
%-20loggertrue20none + + Right pad with spaces if the logger + name is less than 20 characters long. + +
%.30loggerNAnone30 + + Truncate from the beginning if the logger + name is longer than 30 characters. + +
%20.30loggerfalse2030 + + Left pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
%-20.30loggertrue2030 + + Right pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
+
+ + Note about caller location information.
+ The following patterns %type %file %line %method %location %class %C %F %L %l %M + all generate caller location information. + Location information uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. +
+ + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + + Additional pattern converters may be registered with a specific + instance using the method. + +
+ + This is a more detailed pattern. + %timestamp [%thread] %level %logger %ndc - %message%newline + + + A similar pattern except that the relative time is + right padded if less than 6 digits, thread name is right padded if + less than 15 characters and truncated if longer and the logger + name is left padded if shorter than 30 characters and truncated if + longer. + %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino +
+ + + Default pattern string for log output. + + + + Default pattern string for log output. + Currently set to the string "%message%newline" + which just prints the application supplied message. + + + + + + A detailed conversion pattern + + + + A conversion pattern which includes Time, Thread, Logger, and Nested Context. + Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. + + + + + + Internal map of converter identifiers to converter types. + + + + This static map is overridden by the m_converterRegistry instance map + + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternLayout only + + + + + Initialize the global registry + + + + Defines the builtin global rules. + + + + + + Constructs a PatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + As per the contract the + method must be called after the properties on this object have been + configured. + + + + + + Constructs a PatternLayout using the supplied conversion pattern + + the pattern to use + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + When using this constructor the method + need not be called. This may not be the case when using a subclass. + + + + + + Create the pattern parser instance + + the pattern to parse + The that will format the event + + + Creates the used to parse the conversion string. Sets the + global and instance rules on the . + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string as specified by the conversion pattern. + + the event being logged + The TextWriter to write the formatted event to + + + Parse the using the patter format + specified in the property. + + + + + + Add a converter to this PatternLayout + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternLayout + + the name of the conversion pattern for this converter + the type of the converter + + + Add a named pattern converter to this instance. This + converter will be used in the formatting of the event. + This method must be called before . + + + The specified must extend the + type. + + + + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + Wrapper class used to map converter names to converter types + + + + Pattern converter info class used during configuration to + pass to the + method. + + + + + + default constructor + + + + + Gets or sets the name of the conversion pattern + + + + The name of the pattern in the format string + + + + + + Gets or sets the type of the converter + + + + The value specified must extend the + type. + + + + + + Type converter for the interface + + + + Used to convert objects to the interface. + Supports converting from the interface to + the interface using the . + + + Nicko Cadell + Gert Driesen + + + + Interface supported by type converters + + + + This interface supports conversion from arbitrary types + to a single target type. See . + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Test if the can be converted to the + type supported by this converter. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Converts the to the type supported + by this converter. + + + + + + Can the sourceType be converted to an + + the source to be to be converted + true if the source type can be converted to + + + Test if the can be converted to a + . Only is supported + as the . + + + + + + Convert the value to a object + + the value to convert + the object + + + Convert the object to a + object. If the object + is a then the + is used to adapt between the two interfaces, otherwise an + exception is thrown. + + + + + + Extract the value of a property from the + + + + Extract the value of a property from the + + + Nicko Cadell + + + + Constructs a RawPropertyLayout + + + + + Lookup the property for + + The event to format + returns property value + + + Looks up and returns the object value of the property + named . If there is no property defined + with than name then null will be returned. + + + + + + The name of the value to lookup in the LoggingEvent Properties collection. + + + Value to lookup in the LoggingEvent Properties collection + + + + String name of the property to lookup in the . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in local time. To format the time stamp + in universal time use . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawUtcTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in universal time. To format the time stamp + in local time use . + + + + + + A very simple layout + + + + SimpleLayout consists of the level of the log statement, + followed by " - " and then the log message itself. For example, + + DEBUG - Hello world + + + + Nicko Cadell + Gert Driesen + + + + Constructs a SimpleLayout + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a simple formatted output. + + the event being logged + The TextWriter to write the formatted event to + + + Formats the event as the level of the even, + followed by " - " and then the log message itself. The + output is terminated by a newline. + + + + + + Layout that formats the log events as XML elements. + + + + The output of the consists of a series of + log4net:event elements. It does not output a complete well-formed XML + file. The output is designed to be included as an external entity + in a separate file to form a correct XML file. + + + For example, if abc is the name of the file where + the output goes, then a well-formed XML file would + be: + + + <?xml version="1.0" ?> + + <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> + + <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> + &data; + </log4net:events> + + + This approach enforces the independence of the + and the appender where it is embedded. + + + The version attribute helps components to correctly + interpret output generated by . The value of + this attribute should be "1.2" for release 1.2 and later. + + + Alternatively the Header and Footer properties can be + configured to output the correct XML header, open tag and close tag. + When setting the Header and Footer properties it is essential + that the underlying data store not be appendable otherwise the data + will become invalid XML. + + + Nicko Cadell + Gert Driesen + + + + Layout that formats the log events as XML elements. + + + + This is an abstract class that must be subclassed by an implementation + to conform to a specific schema. + + + Deriving classes must implement the method. + + + Nicko Cadell + Gert Driesen + + + + Protected constructor to support subclasses + + + + Initializes a new instance of the class + with no location info. + + + + + + Protected constructor to support subclasses + + + + The parameter determines whether + location information will be output by the layout. If + is set to true, then the + file name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Produces a formatted string. + + The event being logged. + The TextWriter to write the formatted event to + + + Format the and write it to the . + + + This method creates an that writes to the + . The is passed + to the method. Subclasses should override the + method rather than this method. + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Subclasses should override this method to format + the as XML. + + + + + + Flag to indicate if location information should be included in + the XML events. + + + + + Writer adapter that ignores Close + + + + + The string to replace invalid chars with + + + + + Gets a value indicating whether to include location information in + the XML events. + + + true if location information should be included in the XML + events; otherwise, false. + + + + If is set to true, then the file + name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + The string to replace characters that can not be expressed in XML with. + + + Not all characters may be expressed in XML. This property contains the + string to replace those that can not with. This defaults to a ?. Set it + to the empty string to simply remove offending characters. For more + details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets + Character replacement will occur in the log message, the property names + and the property values. + + + + + + + Gets the content type output by this layout. + + + As this is the XML layout, the value is always "text/xml". + + + + As this is the XML layout, the value is always "text/xml". + + + + + + Constructs an XmlLayout + + + + + Constructs an XmlLayout. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SmtpAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + Builds a cache of the element names + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Override the base class method + to write the to the . + + + + + + The prefix to use for all generated element names + + + + + The prefix to use for all element names + + + + The default prefix is log4net. Set this property + to change the prefix. If the prefix is set to an empty string + then no prefix will be written. + + + + + + Set whether or not to base64 encode the message. + + + + By default the log message will be written as text to the xml + output. This can cause problems when the message contains binary + data. By setting this to true the contents of the message will be + base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the log message. + + + + + + Set whether or not to base64 encode the property values. + + + + By default the properties will be written as text to the xml + output. This can cause problems when one or more properties contain + binary data. By setting this to true the values of the properties + will be base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the property values. + + + + + + Layout that formats the log events as XML elements compatible with the log4j schema + + + + Formats the log events according to the http://logging.apache.org/log4j schema. + + + Nicko Cadell + + + + The 1st of January 1970 in UTC + + + + + Constructs an XMLLayoutSchemaLog4j + + + + + Constructs an XMLLayoutSchemaLog4j. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Actually do the writing of the xml + + the writer to use + the event to write + + + Generate XML that is compatible with the log4j schema. + + + + + + The version of the log4j schema to use. + + + + Only version 1.2 of the log4j schema is supported. + + + + + + The default object Renderer. + + + + The default renderer supports rendering objects and collections to strings. + + + See the method for details of the output. + + + Nicko Cadell + Gert Driesen + + + + Implement this interface in order to render objects as strings + + + + Certain types require special case conversion to + string form. This conversion is done by an object renderer. + Object renderers implement the + interface. + + + Nicko Cadell + Gert Driesen + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a + string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + + + + Default constructor + + + + Default constructor + + + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + The default renderer supports rendering objects to strings as follows: + + + + Value + Rendered String + + + null + + "(null)" + + + + + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + , & + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: {a, b, c}. + + + All collection classes that implement its subclasses, + or generic equivalents all implement the interface. + + + + + + + + Rendered as the key, an equals sign ('='), and the value (using the appropriate + renderer). + + + For example: key=value. + + + + + other + + Object.ToString() + + + + + + + + Render the array argument into a string + + The map used to lookup renderers + the array to render + The writer to render to + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + + Render the enumerator argument into a string + + The map used to lookup renderers + the enumerator to render + The writer to render to + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + {a, b, c}. + + + + + + Render the DictionaryEntry argument into a string + + The map used to lookup renderers + the DictionaryEntry to render + The writer to render to + + + Render the key, an equals sign ('='), and the value (using the appropriate + renderer). For example: key=value. + + + + + + Map class objects to an . + + + + Maintains a mapping between types that require special + rendering and the that + is used to render them. + + + The method is used to render an + object using the appropriate renderers defined in this map. + + + Nicko Cadell + Gert Driesen + + + + Default Constructor + + + + Default constructor. + + + + + + Render using the appropriate renderer. + + the object to render to a string + the object rendered as a string + + + This is a convenience method used to render an object to a string. + The alternative method + should be used when streaming output to a . + + + + + + Render using the appropriate renderer. + + the object to render to a string + The writer to render to + + + Find the appropriate renderer for the type of the + parameter. This is accomplished by calling the + method. Once a renderer is found, it is + applied on the object and the result is returned + as a . + + + + + + Gets the renderer for the specified object type + + the object to lookup the renderer for + the renderer for + + + Gets the renderer for the specified object type. + + + Syntactic sugar method that calls + with the type of the object parameter. + + + + + + Gets the renderer for the specified type + + the type to lookup the renderer for + the renderer for the specified type + + + Returns the renderer for the specified type. + If no specific renderer has been defined the + will be returned. + + + + + + Internal function to recursively search interfaces + + the type to lookup the renderer for + the renderer for the specified type + + + + Clear the map of renderers + + + + Clear the custom renderers defined by using + . The + cannot be removed. + + + + + + Register an for . + + the type that will be rendered by + the renderer for + + + Register an object renderer for a specific source type. + This renderer will be returned from a call to + specifying the same as an argument. + + + + + + Get the default renderer instance + + the default renderer + + + Get the default renderer + + + + + + Interface implemented by logger repository plugins. + + + + Plugins define additional behavior that can be associated + with a . + The held by the + property is used to store the plugins for a repository. + + + The log4net.Config.PluginAttribute can be used to + attach plugins to repositories created using configuration + attributes. + + + Nicko Cadell + Gert Driesen + + + + Attaches the plugin to the specified . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + Gets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + + + + A strongly-typed collection of objects. + + Nicko Cadell + + + + Creates a read-only wrapper for a PluginCollection instance. + + list to create a readonly wrapper arround + + A PluginCollection wrapper that is read-only. + + + + + Initializes a new instance of the PluginCollection class + that is empty and has the default initial capacity. + + + + + Initializes a new instance of the PluginCollection class + that has the specified initial capacity. + + + The number of elements that the new PluginCollection is initially capable of storing. + + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified PluginCollection. + + The PluginCollection whose elements are copied to the new collection. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified array. + + The array whose elements are copied to the new list. + + + + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified collection. + + The collection whose elements are copied to the new list. + + + + Allow subclasses to avoid our default constructors + + + + + + + Copies the entire PluginCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire PluginCollection to a one-dimensional + array, starting at the specified index of the target array. + + The one-dimensional array to copy to. + The zero-based index in at which copying begins. + + + + Adds a to the end of the PluginCollection. + + The to be added to the end of the PluginCollection. + The index at which the value has been added. + + + + Removes all elements from the PluginCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the PluginCollection. + + The to check for. + true if is found in the PluginCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the PluginCollection. + + The to locate in the PluginCollection. + + The zero-based index of the first occurrence of + in the entire PluginCollection, if found; otherwise, -1. + + + + + Inserts an element into the PluginCollection at the specified index. + + The zero-based index at which should be inserted. + The to insert. + + is less than zero + -or- + is equal to or greater than . + + + + + Removes the first occurrence of a specific from the PluginCollection. + + The to remove from the PluginCollection. + + The specified was not found in the PluginCollection. + + + + + Removes the element at the specified index of the PluginCollection. + + The zero-based index of the element to remove. + + is less than zero. + -or- + is equal to or greater than . + + + + + Returns an enumerator that can iterate through the PluginCollection. + + An for the entire PluginCollection. + + + + Adds the elements of another PluginCollection to the current PluginCollection. + + The PluginCollection whose elements should be added to the end of the current PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a array to the current PluginCollection. + + The array whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Adds the elements of a collection to the current PluginCollection. + + The collection whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. + + + + Sets the capacity to the actual number of elements. + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets the number of elements actually contained in the PluginCollection. + + + + + Gets a value indicating whether access to the collection is synchronized (thread-safe). + + true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + + Gets an object that can be used to synchronize access to the collection. + + + An object that can be used to synchronize access to the collection. + + + + + Gets or sets the at the specified index. + + + The at the specified index. + + The zero-based index of the element to get or set. + + is less than zero. + -or- + is equal to or greater than . + + + + + Gets a value indicating whether the collection has a fixed size. + + true if the collection has a fixed size; otherwise, false. The default is false. + + + + Gets a value indicating whether the IList is read-only. + + true if the collection is read-only; otherwise, false. The default is false. + + + + Gets or sets the number of elements the PluginCollection can contain. + + + The number of elements the PluginCollection can contain. + + + + + Supports type-safe iteration over a . + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + + + Type visible only to our subclasses + Used to access protected constructor + + + + + + A value + + + + + Supports simple iteration over a . + + + + + + Initializes a new instance of the Enumerator class. + + + + + + Advances the enumerator to the next element in the collection. + + + true if the enumerator was successfully advanced to the next element; + false if the enumerator has passed the end of the collection. + + + The collection was modified after the enumerator was created. + + + + + Sets the enumerator to its initial position, before the first element in the collection. + + + + + Gets the current element in the collection. + + + The current element in the collection. + + + + + + + + Map of repository plugins. + + + + This class is a name keyed map of the plugins that are + attached to a repository. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The repository that the plugins should be attached to. + + + Initialize a new instance of the class with a + repository that the plugins should be attached to. + + + + + + Adds a to the map. + + The to add to the map. + + + The will be attached to the repository when added. + + + If there already exists a plugin with the same name + attached to the repository then the old plugin will + be and replaced with + the new plugin. + + + + + + Removes a from the map. + + The to remove from the map. + + + Remove a specific plugin from this map. + + + + + + Gets a by name. + + The name of the to lookup. + + The from the map with the name specified, or + null if no plugin is found. + + + + Lookup a plugin by name. If the plugin is not found null + will be returned. + + + + + + Gets all possible plugins as a list of objects. + + All possible plugins as a list of objects. + + + Get a collection of all the plugins defined in this map. + + + + + + Base implementation of + + + + Default abstract implementation of the + interface. This base class can be used by implementors + of the interface. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + the name of the plugin + + Initializes a new Plugin with the specified name. + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. + + + + + + The name of this plugin. + + + + + The repository this plugin is attached to. + + + + + Gets or sets the name of the plugin. + + + The name of the plugin. + + + + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. + + + The name of the plugin must not change one the + plugin has been attached to a repository. + + + + + + The repository for this plugin + + + The that this plugin is attached to. + + + + Gets or sets the that this plugin is + attached to. + + + + + + Plugin that listens for events from the + + + + This plugin publishes an instance of + on a specified . This listens for logging events delivered from + a remote . + + + When an event is received it is relogged within the attached repository + as if it had been raised locally. + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Initializes a new instance of the class. + + + The property must be set. + + + + + + Construct with sink Uri. + + The name to publish the sink under in the remoting infrastructure. + See for more details. + + + Initializes a new instance of the class + with specified name. + + + + + + Attaches this plugin to a . + + The that this plugin should be attached to. + + + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. + + + + + + Is called when the plugin is to shutdown. + + + + When the plugin is shutdown the remote logging + sink is disconnected. + + + + + + Gets or sets the URI of this sink. + + + The URI of this sink. + + + + This is the name under which the object is marshaled. + + + + + + + Delivers objects to a remote sink. + + + + Internal class used to listen for logging events + and deliver them to the local repository. + + + + + + Constructor + + The repository to log to. + + + Initializes a new instance of the for the + specified . + + + + + + Logs the events to the repository. + + The events to log. + + + The events passed are logged to the + + + + + + Obtains a lifetime service object to control the lifetime + policy for this instance. + + null to indicate that this instance should live forever. + + + Obtains a lifetime service object to control the lifetime + policy for this instance. This object should live forever + therefore this implementation returns null. + + + + + + The underlying that events should + be logged to. + + + + + Default implementation of + + + + This default implementation of the + interface is used to create the default subclass + of the object. + + + Nicko Cadell + Gert Driesen + + + + Interface abstracts creation of instances + + + + This interface is used by the to + create new objects. + + + The method is called + to create a named . + + + Implement this interface to create new subclasses of . + + + Nicko Cadell + Gert Driesen + + + + Create a new instance + + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Create a new instance + + The name of the . + The instance for the specified name. + + + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. + + + + + + Default internal subclass of + + + + This subclass has no additional behavior over the + class but does allow instances + to be created. + + + + + + Implementation of used by + + + + Internal class used to provide implementation of + interface. Applications should use to get + logger instances. + + + This is one of the central classes in the log4net implementation. One of the + distinctive features of log4net are hierarchical loggers and their + evaluation. The organizes the + instances into a rooted tree hierarchy. + + + The class is abstract. Only concrete subclasses of + can be created. The + is used to create instances of this type for the . + + + Nicko Cadell + Gert Driesen + Aspi Havewala + Douglas de la Torre + + + + This constructor created a new instance and + sets its name. + + The name of the . + + + This constructor is protected and designed to be used by + a subclass that is not abstract. + + + Loggers are constructed by + objects. See for the default + logger creator. + + + + + + Add to the list of appenders of this + Logger instance. + + An appender to add to this logger + + + Add to the list of appenders of this + Logger instance. + + + If is already in the list of + appenders, then it won't be added again. + + + + + + Look for the appender named as name + + The name of the appender to lookup + The appender with the name specified, or null. + + + Returns the named appender, or null if the appender is not found. + + + + + + Remove all previously added appenders from this Logger instance. + + + + Remove all previously added appenders from this Logger instance. + + + This is useful when re-reading configuration information. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The appender to remove + The appender removed from the list + + + Remove the appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Remove the appender passed as parameter form the list of appenders. + + The name of the appender to remove + The appender removed from the list + + + Remove the named appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + This generic form is intended to be used by wrappers. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the and . + + + This method must not throw any exception to the caller. + + + + + + This is the most generic printing method that is intended to be used + by wrappers. + + The event being logged. + + + Logs the specified logging event through this logger. + + + This method must not throw any exception to the caller. + + + + + + Checks if this logger is enabled for a given passed as parameter. + + The level to check. + + true if this logger is enabled for level, otherwise false. + + + + Test if this logger is going to log events of the specified . + + + This method must not throw any exception to the caller. + + + + + + Deliver the to the attached appenders. + + The event to log. + + + Call the appenders in the hierarchy starting at + this. If no appenders could be found, emit a + warning. + + + This method calls all the appenders inherited from the + hierarchy circumventing any evaluation of whether to log or not + to log the particular log request. + + + + + + Closes all attached appenders implementing the interface. + + + + Used to ensure that the appenders are correctly shutdown. + + + + + + This is the most generic printing method. This generic form is intended to be used by wrappers + + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generate a logging event for the specified using + the . + + + + + + Creates a new logging event and logs the event without further checks. + + The declaring type of the method that is + the stack boundary into the logging system for this call. + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. + + + Generates a logging event and delivers it to the attached + appenders. + + + + + + Creates a new logging event and logs the event without further checks. + + The event being logged. + + + Delivers the logging event to the attached appenders. + + + + + + The fully qualified type of the Logger class. + + + + + The name of this logger. + + + + + The assigned level of this logger. + + + + The level variable need not be + assigned a value in which case it is inherited + form the hierarchy. + + + + + + The parent of this logger. + + + + The parent of this logger. + All loggers have at least one ancestor which is the root logger. + + + + + + Loggers need to know what Hierarchy they are in. + + + + Loggers need to know what Hierarchy they are in. + The hierarchy that this logger is a member of is stored + here. + + + + + + Helper implementation of the interface + + + + + Flag indicating if child loggers inherit their parents appenders + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl + + + + + Gets or sets the parent logger in the hierarchy. + + + The parent logger in the hierarchy. + + + + Part of the Composite pattern that makes the hierarchy. + The hierarchy is parent linked rather than child linked. + + + + + + Gets or sets a value indicating if child loggers inherit their parent's appenders. + + + true if child loggers inherit their parent's appenders. + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + + + + + Gets the effective level for this logger. + + The nearest level in the logger hierarchy. + + + Starting from this logger, searches the logger hierarchy for a + non-null level and returns it. Otherwise, returns the level of the + root logger. + + The Logger class is designed so that this method executes as + quickly as possible. + + + + + Gets or sets the where this + Logger instance is attached to. + + The hierarchy that this logger belongs to. + + + This logger must be attached to a single . + + + + + + Gets or sets the assigned , if any, for this Logger. + + + The of this logger. + + + + The assigned can be null. + + + + + + Get the appenders contained in this logger as an + . + + A collection of the appenders in this logger + + + Get the appenders contained in this logger as an + . If no appenders + can be found, then a is returned. + + + + + + Gets the logger name. + + + The name of the logger. + + + + The name of this logger + + + + + + Gets the where this + Logger instance is attached to. + + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + + + + + Construct a new Logger + + the name of the logger + + + Initializes a new instance of the class + with the specified name. + + + + + + Delegate used to handle logger creation event notifications. + + The in which the has been created. + The event args that hold the instance that has been created. + + + Delegate used to handle logger creation event notifications. + + + + + + Provides data for the event. + + + + A event is raised every time a + is created. + + + + + + The created + + + + + Constructor + + The that has been created. + + + Initializes a new instance of the event argument + class,with the specified . + + + + + + Gets the that has been created. + + + The that has been created. + + + + The that has been created. + + + + + + Hierarchical organization of loggers + + + + The casual user should not have to deal with this class + directly. + + + This class is specialized in retrieving loggers by name and + also maintaining the logger hierarchy. Implements the + interface. + + + The structure of the logger hierarchy is maintained by the + method. The hierarchy is such that children + link to their parent but parents do not have any references to their + children. Moreover, loggers can be instantiated in any order, in + particular descendant before ancestor. + + + In case a descendant is created before a particular ancestor, + then it creates a provision node for the ancestor and adds itself + to the provision node. Other descendants of the same ancestor add + themselves to the previously created provision node. + + + Nicko Cadell + Gert Driesen + + + + Base implementation of + + + + Default abstract implementation of the interface. + + + Skeleton implementation of the interface. + All types can extend this type. + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by logger repositories. + + + + This interface is implemented by logger repositories. e.g. + . + + + This interface is used by the + to obtain interfaces. + + + Nicko Cadell + Gert Driesen + + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + The name of the logger to lookup + The Logger object with the name specified + + + If the names logger exists it is returned, otherwise + null is returned. + + + + + + Returns all the currently defined loggers as an Array. + + All the defined loggers + + + Returns all the currently defined loggers as an Array. + + + + + + Returns a named logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Returns a named logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + Shutdown the repository + + + Shutting down a repository will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + The name of the repository + + + The name of the repository + + + + The name of the repository. + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + + These properties can be specified on a repository specific basis. + + + + + + Default Constructor + + + + Initializes the repository with default (empty) properties. + + + + + + Construct the repository using specific properties + + the properties to set for this repository + + + Initializes the repository with specified properties. + + + + + + Test if logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the repository + + All the defined loggers + + + Returns all the currently defined loggers in the repository as an Array. + + + + + + Return a new logger instance + + The name of the logger to retrieve + The logger object with the name specified + + + Return a new logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + + + + Shutdown the repository + + + + Shutdown the repository. Can be overridden in a subclass. + This base class implementation notifies the + listeners and all attached plugins of the shutdown event. + + + + + + Reset the repositories configuration to a default state + + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this repository. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are configured as an Array. + + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + + + + + Adds an object renderer for a specific class. + + The type that will be rendered by the renderer supplied. + The object renderer used to render the object. + + + Adds an object renderer for a specific class. + + + + + + Notify the registered listeners that the repository is shutting down + + Empty EventArgs + + + Notify any listeners that this repository is shutting down. + + + + + + Notify the registered listeners that the repository has had its configuration reset + + Empty EventArgs + + + Notify any listeners that this repository's configuration has been reset. + + + + + + Notify the registered listeners that the repository has had its configuration changed + + Empty EventArgs + + + Notify any listeners that this repository's configuration has changed. + + + + + + Raise a configuration changed event on this repository + + EventArgs.Empty + + + Applications that programmatically change the configuration of the repository should + raise this event notification to notify listeners. + + + + + + The name of the repository + + + The string name of the repository + + + + The name of this repository. The name is + used to store and lookup the repositories + stored by the . + + + + + + The threshold for all events in this repository + + + The threshold for all events in this repository + + + + The threshold for all events in this repository + + + + + + RendererMap accesses the object renderer map for this repository. + + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + + + + + The plugin map for this repository. + + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + + + + + Get the level map for the Repository. + + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + + + + + Flag indicates if this repository has been configured. + + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + + + + + Event to notify that the repository has been shutdown. + + + Event to notify that the repository has been shutdown. + + + + Event raised when the repository has been shutdown. + + + + + + Event to notify that the repository has had its configuration reset. + + + Event to notify that the repository has had its configuration reset. + + + + Event raised when the repository's configuration has been + reset to default. + + + + + + Event to notify that the repository has had its configuration changed. + + + Event to notify that the repository has had its configuration changed. + + + + Event raised when the repository's configuration has been changed. + + + + + + Repository specific properties + + + Repository specific properties + + + These properties can be specified on a repository specific basis + + + + + Basic Configurator interface for repositories + + + + Interface used by basic configurator to configure a + with a default . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified appender + + the appender to use to log all logging events + + + Configure the repository to route all logging events to the + specified appender. + + + + + + Configure repository using XML + + + + Interface used by Xml configurator to configure a . + + + A should implement this interface to support + configuration by the . + + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified config + + the element containing the root of the config + + + The schema for the XML configuration data is defined by + the implementation. + + + + + + Default constructor + + + + Initializes a new instance of the class. + + + + + + Construct with properties + + The properties to pass to this repository. + + + Initializes a new instance of the class. + + + + + + Construct with a logger factory + + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Construct with properties and a logger factory + + The properties to pass to this repository. + The factory to use to create new logger instances. + + + Initializes a new instance of the class with + the specified . + + + + + + Test if a logger exists + + The name of the logger to lookup + The Logger object with the name specified + + + Check if the named logger exists in the hierarchy. If so return + its reference, otherwise returns null. + + + + + + Returns all the currently defined loggers in the hierarchy as an Array + + All the defined loggers + + + Returns all the currently defined loggers in the hierarchy as an Array. + The root logger is not included in the returned + enumeration. + + + + + + Return a new logger instance named as the first parameter using + the default factory. + + + + Return a new logger instance named as the first parameter using + the default factory. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + + The name of the logger to retrieve + The logger object with the name specified + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The Shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Reset all values contained in this hierarchy instance to their default. + + + + Reset all values contained in this hierarchy instance to their + default. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + + + + + Log the logEvent through this hierarchy. + + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + + + + + Returns all the Appenders that are currently configured + + An array containing all the currently configured appenders + + + Returns all the instances that are currently configured. + All the loggers are searched for appenders. The appenders may also be containers + for appenders and these are also searched for additional loggers. + + + The list returned is unordered but does not contain duplicates. + + + + + + Collect the appenders from an . + The appender may also be a container. + + + + + + + Collect the appenders from an container + + + + + + + Initialize the log4net system using the specified appender + + the appender to use to log all logging events + + + + Initialize the log4net system using the specified appender + + the appender to use to log all logging events + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + + Initialize the log4net system using the specified config + + the element containing the root of the config + + + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. + + + + + + Test if this hierarchy is disabled for the specified . + + The level to check against. + + true if the repository is disabled for the level argument, false otherwise. + + + + If this hierarchy has not been configured then this method will + always return true. + + + This method will return true if this repository is + disabled for level object passed as parameter and + false otherwise. + + + See also the property. + + + + + + Clear all logger definitions from the internal hashtable + + + + This call will clear all logger definitions from the internal + hashtable. Invoking this method will irrevocably mess up the + logger hierarchy. + + + You should really know what you are doing before + invoking this method. + + + + + + Return a new logger instance named as the first parameter using + . + + The name of the logger to retrieve + The factory that will make the new logger instance + The logger object with the name specified + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated by the + parameter and linked with its existing + ancestors as well as children. + + + + + + Sends a logger creation event to all registered listeners + + The newly created logger + + Raises the logger creation event. + + + + + Updates all the parents of the specified logger + + The logger to update the parents for + + + This method loops through all the potential parents of + . There 3 possible cases: + + + + No entry for the potential parent of exists + + We create a ProvisionNode for this potential + parent and insert in that provision node. + + + + The entry is of type Logger for the potential parent. + + The entry is 's nearest existing parent. We + update 's parent field with this entry. We also break from + he loop because updating our parent's parent is our parent's + responsibility. + + + + The entry is of type ProvisionNode for this potential parent. + + We add to the list of children for this + potential parent. + + + + + + + + Replace a with a in the hierarchy. + + + + + + We update the links for all the children that placed themselves + in the provision node 'pn'. The second argument 'log' is a + reference for the newly created Logger, parent of all the + children in 'pn'. + + + We loop on all the children 'c' in 'pn'. + + + If the child 'c' has been already linked to a child of + 'log' then there is no need to update 'c'. + + + Otherwise, we set log's parent field to c's parent and set + c's parent field to log. + + + + + + Define or redefine a Level using the values in the argument + + the level values + + + Define or redefine a Level using the values in the argument + + + Supports setting levels via the configuration file. + + + + + + Set a Property using the values in the argument + + the property value + + + Set a Property using the values in the argument. + + + Supports setting property values via the configuration file. + + + + + + Event used to notify that a logger has been created. + + + + Event raised when a logger is created. + + + + + + Has no appender warning been emitted + + + + Flag to indicate if we have already issued a warning + about not having an appender warning. + + + + + + Get the root of this hierarchy + + + + Get the root of this hierarchy. + + + + + + Gets or sets the default instance. + + The default + + + The logger factory is used to create logger instances. + + + + + + A class to hold the value, name and display name for a level + + + + A class to hold the value, name and display name for a level + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Value of the level + + + + If the value is not set (defaults to -1) the value will be looked + up for the current level with the same name. + + + + + + Name of the level + + + The name of the level + + + + The name of the level. + + + + + + Display name for the level + + + The display name of the level + + + + The display name of the level. + + + + + + A class to hold the key and data for a property set in the config file + + + + A class to hold the key and data for a property set in the config file + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Property Key + + + Property Key + + + + Property Key. + + + + + + Property Value + + + Property Value + + + + Property Value. + + + + + + Used internally to accelerate hash table searches. + + + + Internal class used to improve performance of + string keyed hashtables. + + + The hashcode of the string is cached for reuse. + The string is stored as an interned value. + When comparing two objects for equality + the reference equality of the interned strings is compared. + + + Nicko Cadell + Gert Driesen + + + + Construct key with string name + + + + Initializes a new instance of the class + with the specified name. + + + Stores the hashcode of the string and interns + the string key to optimize comparisons. + + + The Compact Framework 1.0 the + method does not work. On the Compact Framework + the string keys are not interned nor are they + compared by reference. + + + The name of the logger. + + + + Returns a hash code for the current instance. + + A hash code for the current instance. + + + Returns the cached hashcode. + + + + + + Determines whether two instances + are equal. + + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + + + + Compares the references of the interned strings. + + + + + + Provision nodes are used where no logger instance has been specified + + + + instances are used in the + when there is no specified + for that node. + + + A provision node holds a list of child loggers on behalf of + a logger that does not exist. + + + Nicko Cadell + Gert Driesen + + + + Create a new provision node with child node + + A child logger to add to this node. + + + Initializes a new instance of the class + with the specified child logger. + + + + + + The sits at the root of the logger hierarchy tree. + + + + The is a regular except + that it provides several guarantees. + + + First, it cannot be assigned a null + level. Second, since the root logger cannot have a parent, the + property always returns the value of the + level field without walking the hierarchy. + + + Nicko Cadell + Gert Driesen + + + + Construct a + + The level to assign to the root logger. + + + Initializes a new instance of the class with + the specified logging level. + + + The root logger names itself as "root". However, the root + logger cannot be retrieved by name. + + + + + + Gets the assigned level value without walking the logger hierarchy. + + The assigned level value without walking the logger hierarchy. + + + Because the root logger cannot have a parent and its level + must not be null this property just returns the + value of . + + + + + + Gets or sets the assigned for the root logger. + + + The of the root logger. + + + + Setting the level of the root logger to a null reference + may have catastrophic results. We prevent this here. + + + + + + Initializes the log4net environment using an XML DOM. + + + + Configures a using an XML DOM. + + + Nicko Cadell + Gert Driesen + + + + Construct the configurator for a hierarchy + + The hierarchy to build. + + + Initializes a new instance of the class + with the specified . + + + + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + The root element to parse. + + + Configure the hierarchy by parsing a DOM tree of XML elements. + + + + + + Parse appenders by IDREF. + + The appender ref element. + The instance of the appender that the ref refers to. + + + Parse an XML element that represents an appender and return + the appender. + + + + + + Parses an appender element. + + The appender element. + The appender instance or null when parsing failed. + + + Parse an XML element that represents an appender and return + the appender instance. + + + + + + Parses a logger element. + + The logger element. + + + Parse an XML element that represents a logger. + + + + + + Parses the root logger element. + + The root element. + + + Parse an XML element that represents the root logger. + + + + + + Parses the children of a logger element. + + The category element. + The logger instance. + Flag to indicate if the logger is the root logger. + + + Parse the child elements of a <logger> element. + + + + + + Parses an object renderer. + + The renderer element. + + + Parse an XML element that represents a renderer. + + + + + + Parses a level element. + + The level element. + The logger object to set the level on. + Flag to indicate if the logger is the root logger. + + + Parse an XML element that represents a level. + + + + + + Sets a parameter on an object. + + The parameter element. + The object to set the parameter on. + + The parameter name must correspond to a writable property + on the object. The value of the parameter is a string, + therefore this function will attempt to set a string + property first. If unable to set a string property it + will inspect the property and its argument type. It will + attempt to call a static method called Parse on the + type of the property. This method will take a single + string argument and return a value that can be used to + set the property. + + + + + Test if an element has no attributes or child elements + + the element to inspect + true if the element has any attributes or child elements, false otherwise + + + + Test if a is constructible with Activator.CreateInstance. + + the type to inspect + true if the type is creatable using a default constructor, false otherwise + + + + Look for a method on the that matches the supplied + + the type that has the method + the name of the method + the method info found + + + The method must be a public instance method on the . + The method must be named or "Add" followed by . + The method must take a single parameter. + + + + + + Converts a string value to a target type. + + The type of object to convert the string to. + The string value to use as the value of the object. + + + An object of type with value or + null when the conversion could not be performed. + + + + + + Creates an object as specified in XML. + + The XML element that contains the definition of the object. + The object type to use if not explicitly specified. + The type that the returned object must be or must inherit from. + The object or null + + + Parse an XML element and create an object instance based on the configuration + data. + + + The type of the instance may be specified in the XML. If not + specified then the is used + as the type. However the type is specified it must support the + type. + + + + + + key: appenderName, value: appender. + + + + + The Hierarchy being configured. + + + + + Delegate used to handle logger repository shutdown event notifications + + The that is shutting down. + Empty event args + + + Delegate used to handle logger repository shutdown event notifications. + + + + + + Delegate used to handle logger repository configuration reset event notifications + + The that has had its configuration reset. + Empty event args + + + Delegate used to handle logger repository configuration reset event notifications. + + + + + + Delegate used to handle event notifications for logger repository configuration changes. + + The that has had its configuration changed. + Empty event arguments. + + + Delegate used to handle event notifications for logger repository configuration changes. + + + + + + Write the name of the current AppDomain to the output + + + + Write the name of the current AppDomain to the output writer + + + Nicko Cadell + + + + Write the name of the current AppDomain to the output + + the writer to write to + null, state is not set + + + Writes name of the current AppDomain to the output . + + + + + + Write the current date to the output + + + + Date pattern converter, uses a to format + the current date and time to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The date and time is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + + + Nicko Cadell + + + + The used to render the date to a string + + + + The used to render the date to a string + + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current date to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date and time passed is in the local time zone. + + + + + + Write an environment variable to the output + + + + Write an environment variable to the output writer. + The value of the determines + the name of the variable to output. + + + Nicko Cadell + + + + Write an environment variable to the output + + the writer to write to + null, state is not set + + + Writes the environment variable to the output . + The name of the environment variable to output must be set + using the + property. + + + + + + Write the current thread identity to the output + + + + Write the current thread identity to the output writer + + + Nicko Cadell + + + + Write the current thread identity to the output + + the writer to write to + null, state is not set + + + Writes the current thread identity to the output . + + + + + + Pattern converter for literal string instances in the pattern + + + + Writes the literal string value specified in the + property to + the output. + + + Nicko Cadell + + + + Set the next converter in the chain + + The next pattern converter in the chain + The next pattern converter + + + Special case the building of the pattern converter chain + for instances. Two adjacent + literals in the pattern can be represented by a single combined + pattern converter. This implementation detects when a + is added to the chain + after this converter and combines its value with this converter's + literal value. + + + + + + Write the literal to the output + + the writer to write to + null, not set + + + Override the formatting behavior to ignore the FormattingInfo + because we have a literal instead. + + + Writes the value of + to the output . + + + + + + Convert this pattern into the rendered message + + that will receive the formatted result. + null, not set + + + This method is not used. + + + + + + Writes a newline to the output + + + + Writes the system dependent line terminator to the output. + This behavior can be overridden by setting the : + + + + Option Value + Output + + + DOS + DOS or Windows line terminator "\r\n" + + + UNIX + UNIX line terminator "\n" + + + + Nicko Cadell + + + + Initialize the converter + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write the current process ID to the output + + + + Write the current process ID to the output writer + + + Nicko Cadell + + + + Write the current process ID to the output + + the writer to write to + null, state is not set + + + Write the current process ID to the output . + + + + + + Property pattern converter + + + + This pattern converter reads the thread and global properties. + The thread properties take priority over global properties. + See for details of the + thread properties. See for + details of the global properties. + + + If the is specified then that will be used to + lookup a single property. If no is specified + then all properties will be dumped as a list of key value pairs. + + + Nicko Cadell + + + + Write the property value to the output + + that will receive the formatted result. + null, state is not set + + + Writes out the value of a named property. The property name + should be set in the + property. + + + If the is set to null + then all the properties are written as key value pairs. + + + + + + A Pattern converter that generates a string of random characters + + + + The converter generates a string of random characters. By default + the string is length 4. This can be changed by setting the + to the string value of the length required. + + + The random characters in the string are limited to uppercase letters + and numbers only. + + + The random number generator used by this class is not cryptographically secure. + + + Nicko Cadell + + + + Shared random number generator + + + + + Length of random string to generate. Default length 4. + + + + + Initialize the converter options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Write a randoim string to the output + + the writer to write to + null, state is not set + + + Write a randoim string to the output . + + + + + + Write the current threads username to the output + + + + Write the current threads username to the output writer + + + Nicko Cadell + + + + Write the current threads username to the output + + the writer to write to + null, state is not set + + + Write the current threads username to the output . + + + + + + Write the UTC date time to the output + + + + Date pattern converter, uses a to format + the current date and time in Universal time. + + + See the for details on the date pattern syntax. + + + + Nicko Cadell + + + + Write the current date and time to the output + + that will receive the formatted result. + null, state is not set + + + Pass the current date and time to the + for it to render it to the writer. + + + The date is in Universal time when it is rendered. + + + + + + + Type converter for Boolean. + + + + Supports conversion from string to bool type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Exception base type for conversion errors. + + + + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + A message to include with the exception. + + + Initializes a new instance of the class + with the specified message. + + + + + + Constructor + + A message to include with the exception. + A nested exception to include. + + + Initializes a new instance of the class + with the specified message and inner exception. + + + + + + Serialization constructor + + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + An instance of the . + + + Creates a new instance of the class. + + + + + + Creates a new instance of the class. + + The conversion destination type. + The value to convert. + A nested exception to include. + An instance of the . + + + Creates a new instance of the class. + + + + + + Register of type converters for specific types. + + + + Maintains a registry of type converters used to convert between + types. + + + Use the and + methods to register new converters. + The and methods + lookup appropriate converters to use. + + + + + Nicko Cadell + Gert Driesen + + + + Private constructor + + + Initializes a new instance of the class. + + + + + Static constructor. + + + + This constructor defines the intrinsic type converters. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type converter to use to convert to the destination type. + + + Adds a converter instance for a specific type. + + + + + + Adds a converter for a specific type. + + The type being converted to. + The type of the type converter to use to convert to the destination type. + + + Adds a converter for a specific type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted from. + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Gets the type converter to use to convert values to the destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + Gets the type converter to use to convert values to the destination type. + + + + + + Lookups the type converter to use as specified by the attributes on the + destination type. + + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + + Creates the instance of the type converter. + + The type of the type converter. + + The type converter instance to use for type conversions or null + if no type converter is found. + + + + The type specified for the type converter must implement + the or interfaces + and must have a public default (no argument) constructor. + + + + + + Mapping from to type converter. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an encoding + the encoding + + + Uses the method to + convert the argument to an . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Interface supported by type converters + + + + This interface supports conversion from a single type to arbitrary types. + See . + + + Nicko Cadell + + + + Returns whether this converter can convert the object to the specified type + + A Type that represents the type you want to convert to + true if the conversion is possible + + + Test if the type supported by this converter can be converted to the + . + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Converts the (which must be of the type supported + by this converter) to the specified.. + + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to an IPAddress + the IPAddress + + + Uses the method to convert the + argument to an . + If that fails then the string is resolved as a DNS hostname. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternLayout + the PatternLayout + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Convert between string and + + + + Supports conversion from string to type, + and from a type to a string. + + + The string is used as the + of the . + + + + + + Nicko Cadell + + + + Can the target type be converted to the type supported by this object + + A that represents the type you want to convert to + true if the conversion is possible + + + Returns true if the is + assignable from a type. + + + + + + Converts the given value object to the specified type, using the arguments + + the object to convert + The Type to convert the value parameter to + the converted object + + + Uses the method to convert the + argument to a . + + + + The object cannot be converted to the + . To check for this condition use the + method. + + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a PatternString + the PatternString + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Supports conversion from string to type. + + + + Supports conversion from string to type. + + + + + + Nicko Cadell + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Returns true if the is + the type. + + + + + + Overrides the ConvertFrom method of IConvertFrom. + + the object to convert to a Type + the Type + + + Uses the method to convert the + argument to a . + Additional effort is made to locate partially specified types + by searching the loaded assemblies. + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + + + + + Attribute used to associate a type converter + + + + Class and Interface level attribute that specifies a type converter + to use with the associated type. + + + To associate a type converter with a target type apply a + TypeConverterAttribute to the target type. Specify the + type of the type converter on the attribute. + + + Nicko Cadell + Gert Driesen + + + + The string type name of the type converter + + + + + Default constructor + + + + Default constructor + + + + + + Create a new type converter attribute for the specified type name + + The string type name of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + Create a new type converter attribute for the specified type + + The type of the type converter + + + The type specified must implement the + or the interfaces. + + + + + + The string type name of the type converter + + + The string type name of the type converter + + + + The type specified must implement the + or the interfaces. + + + + + + A straightforward implementation of the interface. + + + + This is the default implementation of the + interface. Implementors of the interface + should aggregate an instance of this type. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Append on on all attached appenders. + + The event being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Append on on all attached appenders. + + The array of events being logged. + The number of appenders called. + + + Calls the method on all + attached appenders. + + + + + + Calls the DoAppende method on the with + the objects supplied. + + The appender + The events + + + If the supports the + interface then the will be passed + through using that interface. Otherwise the + objects in the array will be passed one at a time. + + + + + + Attaches an appender. + + The appender to add. + + + If the appender is already in the list it won't be added again. + + + + + + Gets an attached appender with the specified name. + + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + + + + Lookup an attached appender by name. + + + + + + Removes all attached appenders. + + + + Removes and closes all attached appenders + + + + + + Removes the specified appender from the list of attached appenders. + + The appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + Removes the appender with the specified name from the list of appenders. + + The name of the appender to remove. + The appender removed from the list + + + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. + + + + + + List of appenders + + + + + Array of appenders, used to cache the m_appenderList + + + + + Gets all attached appenders. + + + A collection of attached appenders, or null if there + are no attached appenders. + + + + The read only collection of all currently attached appenders. + + + + + + This class aggregates several PropertiesDictionary collections together. + + + + Provides a dictionary style lookup over an ordered list of + collections. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Add a Properties Dictionary to this composite collection + + the properties to add + + + Properties dictionaries added first take precedence over dictionaries added + later. + + + + + + Flatten this composite collection into a single properties dictionary + + the flattened dictionary + + + Reduces the collection of ordered dictionaries to a single dictionary + containing the resultant values for the keys. + + + + + + Gets the value of a property + + + The value for the property with the specified key + + + + Looks up the value for the specified. + The collections are searched + in the order in which they were added to this collection. The value + returned is the value held by the first collection that contains + the specified key. + + + If none of the collections contain the specified key then + null is returned. + + + + + + Base class for Context Properties implementations + + + + This class defines a basic property get set accessor + + + Nicko Cadell + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Subclass of that maintains a count of + the number of bytes written. + + + + This writer counts the number of bytes written. + + + Nicko Cadell + Gert Driesen + + + + that does not leak exceptions + + + + does not throw exceptions when things go wrong. + Instead, it delegates error handling to its . + + + Nicko Cadell + Gert Driesen + + + + Adapter that extends and forwards all + messages to an instance of . + + + + Adapter that extends and forwards all + messages to an instance of . + + + Nicko Cadell + + + + The writer to forward messages to + + + + + Create an instance of that forwards all + messages to a . + + The to forward to + + + Create an instance of that forwards all + messages to a . + + + + + + Closes the writer and releases any system resources associated with the writer + + + + + + + + + Dispose this writer + + flag indicating if we are being disposed + + + Dispose this writer + + + + + + Flushes any buffered output + + + + Clears all buffers for the writer and causes any buffered data to be written + to the underlying device + + + + + + Writes a character to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a character to the wrapped TextWriter + + + + + + Writes a character buffer to the wrapped TextWriter + + the data buffer + the start index + the number of characters to write + + + Writes a character buffer to the wrapped TextWriter + + + + + + Writes a string to the wrapped TextWriter + + the value to write to the TextWriter + + + Writes a string to the wrapped TextWriter + + + + + + Gets or sets the underlying . + + + The underlying . + + + + Gets or sets the underlying . + + + + + + The Encoding in which the output is written + + + The + + + + The Encoding in which the output is written + + + + + + Gets an object that controls formatting + + + The format provider + + + + Gets an object that controls formatting + + + + + + Gets or sets the line terminator string used by the TextWriter + + + The line terminator to use + + + + Gets or sets the line terminator string used by the TextWriter + + + + + + Constructor + + the writer to actually write to + the error handler to report error to + + + Create a new QuietTextWriter using a writer and error handler + + + + + + Writes a character to the underlying writer + + the char to write + + + Writes a character to the underlying writer + + + + + + Writes a buffer to the underlying writer + + the buffer to write + the start index to write from + the number of characters to write + + + Writes a buffer to the underlying writer + + + + + + Writes a string to the output. + + The string data to write to the output. + + + Writes a string to the output. + + + + + + Closes the underlying output writer. + + + + Closes the underlying output writer. + + + + + + The error handler instance to pass all errors to + + + + + Flag to indicate if this writer is closed + + + + + Gets or sets the error handler that all errors are passed to. + + + The error handler that all errors are passed to. + + + + Gets or sets the error handler that all errors are passed to. + + + + + + Gets a value indicating whether this writer is closed. + + + true if this writer is closed, otherwise false. + + + + Gets a value indicating whether this writer is closed. + + + + + + Constructor + + The to actually write to. + The to report errors to. + + + Creates a new instance of the class + with the specified and . + + + + + + Writes a character to the underlying writer and counts the number of bytes written. + + the char to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a buffer to the underlying writer and counts the number of bytes written. + + the buffer to write + the start index to write from + the number of characters to write + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Writes a string to the output and counts the number of bytes written. + + The string data to write to the output. + + + Overrides implementation of . Counts + the number of bytes written. + + + + + + Total number of bytes written. + + + + + Gets or sets the total number of bytes written. + + + The total number of bytes written. + + + + Gets or sets the total number of bytes written. + + + + + + A fixed size rolling buffer of logging events. + + + + An array backed fixed size leaky bucket. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The maximum number of logging events in the buffer. + + + Initializes a new instance of the class with + the specified maximum number of buffered logging events. + + + The argument is not a positive integer. + + + + Appends a to the buffer. + + The event to append to the buffer. + The event discarded from the buffer, if the buffer is full, otherwise null. + + + Append an event to the buffer. If the buffer still contains free space then + null is returned. If the buffer is full then an event will be dropped + to make space for the new event, the event dropped is returned. + + + + + + Get and remove the oldest event in the buffer. + + The oldest logging event in the buffer + + + Gets the oldest (first) logging event in the buffer and removes it + from the buffer. + + + + + + Pops all the logging events from the buffer into an array. + + An array of all the logging events in the buffer. + + + Get all the events in the buffer and clear the buffer. + + + + + + Clear the buffer + + + + Clear the buffer of all events. The events in the buffer are lost. + + + + + + Gets the th oldest event currently in the buffer. + + The th oldest event currently in the buffer. + + + If is outside the range 0 to the number of events + currently in the buffer, then null is returned. + + + + + + Gets the maximum size of the buffer. + + The maximum size of the buffer. + + + Gets the maximum size of the buffer + + + + + + Gets the number of logging events in the buffer. + + The number of logging events in the buffer. + + + This number is guaranteed to be in the range 0 to + (inclusive). + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + The singleton instance of the empty collection. + + + + + Gets the singleton instance of the empty collection. + + The singleton instance of the empty collection. + + + Gets the singleton instance of the empty collection. + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the . + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + An always empty . + + + + A singleton implementation of the + interface that always represents an empty collection. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Copies the elements of the to an + , starting at a particular Array index. + + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. + + + As the collection is empty no values are copied into the array. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Adds an element with the provided key and value to the + . + + The to use as the key of the element to add. + The to use as the value of the element to add. + + + As the collection is empty no new values can be added. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Removes all elements from the . + + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + Determines whether the contains an element + with the specified key. + + The key to locate in the . + false + + + As the collection is empty the method always returns false. + + + + + + Returns an enumerator that can iterate through a collection. + + + An that can be used to + iterate through the collection. + + + + As the collection is empty a is returned. + + + + + + Removes the element with the specified key from the . + + The key of the element to remove. + + + As the collection is empty no values can be removed. A + is thrown if this method is called. + + + This dictionary is always empty and cannot be modified. + + + + The singleton instance of the empty dictionary. + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets a value indicating if access to the is synchronized (thread-safe). + + + true if access to the is synchronized (thread-safe); otherwise, false. + + + + For the this property is always true. + + + + + + Gets the number of elements contained in the + + + The number of elements contained in the . + + + + As the collection is empty the is always 0. + + + + + + Gets an object that can be used to synchronize access to the . + + + An object that can be used to synchronize access to the . + + + + As the collection is empty and thread safe and synchronized this instance is also + the object. + + + + + + Gets a value indicating whether the has a fixed size. + + true + + + As the collection is empty always returns true. + + + + + + Gets a value indicating whether the is read-only. + + true + + + As the collection is empty always returns true. + + + + + + Gets an containing the keys of the . + + An containing the keys of the . + + + As the collection is empty a is returned. + + + + + + Gets an containing the values of the . + + An containing the values of the . + + + As the collection is empty a is returned. + + + + + + Gets or sets the element with the specified key. + + The key of the element to get or set. + null + + + As the collection is empty no values can be looked up or stored. + If the index getter is called then null is returned. + A is thrown if the setter is called. + + + This dictionary is always empty and cannot be modified. + + + + Contain the information obtained when parsing formatting modifiers + in conversion modifiers. + + + + Holds the formatting information extracted from the format string by + the . This is used by the + objects when rendering the output. + + + Nicko Cadell + Gert Driesen + + + + Defaut Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + + + Initializes a new instance of the class + with the specified parameters. + + + + + + Gets or sets the minimum value. + + + The minimum value. + + + + Gets or sets the minimum value. + + + + + + Gets or sets the maximum value. + + + The maximum value. + + + + Gets or sets the maximum value. + + + + + + Gets or sets a flag indicating whether left align is enabled + or not. + + + A flag indicating whether left align is enabled or not. + + + + Gets or sets a flag indicating whether left align is enabled or not. + + + + + + Implementation of Properties collection for the + + + + This class implements a properties collection that is thread safe and supports both + storing properties and capturing a read only copy of the current propertied. + + + This class is optimized to the scenario where the properties are read frequently + and are modified infrequently. + + + Nicko Cadell + + + + The read only copy of the properties. + + + + This variable is declared volatile to prevent the compiler and JIT from + reordering reads and writes of this thread performed on different threads. + + + + + + Lock object used to synchronize updates within this instance + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property from the global context + + the key for the entry to remove + + + Removing an entry from the global context properties is relatively expensive compared + with reading a value. + + + + + + Clear the global context properties + + + + + Get a readonly immutable copy of the properties + + the current global context properties + + + This implementation is fast because the GlobalContextProperties class + stores a readonly copy of the properties. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Reading the value for a key is faster than setting the value. + When the value is written a new read only copy of + the properties is created. + + + + + + Manages a mapping from levels to + + + + Manages an ordered mapping from instances + to subclasses. + + + Nicko Cadell + + + + Default constructor + + + + Initialise a new instance of . + + + + + + Add a to this mapping + + the entry to add + + + If a has previously been added + for the same then that entry will be + overwritten. + + + + + + Lookup the mapping for the specified level + + the level to lookup + the for the level or null if no mapping found + + + Lookup the value for the specified level. Finds the nearest + mapping value for the level that is equal to or less than the + specified. + + + If no mapping could be found then null is returned. + + + + + + Initialize options + + + + Caches the sorted list of in an array + + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove the value for the specified from the context. + + + + + + Clear all the context properties + + + + Clear all the context properties + + + + + + Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. + + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doings so. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Get or set the property value for the specified. + + + + + + Outputs log statements from within the log4net assembly. + + + + Log4net components cannot make log4net logging calls. However, it is + sometimes useful for the user to learn about what log4net is + doing. + + + All log4net internal debug calls go to the standard output stream + whereas internal error messages are sent to the standard error output + stream. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Static constructor that initializes logging by reading + settings from the application configuration file. + + + + The log4net.Internal.Debug application setting + controls internal debugging. This setting should be set + to true to enable debugging. + + + The log4net.Internal.Quiet application setting + suppresses all internal logging including error messages. + This setting should be set to true to enable message + suppression. + + + + + + Writes log4net internal debug messages to the + standard output stream. + + The message to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal debug messages to the + standard output stream. + + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net: ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The message to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal warning messages to the + standard error stream. + + The message to log. + An exception to log. + + + All internal warning messages are prepended with + the string "log4net:WARN ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The message to log. + + + All internal error messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes log4net internal error messages to the + standard error stream. + + The message to log. + An exception to log. + + + All internal debug messages are prepended with + the string "log4net:ERROR ". + + + + + + Writes output to the standard output stream. + + The message to log. + + + Writes to both Console.Out and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Writes output to the standard error stream. + + The message to log. + + + Writes to both Console.Error and System.Diagnostics.Trace. + Note that the System.Diagnostics.Trace is not supported + on the Compact Framework. + + + If the AppDomain is not configured with a config file then + the call to System.Diagnostics.Trace may fail. This is only + an issue if you are programmatically creating your own AppDomains. + + + + + + Default debug level + + + + + In quietMode not even errors generate any output. + + + + + Gets or sets a value indicating whether log4net internal logging + is enabled or disabled. + + + true if log4net internal logging is enabled, otherwise + false. + + + + When set to true, internal debug level logging will be + displayed. + + + This value can be set by setting the application setting + log4net.Internal.Debug in the application configuration + file. + + + The default value is false, i.e. debugging is + disabled. + + + + + The following example enables internal debugging using the + application configuration file : + + + + + + + + + + + + + Gets or sets a value indicating whether log4net should generate no output + from internal logging, not even for errors. + + + true if log4net should generate no output at all from internal + logging, otherwise false. + + + + When set to true will cause internal logging at all levels to be + suppressed. This means that no warning or error reports will be logged. + This option overrides the setting and + disables all debug also. + + This value can be set by setting the application setting + log4net.Internal.Quiet in the application configuration file. + + + The default value is false, i.e. internal logging is not + disabled. + + + + The following example disables internal logging using the + application configuration file : + + + + + + + + + + + + Test if LogLog.Debug is enabled for output. + + + true if Debug is enabled + + + + Test if LogLog.Debug is enabled for output. + + + + + + Test if LogLog.Warn is enabled for output. + + + true if Warn is enabled + + + + Test if LogLog.Warn is enabled for output. + + + + + + Test if LogLog.Error is enabled for output. + + + true if Error is enabled + + + + Test if LogLog.Error is enabled for output. + + + + + + Represents a native error code and message. + + + + Represents a Win32 platform native error. + + + Nicko Cadell + Gert Driesen + + + + Create an instance of the class with the specified + error number and message. + + The number of the native error. + The message of the native error. + + + Create an instance of the class with the specified + error number and message. + + + + + + Create a new instance of the class for the last Windows error. + + + An instance of the class for the last windows error. + + + + The message for the error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Create a new instance of the class. + + the error number for the native error + + An instance of the class for the specified + error number. + + + + The message for the specified error number is lookup up using the + native Win32 FormatMessage function. + + + + + + Retrieves the message corresponding with a Win32 message identifier. + + Message identifier for the requested message. + + The message corresponding with the specified message identifier. + + + + The message will be searched for in system message-table resource(s) + using the native FormatMessage function. + + + + + + Return error information string + + error information string + + + Return error information string + + + + + + Formats a message string. + + Formatting options, and how to interpret the parameter. + Location of the message definition. + Message identifier for the requested message. + Language identifier for the requested message. + If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . + If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the maximum number of TCHARs that can be stored in the output buffer. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, this parameter specifies the minimum number of TCHARs to allocate for an output buffer. + Pointer to an array of values that are used as insert values in the formatted message. + + + The function requires a message definition as input. The message definition can come from a + buffer passed into the function. It can come from a message table resource in an + already-loaded module. Or the caller can ask the function to search the system's message + table resource(s) for the message definition. The function finds the message definition + in a message table resource based on a message identifier and a language identifier. + The function copies the formatted message text to an output buffer, processing any embedded + insert sequences if requested. + + + To prevent the usage of unsafe code, this stub does not support inserting values in the formatted message. + + + + + If the function succeeds, the return value is the number of TCHARs stored in the output + buffer, excluding the terminating null character. + + + If the function fails, the return value is zero. To get extended error information, + call . + + + + + + Gets the number of the native error. + + + The number of the native error. + + + + Gets the number of the native error. + + + + + + Gets the message of the native error. + + + The message of the native error. + + + + + Gets the message of the native error. + + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance. + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Gets the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current key from the enumerator. + + + Throws an exception because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current value from the enumerator. + + The current value from the enumerator. + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + Gets the current entry from the enumerator. + + + Throws an because the + never has a current entry. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + An always empty . + + + + A singleton implementation of the over a collection + that is empty and not modifiable. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to enforce the singleton pattern. + + + + + + Test if the enumerator can advance, if so advance + + false as the cannot advance. + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will always return false. + + + + + + Resets the enumerator back to the start. + + + + As the enumerator is over an empty collection does nothing. + + + + + + The singleton instance of the . + + + + + Get the singleton instance of the . + + The singleton instance of the . + + + Gets the singleton instance of the . + + + + + + Gets the current object from the enumerator. + + + Throws an because the + never has a current value. + + + + As the enumerator is over an empty collection its + value cannot be moved over a valid position, therefore + will throw an . + + + The collection is empty and + cannot be positioned over a valid location. + + + + A SecurityContext used when a SecurityContext is not required + + + + The is a no-op implementation of the + base class. It is used where a + is required but one has not been provided. + + + Nicko Cadell + + + + Singleton instance of + + + + Singleton instance of + + + + + + Private constructor + + + + Private constructor for singleton pattern. + + + + + + Impersonate this SecurityContext + + State supplied by the caller + null + + + No impersonation is done and null is always returned. + + + + + + Implements log4net's default error handling policy which consists + of emitting a message for the first error in an appender and + ignoring all subsequent errors. + + + + The error message is printed on the standard error output stream. + + + This policy aims at protecting an otherwise working application + from being flooded with error messages when logging fails. + + + Nicko Cadell + Gert Driesen + + + + Default Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + The prefix to use for each message. + + + Initializes a new instance of the class + with the specified prefix. + + + + + + Log an Error + + The error message. + The exception. + The internal error code. + + + Prints the message and the stack trace of the exception on the standard + error output stream. + + + + + + Log an Error + + The error message. + The exception. + + + Prints the message and the stack trace of the exception on the standard + error output stream. + + + + + + Log an error + + The error message. + + + Print a the error message passed as parameter on the standard + error output stream. + + + + + + Flag to indicate if it is the first error + + + + + String to prefix each message with + + + + + Is error logging enabled + + + + Is error logging enabled. Logging is only enabled for the + first error delivered to the . + + + + + + A convenience class to convert property values to specific types. + + + + Utility functions for converting types and parsing values. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Converts a string to a value. + + String to convert. + The default value. + The value of . + + + If is "true", then true is returned. + If is "false", then false is returned. + Otherwise, is returned. + + + + + + Parses a file size into a number. + + String to parse. + The default value. + The value of . + + + Parses a file size of the form: number[KB|MB|GB] into a + long value. It is scaled with the appropriate multiplier. + + + is returned when + cannot be converted to a value. + + + + + + Converts a string to an object. + + The target type to convert to. + The string to convert to an object. + + The object converted from a string or null when the + conversion failed. + + + + Converts a string to an object. Uses the converter registry to try + to convert the string value into the specified target type. + + + + + + Checks if there is an appropriate type conversion from the source type to the target type. + + The type to convert from. + The type to convert to. + true if there is a conversion from the source type to the target type. + + Checks if there is an appropriate type conversion from the source type to the target type. + + + + + + + Converts an object to the target type. + + The object to convert to the target type. + The type to convert to. + The converted object. + + + Converts an object to the target type. + + + + + + Instantiates an object given a class name. + + The fully qualified class name of the object to instantiate. + The class to which the new object should belong. + The object to return in case of non-fulfillment. + + An instance of the or + if the object could not be instantiated. + + + + Checks that the is a subclass of + . If that test fails or the object could + not be instantiated, then is returned. + + + + + + Performs variable substitution in string from the + values of keys found in . + + The string on which variable substitution is performed. + The dictionary to use to lookup variables. + The result of the substitutions. + + + The variable substitution delimiters are ${ and }. + + + For example, if props contains key=value, then the call + + + + string s = OptionConverter.SubstituteVariables("Value of key is ${key}."); + + + + will set the variable s to "Value of key is value.". + + + If no value could be found for the specified key, then substitution + defaults to an empty string. + + + For example, if system properties contains no value for the key + "nonExistentKey", then the call + + + + string s = OptionConverter.SubstituteVariables("Value of nonExistentKey is [${nonExistentKey}]"); + + + + will set s to "Value of nonExistentKey is []". + + + An Exception is thrown if contains a start + delimiter "${" which is not balanced by a stop delimiter "}". + + + + + + Converts the string representation of the name or numeric value of one or + more enumerated constants to an equivalent enumerated object. + + The type to convert to. + The enum string value. + If true, ignore case; otherwise, regard case. + An object of type whose value is represented by . + + + + Most of the work of the class + is delegated to the PatternParser class. + + + + The PatternParser processes a pattern string and + returns a chain of objects. + + + Nicko Cadell + Gert Driesen + + + + Constructor + + The pattern to parse. + + + Initializes a new instance of the class + with the specified pattern string. + + + + + + Parses the pattern into a chain of pattern converters. + + The head of a chain of pattern converters. + + + Parses the pattern into a chain of pattern converters. + + + + + + Build the unified cache of converters from the static and instance maps + + the list of all the converter names + + + Build the unified cache of converters from the static and instance maps + + + + + + Internal method to parse the specified pattern to find specified matches + + the pattern to parse + the converter names to match in the pattern + + + The matches param must be sorted such that longer strings come before shorter ones. + + + + + + Process a parsed literal + + the literal text + + + + Process a parsed converter pattern + + the name of the converter + the optional option for the converter + the formatting info for the converter + + + + Resets the internal state of the parser and adds the specified pattern converter + to the chain. + + The pattern converter to add. + + + + The first pattern converter in the chain + + + + + the last pattern converter in the chain + + + + + The pattern + + + + + Internal map of converter identifiers to converter types + + + + This map overrides the static s_globalRulesRegistry map. + + + + + + Get the converter registry used by this parser + + + The converter registry used by this parser + + + + Get the converter registry used by this parser + + + + + + Sort strings by length + + + + that orders strings by string length. + The longest strings are placed first + + + + + + This class implements a patterned string. + + + + This string has embedded patterns that are resolved and expanded + when the string is formatted. + + + This class functions similarly to the + in that it accepts a pattern and renders it to a string. Unlike the + however the PatternString + does not render the properties of a specific but + of the process in general. + + + The recognized conversion pattern names are: + + + + Conversion Pattern Name + Effect + + + appdomain + + + Used to output the friendly name of the current AppDomain. + + + + + date + + + Used to output the date of the logging event in the local time zone. + To output the date in universal time use the %utcdate pattern. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %date{HH:mm:ss,fff} or + %date{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %date{ISO8601} or %date{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + env + + + Used to output the a specific environment variable. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %env{COMPUTERNAME} would include the value + of the COMPUTERNAME environment variable. + + + The env pattern is not supported on the .NET Compact Framework. + + + + + identity + + + Used to output the user name for the currently active user + (Principal.Identity.Name). + + + + + newline + + + Outputs the platform dependent line separator character or + characters. + + + This conversion pattern name offers the same performance as using + non-portable line separator strings such as "\n", or "\r\n". + Thus, it is the preferred way of specifying a line separator. + + + + + processid + + + Used to output the system process ID for the current process. + + + + + property + + + Used to output a specific context property. The key to + lookup must be specified within braces and directly following the + pattern specifier, e.g. %property{user} would include the value + from the property that is keyed by the string 'user'. Each property value + that is to be included in the log must be specified separately. + Properties are stored in logging contexts. By default + the log4net:HostName property is set to the name of machine on + which the event was originally logged. + + + If no key is specified, e.g. %property then all the keys and their + values are printed in a comma separated list. + + + The properties of an event are combined from a number of different + contexts. These are listed below in the order in which they are searched. + + + + the thread properties + + The that are set on the current + thread. These properties are shared by all events logged on this thread. + + + + the global properties + + The that are set globally. These + properties are shared by all the threads in the AppDomain. + + + + + + + random + + + Used to output a random string of characters. The string is made up of + uppercase letters and numbers. By default the string is 4 characters long. + The length of the string can be specified within braces directly following the + pattern specifier, e.g. %random{8} would output an 8 character string. + + + + + username + + + Used to output the WindowsIdentity for the currently + active user. + + + + + utcdate + + + Used to output the date of the logging event in universal time. + The date conversion + specifier may be followed by a date format specifier enclosed + between braces. For example, %utcdate{HH:mm:ss,fff} or + %utcdate{dd MMM yyyy HH:mm:ss,fff}. If no date format specifier is + given then ISO8601 format is + assumed (). + + + The date format specifier admits the same syntax as the + time pattern string of the . + + + For better results it is recommended to use the log4net date + formatters. These can be specified using one of the strings + "ABSOLUTE", "DATE" and "ISO8601" for specifying + , + and respectively + . For example, + %utcdate{ISO8601} or %utcdate{ABSOLUTE}. + + + These dedicated date formatters perform significantly + better than . + + + + + % + + + The sequence %% outputs a single percent sign. + + + + + + Additional pattern converters may be registered with a specific + instance using or + . + + + See the for details on the + format modifiers supported by the patterns. + + + Nicko Cadell + + + + Internal map of converter identifiers to converter types. + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternString only + + + + + Initialize the global registry + + + + + Default constructor + + + + Initialize a new instance of + + + + + + Constructs a PatternString + + The pattern to use with this PatternString + + + Initialize a new instance of with the pattern specified. + + + + + + Initialize object options + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + + + + Create the used to parse the pattern + + the pattern to parse + The + + + Returns PatternParser used to parse the conversion string. Subclasses + may override this to return a subclass of PatternParser which recognize + custom conversion pattern name. + + + + + + Produces a formatted string as specified by the conversion pattern. + + The TextWriter to write the formatted event to + + + Format the pattern to the . + + + + + + Format the pattern as a string + + the pattern formatted as a string + + + Format the pattern to a string. + + + + + + Add a converter to this PatternString + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternString + + the name of the conversion pattern for this converter + the type of the converter + + + Add a converter to this PatternString + + + + + + Gets or sets the pattern formatting string + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + Wrapper class used to map converter names to converter types + + + + Wrapper class used to map converter names to converter types + + + + + + default constructor + + + + + Gets or sets the name of the conversion pattern + + + The name of the conversion pattern + + + + Gets or sets the name of the conversion pattern + + + + + + Gets or sets the type of the converter + + + The type of the converter + + + + Gets or sets the type of the converter + + + + + + String keyed object map. + + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + String keyed object map that is read only. + + + + This collection is readonly and cannot be modified. + + + While this collection is serializable only member + objects that are serializable will + be serialized along with this collection. + + + Nicko Cadell + Gert Driesen + + + + The Hashtable used to store the properties data + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Copy Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Deserialization constructor + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Initializes a new instance of the class + with serialized data. + + + + + + Gets the key names. + + An array of all the keys. + + + Gets the key names. + + + + + + Test if the dictionary contains a specified key + + the key to look for + true if the dictionary contains the specified key + + + Test if the dictionary contains a specified key + + + + + + Serializes this object into the provided. + + The to populate with data. + The destination for this serialization. + + + Serializes this object into the provided. + + + + + + See + + + + + See + + + + + + See + + + + + + + Remove all properties from the properties collection + + + + + See + + + + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + The hashtable used to store the properties + + + The internal collection used to store the properties + + + + The hashtable used to store the properties + + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + The number of properties in this collection + + + + + See + + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Constructor + + properties to copy + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class + with serialized data. + + The that holds the serialized object data. + The that contains contextual information about the source or destination. + + + Because this class is sealed the serialization constructor is private. + + + + + + Remove the entry with the specified key from this dictionary + + the key for the entry to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + an enumerator + + + Returns a over the contest of this collection. + + + + + + See + + the key to remove + + + Remove the entry with the specified key from this dictionary + + + + + + See + + the key to lookup in the collection + true if the collection contains the specified key + + + Test if this collection contains a specified key. + + + + + + Remove all properties from the properties collection + + + + Remove all properties from the properties collection + + + + + + See + + the key + the value to store for the key + + + Store a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + + + See + + + + + Gets or sets the value of the property with the specified key. + + + The value of the property with the specified key. + + The key of the property to get or set. + + + The property value will only be serialized if it is serializable. + If it cannot be serialized it will be silently ignored if + a serialization operation is performed. + + + + + + See + + + false + + + + This collection is modifiable. This property always + returns false. + + + + + + See + + + The value for the key specified. + + + + Get or set a value for the specified . + + + Thrown if the is not a string + + + + See + + + + + See + + + + + See + + + + + See + + + + + See + + + + + A that ignores the message + + + + This writer is used in special cases where it is necessary + to protect a writer from being closed by a client. + + + Nicko Cadell + + + + Constructor + + the writer to actually write to + + + Create a new ProtectCloseTextWriter using a writer + + + + + + Attach this instance to a different underlying + + the writer to attach to + + + Attach this instance to a different underlying + + + + + + Does not close the underlying output writer. + + + + Does not close the underlying output writer. + This method does nothing. + + + + + + Defines a lock that supports single writers and multiple readers + + + + ReaderWriterLock is used to synchronize access to a resource. + At any given time, it allows either concurrent read access for + multiple threads, or write access for a single thread. In a + situation where a resource is changed infrequently, a + ReaderWriterLock provides better throughput than a simple + one-at-a-time lock, such as . + + + If a platform does not support a System.Threading.ReaderWriterLock + implementation then all readers and writers are serialized. Therefore + the caller must not rely on multiple simultaneous readers. + + + Nicko Cadell + + + + Constructor + + + + Initializes a new instance of the class. + + + + + + Acquires a reader lock + + + + blocks if a different thread has the writer + lock, or if at least one thread is waiting for the writer lock. + + + + + + Decrements the lock count + + + + decrements the lock count. When the count + reaches zero, the lock is released. + + + + + + Acquires the writer lock + + + + This method blocks if another thread has a reader lock or writer lock. + + + + + + Decrements the lock count on the writer lock + + + + ReleaseWriterLock decrements the writer lock count. + When the count reaches zero, the writer lock is released. + + + + + + A that can be and reused + + + + A that can be and reused. + This uses a single buffer for string operations. + + + Nicko Cadell + + + + Create an instance of + + the format provider to use + + + Create an instance of + + + + + + Override Dispose to prevent closing of writer + + flag + + + Override Dispose to prevent closing of writer + + + + + + Reset this string writer so that it can be reused. + + the maximum buffer capacity before it is trimmed + the default size to make the buffer + + + Reset this string writer so that it can be reused. + The internal buffers are cleared and reset. + + + + + + Utility class for system specific information. + + + + Utility class of static methods for system specific information. + + + Nicko Cadell + Gert Driesen + Alexey Solofnenko + + + + Private constructor to prevent instances. + + + + Only static methods are exposed from this type. + + + + + + Initialize default values for private static fields. + + + + Only static methods are exposed from this type. + + + + + + Gets the assembly location path for the specified assembly. + + The assembly to get the location for. + The location of the assembly. + + + This method does not guarantee to return the correct path + to the assembly. If only tries to give an indication as to + where the assembly was loaded from. + + + + + + Gets the fully qualified name of the , including + the name of the assembly from which the was + loaded. + + The to get the fully qualified name for. + The fully qualified name for the . + + + This is equivalent to the Type.AssemblyQualifiedName property, + but this method works on the .NET Compact Framework 1.0 as well as + the full .NET runtime. + + + + + + Gets the short name of the . + + The to get the name for. + The short name of the . + + + The short name of the assembly is the + without the version, culture, or public key. i.e. it is just the + assembly's file name without the extension. + + + Use this rather than Assembly.GetName().Name because that + is not available on the Compact Framework. + + + Because of a FileIOPermission security demand we cannot do + the obvious Assembly.GetName().Name. We are allowed to get + the of the assembly so we + start from there and strip out just the assembly name. + + + + + + Gets the file name portion of the , including the extension. + + The to get the file name for. + The file name of the assembly. + + + Gets the file name portion of the , including the extension. + + + + + + Loads the type specified in the type string. + + A sibling type to use to load the type. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified, it will be loaded from the assembly + containing the specified relative type. If the type is not found in the assembly + then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the + assembly that is directly calling this method. If the type is not found + in the assembly then all the loaded assemblies will be searched for the type. + + + + + + Loads the type specified in the type string. + + An assembly to load the type from. + The name of the type to load. + Flag set to true to throw an exception if the type cannot be loaded. + true to ignore the case of the type name; otherwise, false + The type loaded or null if it could not be loaded. + + + If the type name is fully qualified, i.e. if contains an assembly name in + the type name, the type will be loaded from the system using + . + + + If the type name is not fully qualified it will be loaded from the specified + assembly. If the type is not found in the assembly then all the loaded assemblies + will be searched for the type. + + + + + + Generate a new guid + + A new Guid + + + Generate a new guid + + + + + + Create an + + The name of the parameter that caused the exception + The value of the argument that causes this exception + The message that describes the error + the ArgumentOutOfRangeException object + + + Create a new instance of the class + with a specified error message, the parameter name, and the value + of the argument. + + + The Compact Framework does not support the 3 parameter constructor for the + type. This method provides an + implementation that works for all platforms. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + + + + Lookup an application setting + + the application settings key to lookup + the value for the key, or null + + + Configuration APIs are not supported under the Compact Framework + + + + + + Convert a path into a fully qualified local file path. + + The path to convert. + The fully qualified path. + + + Converts the path specified to a fully + qualified path. If the path is relative it is + taken as relative from the application base + directory. + + + The path specified must be a local file path, a URI is not supported. + + + + + + Creates a new case-insensitive instance of the class with the default initial capacity. + + A new case-insensitive instance of the class with the default initial capacity + + + The new Hashtable instance uses the default load factor, the CaseInsensitiveHashCodeProvider, and the CaseInsensitiveComparer. + + + + + + Gets an empty array of types. + + + + The Type.EmptyTypes field is not available on + the .NET Compact Framework 1.0. + + + + + + Cache the host name for the current machine + + + + + Cache the application friendly name + + + + + Text to output when a null is encountered. + + + + + Text to output when an unsupported feature is requested. + + + + + Start time for the current process. + + + + + Gets the system dependent line terminator. + + + The system dependent line terminator. + + + + Gets the system dependent line terminator. + + + + + + Gets the base directory for this . + + The base directory path for the current . + + + Gets the base directory for this . + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the configuration file for the current . + + The path to the configuration file for the current . + + + The .NET Compact Framework 1.0 does not have a concept of a configuration + file. For this runtime, we use the entry assembly location as the root for + the configuration file name. + + + The value returned may be either a local file path or a URI. + + + + + + Gets the path to the file that first executed in the current . + + The path to the entry assembly. + + + Gets the path to the file that first executed in the current . + + + + + + Gets the ID of the current thread. + + The ID of the current thread. + + + On the .NET framework, the AppDomain.GetCurrentThreadId method + is used to obtain the thread ID for the current thread. This is the + operating system ID for the thread. + + + On the .NET Compact Framework 1.0 it is not possible to get the + operating system thread ID for the current thread. The native method + GetCurrentThreadId is implemented inline in a header file + and cannot be called. + + + On the .NET Framework 2.0 the Thread.ManagedThreadId is used as this + gives a stable id unrelated to the operating system thread ID which may + change if the runtime is using fibers. + + + + + + Get the host name or machine name for the current machine + + + The hostname or machine name + + + + Get the host name or machine name for the current machine + + + The host name () or + the machine name (Environment.MachineName) for + the current machine, or if neither of these are available + then NOT AVAILABLE is returned. + + + + + + Get this application's friendly name + + + The friendly name of this application as a string + + + + If available the name of the application is retrieved from + the AppDomain using AppDomain.CurrentDomain.FriendlyName. + + + Otherwise the file name of the entry assembly is used. + + + + + + Get the start time for the current process. + + + + This is the time at which the log4net library was loaded into the + AppDomain. Due to reports of a hang in the call to System.Diagnostics.Process.StartTime + this is not the start time for the current process. + + + The log4net library should be loaded by an application early during its + startup, therefore this start time should be a good approximation for + the actual start time. + + + Note that AppDomains may be loaded and unloaded within the + same process without the process terminating, however this start time + will be set per AppDomain. + + + + + + Text to output when a null is encountered. + + + + Use this value to indicate a null has been encountered while + outputting a string representation of an item. + + + The default value is (null). This value can be overridden by specifying + a value for the log4net.NullText appSetting in the application's + .config file. + + + + + + Text to output when an unsupported feature is requested. + + + + Use this value when an unsupported feature is requested. + + + The default value is NOT AVAILABLE. This value can be overridden by specifying + a value for the log4net.NotAvailableText appSetting in the application's + .config file. + + + + + + Utility class that represents a format string. + + + + Utility class that represents a format string. + + + Nicko Cadell + + + + Initialise the + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + + + Format the string and arguments + + the formatted string + + + + Replaces the format item in a specified with the text equivalent + of the value of a corresponding instance in a specified array. + A specified parameter supplies culture-specific formatting information. + + An that supplies culture-specific formatting information. + A containing zero or more format items. + An array containing zero or more objects to format. + + A copy of format in which the format items have been replaced by the + equivalent of the corresponding instances of in args. + + + + This method does not throw exceptions. If an exception thrown while formatting the result the + exception and arguments are returned in the result string. + + + + + + Process an error during StringFormat + + + + + Dump the contents of an array into a string builder + + + + + Dump an object to a string + + + + + Implementation of Properties collection for the + + + + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + Nicko Cadell + + + + The thread local data slot to use to store a PropertiesDictionary. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Remove a property + + the key for the entry to remove + + + Remove a property + + + + + + Clear all properties + + + + Clear all properties + + + + + + Get the PropertiesDictionary for this thread. + + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread + + + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doing so. + + + + + + Gets or sets the value of a property + + + The value for the property with the specified key + + + + Gets or sets the value of a property + + + + + + Implementation of Stack for the + + + + Implementation of Stack for the + + + Nicko Cadell + + + + The stack store. + + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Clears all the contextual information held in this stack. + + + + Clears all the contextual information held in this stack. + Only call this if you think that this tread is being reused after + a previous call execution which may not have completed correctly. + You do not need to use this method if you always guarantee to call + the method of the + returned from even in exceptional circumstances, + for example by using the using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + syntax. + + + + + + Removes the top context from this stack. + + The message in the context that was removed from the top of this stack. + + + Remove the top context from this stack, and return + it to the caller. If this stack is empty then an + empty string (not ) is returned. + + + + + + Pushes a new context message into this stack. + + The new context message. + + An that can be used to clean up the context stack. + + + + Pushes a new context onto this stack. An + is returned that can be used to clean up this stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message")) + { + log.Warn("This should have an ThreadContext Stack message"); + } + + + + + + Gets the current context information for this stack. + + The current context information. + + + + Gets the current context information for this stack. + + Gets the current context information + + + Gets the current context information for this stack. + + + + + + Get a portable version of this object + + the portable instance of this object + + + Get a cross thread portable version of this object + + + + + + The number of messages in the stack + + + The current number of messages in the stack + + + + The current number of messages in the stack. That is + the number of times has been called + minus the number of times has been called. + + + + + + Gets and sets the internal stack used by this + + The internal storage stack + + + This property is provided only to support backward compatability + of the . Tytpically the internal stack should not + be modified. + + + + + + Inner class used to represent a single context frame in the stack. + + + + Inner class used to represent a single context frame in the stack. + + + + + + Constructor + + The message for this context. + The parent context in the chain. + + + Initializes a new instance of the class + with the specified message and parent context. + + + + + + Get the message. + + The message. + + + Get the message. + + + + + + Gets the full text of the context down to the root level. + + + The full text of the context down to the root level. + + + + Gets the full text of the context down to the root level. + + + + + + Struct returned from the method. + + + + This struct implements the and is designed to be used + with the pattern to remove the stack frame at the end of the scope. + + + + + + The ThreadContextStack internal stack + + + + + The depth to trim the stack to when this instance is disposed + + + + + Constructor + + The internal stack used by the ThreadContextStack. + The depth to return the stack to when this object is disposed. + + + Initializes a new instance of the class with + the specified stack and return depth. + + + + + + Returns the stack to the correct depth. + + + + Returns the stack to the correct depth. + + + + + + Implementation of Stacks collection for the + + + + Implementation of Stacks collection for the + + + Nicko Cadell + + + + Internal constructor + + + + Initializes a new instance of the class. + + + + + + Gets the named thread context stack + + + The named stack + + + + Gets the named thread context stack + + + + + + Utility class for transforming strings. + + + + Utility class for transforming strings. + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + Write a string to an + + the writer to write to + the string to write + The string to replace non XML compliant chars with + + + The test is escaped either using XML escape entities + or using CDATA sections. + + + + + + Replace invalid XML characters in text string + + the XML text input string + the string to use in place of invalid characters + A string that does not contain invalid XML characters. + + + Certain Unicode code points are not allowed in the XML InfoSet, for + details see: http://www.w3.org/TR/REC-xml/#charsets. + + + This method replaces any illegal characters in the input string + with the mask string specified. + + + + + + Count the number of times that the substring occurs in the text + + the text to search + the substring to find + the number of times the substring occurs in the text + + + The substring is assumed to be non repeating within itself. + + + + + + Impersonate a Windows Account + + + + This impersonates a Windows account. + + + How the impersonation is done depends on the value of . + This allows the context to either impersonate a set of user credentials specified + using username, domain name and password or to revert to the process credentials. + + + + + + Default constructor + + + + Default constructor + + + + + + Initialize the SecurityContext based on the options set. + + + + This is part of the delayed object + activation scheme. The method must + be called on this object after the configuration properties have + been set. Until is called this + object is in an undefined state and must not be used. + + + If any of the configuration properties are modified then + must be called again. + + + The security context will try to Logon the specified user account and + capture a primary token for impersonation. + + + The required , + or properties were not specified. + + + + Impersonate the Windows account specified by the and properties. + + caller provided state + + An instance that will revoke the impersonation of this SecurityContext + + + + Depending on the property either + impersonate a user using credentials supplied or revert + to the process credentials. + + + + + + Create a given the userName, domainName and password. + + the user name + the domain name + the password + the for the account specified + + + Uses the Windows API call LogonUser to get a principal token for the account. This + token is used to initialize the WindowsIdentity. + + + + + + Gets or sets the impersonation mode for this security context + + + The impersonation mode for this security context + + + + Impersonate either a user with user credentials or + revert this thread to the credentials of the process. + The value is one of the + enum. + + + The default value is + + + When the mode is set to + the user's credentials are established using the + , and + values. + + + When the mode is set to + no other properties need to be set. If the calling thread is + impersonating then it will be reverted back to the process credentials. + + + + + + Gets or sets the Windows username for this security context + + + The Windows username for this security context + + + + This property must be set if + is set to (the default setting). + + + + + + Gets or sets the Windows domain name for this security context + + + The Windows domain name for this security context + + + + The default value for is the local machine name + taken from the property. + + + This property must be set if + is set to (the default setting). + + + + + + Sets the password for the Windows account specified by the and properties. + + + The password for the Windows account specified by the and properties. + + + + This property must be set if + is set to (the default setting). + + + + + + The impersonation modes for the + + + + See the property for + details. + + + + + + Impersonate a user using the credentials supplied + + + + + Revert this the thread to the credentials of the process + + + + + Adds to + + + + Helper class to expose the + through the interface. + + + + + + Constructor + + the impersonation context being wrapped + + + Constructor + + + + + + Revert the impersonation + + + + Revert the impersonation + + + + + + The log4net Global Context. + + + + The GlobalContext provides a location for global debugging + information to be stored. + + + The global context has a properties map and these properties can + be included in the output of log messages. The + supports selecting and outputing these properties. + + + By default the log4net:HostName property is set to the name of + the current machine. + + + + + GlobalContext.Properties["hostname"] = Environment.MachineName; + + + + Nicko Cadell + + + + Private Constructor. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + The global context properties instance + + + + + The global properties map. + + + The global properties map. + + + + The global properties map. + + + + + + The log4net Logical Thread Context. + + + + The LogicalThreadContext provides a location for specific debugging + information to be stored. + The LogicalThreadContext properties override any or + properties with the same name. + + + The Logical Thread Context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Logical Thread Context provides a diagnostic context for the current call context. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Logical Thread Context is managed on a per basis. + + + Example of using the thread context properties to store a username. + + LogicalThreadContext.Properties["user"] = userName; + log.Info("This log message has a LogicalThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(LogicalThreadContext.Stacks["LDC"].Push("my context message")) + { + log.Info("This log message has a LogicalThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The LogicalThreadContext properties override any + or properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The logical thread stacks. + + + + + + This class is used by client applications to request logger instances. + + + + This class has static methods that are used by a client to request + a logger instance. The method is + used to retrieve a logger. + + + See the interface for more details. + + + Simple example of logging messages + + ILog log = LogManager.GetLogger("application-log"); + + log.Info("Application Start"); + log.Debug("This is a debug message"); + + if (log.IsDebugEnabled) + { + log.Debug("This is another debug message"); + } + + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + Returns the named logger if it exists. + + Returns the named logger if it exists. + + + + If the named logger exists (in the default repository) then it + returns a reference to the logger, otherwise it returns null. + + + The fully qualified logger name to look for. + The logger found, or null if no logger could be found. + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the specified repository) then it + returns a reference to the logger, otherwise it returns + null. + + + The repository to lookup in. + The fully qualified logger name to look for. + + The logger found, or null if the logger doesn't exist in the specified + repository. + + + + + Returns the named logger if it exists. + + + + If the named logger exists (in the repository for the specified assembly) then it + returns a reference to the logger, otherwise it returns + null. + + + The assembly to use to lookup the repository. + The fully qualified logger name to look for. + + The logger, or null if the logger doesn't exist in the specified + assembly's repository. + + + + Get the currently defined loggers. + + Returns all the currently defined loggers in the default repository. + + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Returns all the currently defined loggers in the specified repository. + + The repository to lookup in. + + The root logger is not included in the returned array. + + All the defined loggers. + + + + Returns all the currently defined loggers in the specified assembly's repository. + + The assembly to use to lookup the repository. + + The root logger is not included in the returned array. + + All the defined loggers. + + + Get or create a logger. + + Retrieves or creates a named logger. + + + + Retrieves a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The name of the logger to retrieve. + The logger with the name specified. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The repository to lookup in. + The name of the logger to retrieve. + The logger with the name specified. + + + + Retrieves or creates a named logger. + + + + Retrieve a logger named as the + parameter. If the named logger already exists, then the + existing instance will be returned. Otherwise, a new instance is + created. + + + By default, loggers do not have a set level but inherit + it from the hierarchy. This is one of the central features of + log4net. + + + The assembly to use to lookup the repository. + The name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Get the logger for the fully qualified name of the type specified. + + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The repository to lookup in. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shorthand for . + + + Gets the logger for the fully qualified name of the type specified. + + The assembly to use to lookup the repository. + The full name of will be used as the name of the logger to retrieve. + The logger with the name specified. + + + + Shuts down the log4net system. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in all the + default repositories. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + Shutdown a logger repository. + + Shuts down the default repository. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + default repository. + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + + + Shuts down the repository for the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The repository to shutdown. + + + + Shuts down the repository specified. + + + + Calling this method will safely close and remove all + appenders in all the loggers including root contained in the + repository. The repository is looked up using + the specified. + + + Some appenders need to be closed before the application exists. + Otherwise, pending logging events might be lost. + + + The shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + The assembly to use to lookup the repository. + + + Reset the configuration of a repository + + Resets all values contained in this repository instance to their defaults. + + + + Resets all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The repository to reset. + + + + Resets all values contained in this repository instance to their defaults. + + + + Reset all values contained in the repository instance to their + defaults. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set to its default "off" value. + + + The assembly to use to lookup the repository to reset. + + + Get the logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Get a logger repository. + + Returns the default instance. + + + + Gets the for the repository specified + by the callers assembly (). + + + The instance for the default repository. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The repository to lookup in. + + + + Returns the default instance. + + The default instance. + + + Gets the for the repository specified + by the argument. + + + The assembly to use to lookup the repository. + + + Create a domain + + Creates a repository with the specified repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + Create a logger repository. + + Creates a repository with the specified repository type. + + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + The created will be associated with the repository + specified such that a call to will return + the same repository instance. + + + + + + Creates a repository with the specified name. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name. + + + + Creates the default type of which is a + object. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique amongst repositories. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository with the specified name and repository type. + + + + The name must be unique. Repositories cannot be redefined. + An will be thrown if the repository already exists. + + + The name of the repository, this must be unique to the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + The specified repository already exists. + + + + Creates a repository for the specified assembly and repository type. + + + + CreateDomain is obsolete. Use CreateRepository instead of CreateDomain. + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Creates a repository for the specified assembly and repository type. + + + + The created will be associated with the repository + specified such that a call to with the + same assembly specified will return the same repository instance. + + + The assembly to use to get the name of the repository. + A that implements + and has a no arg constructor. An instance of this type will be created to act + as the for the repository specified. + The created for the repository. + + + + Gets the list of currently defined repositories. + + + + Get an array of all the objects that have been created. + + + An array of all the known objects. + + + + Looks up the wrapper object for the logger specified. + + The logger to get the wrapper for. + The wrapper for the logger specified. + + + + Looks up the wrapper objects for the loggers specified. + + The loggers to get the wrappers for. + The wrapper objects for the loggers specified. + + + + Create the objects used by + this manager. + + The logger to wrap. + The wrapper for the logger specified. + + + + The wrapper map to use to hold the objects. + + + + + Implementation of Mapped Diagnostic Contexts. + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + The MDC class is similar to the class except that it is + based on a map instead of a stack. It provides mapped + diagnostic contexts. A Mapped Diagnostic Context, or + MDC in short, is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The MDC is managed on a per thread basis. + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Gets the context value identified by the parameter. + + The key to lookup in the MDC. + The string value held for the key, or a null reference if no corresponding value is found. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + If the parameter does not look up to a + previously defined context then null will be returned. + + + + + + Add an entry to the MDC + + The key to store the value under. + The value to store. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Puts a context value (the parameter) as identified + with the parameter into the current thread's + context map. + + + If a value is already defined for the + specified then the value will be replaced. If the + is specified as null then the key value mapping will be removed. + + + + + + Removes the key value mapping for the key specified. + + The key to remove. + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove the specified entry from this thread's MDC + + + + + + Clear all entries in the MDC + + + + + The MDC is deprecated and has been replaced by the . + The current MDC implementation forwards to the ThreadContext.Properties. + + + + Remove all the entries from this thread's MDC + + + + + + Implementation of Nested Diagnostic Contexts. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + A Nested Diagnostic Context, or NDC in short, is an instrument + to distinguish interleaved log output from different sources. Log + output is typically interleaved when a server handles multiple + clients near-simultaneously. + + + Interleaved log output can still be meaningful if each log entry + from different contexts had a distinctive stamp. This is where NDCs + come into play. + + + Note that NDCs are managed on a per thread basis. The NDC class + is made up of static methods that operate on the context of the + calling thread. + + + How to push a message into the context + + using(NDC.Push("my context message")) + { + ... all log calls will have 'my context message' included ... + + } // at the end of the using block the message is automatically removed + + + + Nicko Cadell + Gert Driesen + + + + Initializes a new instance of the class. + + + Uses a private access modifier to prevent instantiation of this class. + + + + + Clears all the contextual information held on the current thread. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Clears the stack of NDC data held on the current thread. + + + + + + Creates a clone of the stack of context information. + + A clone of the context info for this thread. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The results of this method can be passed to the + method to allow child threads to inherit the context of their + parent thread. + + + + + + Inherits the contextual information from another thread. + + The context stack to inherit. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This thread will use the context information from the stack + supplied. This can be used to initialize child threads with + the same contextual information as their parent threads. These + contexts will NOT be shared. Any further contexts that + are pushed onto the stack will not be visible to the other. + Call to obtain a stack to pass to + this method. + + + + + + Removes the top context from the stack. + + + The message in the context that was removed from the top + of the stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Remove the top context from the stack, and return + it to the caller. If the stack is empty then an + empty string (not null) is returned. + + + + + + Pushes a new context message. + + The new context message. + + An that can be used to clean up + the context stack. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Pushes a new context onto the context stack. An + is returned that can be used to clean up the context stack. This + can be easily combined with the using keyword to scope the + context. + + + Simple example of using the Push method with the using keyword. + + using(log4net.NDC.Push("NDC_Message")) + { + log.Warn("This should have an NDC message"); + } + + + + + + Removes the context information for this thread. It is + not required to call this method. + + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + This method is not implemented. + + + + + + Forces the stack depth to be at most . + + The maximum depth of the stack + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + Forces the stack depth to be at most . + This may truncate the head of the stack. This only affects the + stack in the current thread. Also it does not prevent it from + growing, it only sets the maximum depth at the time of the + call. This can be used to return to a known context depth. + + + + + + Gets the current context depth. + + The current context depth. + + + + The NDC is deprecated and has been replaced by the . + The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. + + + + The number of context values pushed onto the context stack. + + + Used to record the current depth of the context. This can then + be restored using the method. + + + + + + + The log4net Thread Context. + + + + The ThreadContext provides a location for thread specific debugging + information to be stored. + The ThreadContext properties override any + properties with the same name. + + + The thread context has a properties map and a stack. + The properties and stack can + be included in the output of log messages. The + supports selecting and outputting these properties. + + + The Thread Context provides a diagnostic context for the current thread. + This is an instrument for distinguishing interleaved log + output from different sources. Log output is typically interleaved + when a server handles multiple clients near-simultaneously. + + + The Thread Context is managed on a per thread basis. + + + Example of using the thread context properties to store a username. + + ThreadContext.Properties["user"] = userName; + log.Info("This log message has a ThreadContext Property called 'user'"); + + + Example of how to push a message into the context stack + + using(ThreadContext.Stacks["NDC"].Push("my context message")) + { + log.Info("This log message has a ThreadContext Stack message that includes 'my context message'"); + + } // at the end of the using block the message is automatically popped + + + + Nicko Cadell + + + + Private Constructor. + + + + Uses a private access modifier to prevent instantiation of this class. + + + + + + The thread context properties instance + + + + + The thread context stacks instance + + + + + The thread properties map + + + The thread properties map + + + + The ThreadContext properties override any + properties with the same name. + + + + + + The thread stacks + + + stack map + + + + The thread local stacks. + + + + + diff --git a/qpid/dotnet/client-010/log.xml b/qpid/dotnet/client-010/log.xml index 12365f7eb8..cda84d7c7b 100644 --- a/qpid/dotnet/client-010/log.xml +++ b/qpid/dotnet/client-010/log.xml @@ -1,26 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/perftest/PerfTest.cs b/qpid/dotnet/client-010/perftest/PerfTest.cs index 97a609ba32..e7b1cb8ecd 100644 --- a/qpid/dotnet/client-010/perftest/PerfTest.cs +++ b/qpid/dotnet/client-010/perftest/PerfTest.cs @@ -1,684 +1,705 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Threading; -using common.org.apache.qpid.transport.util; -using org.apache.qpid.client; -using org.apache.qpid.transport; -using org.apache.qpid.transport.util; -using Plossum.CommandLine; - -namespace PerfTest -{ - [CommandLineManager(ApplicationName = "Qpid Perf Tests", Copyright = "Apache Software Foundation")] - public class Options - { - [CommandLineOption(Description = "Displays this help text")] public bool Help; - - [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] public Boolean Setup; - - [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] public Boolean Control; - - [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] public Boolean Publish; - - [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] public Boolean Subscribe; - - [CommandLineOption(Description = "Test mode: [shared|fanout|topic]", MinOccurs = 0)] - public string Mode - { - get { return _mMode; } - set - { - if (! value.Equals("shared") && ! value.Equals("fanout") && ! value.Equals("topic")) - throw new InvalidOptionValueException( - "The mode must not be shared|fanout|topic", false); - _mMode = value; - } - } - - private string _mMode = "shared"; - - [CommandLineOption(Description = "Specifies the broler name", MinOccurs = 0)] - public string Broker - { - get { return _broker; } - set - { - if (String.IsNullOrEmpty(value)) - throw new InvalidOptionValueException( - "The broker name must not be empty", false); - _broker = value; - } - } - - private string _broker = "localhost"; - - [CommandLineOption(Description = "Specifies the port name", MinOccurs = 0)] - public int Port - { - get { return _port; } - set { _port = value; } - } - - private int _port = 5672; - - #region Publisher - - [CommandLineOption(Description = "Create N publishers.", MinOccurs = 0)] - public int Pubs - { - get { return _pubs; } - set { _pubs = value; } - } - - private int _pubs = 1; - - [CommandLineOption(Description = "Each publisher sends N messages.", MinOccurs = 0)] - public double Count - { - get { return _count; } - set { _count = value; } - } - - private double _count = 5000; - - [CommandLineOption(Description = "Size of messages in bytes.", MinOccurs = 0)] - public long Size - { - get { return _size; } - set { _size = value; } - } - - private long _size = 1024; - - [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] public Boolean Confirm = true; - - [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] public Boolean Durable; - - [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] public Boolean UniqueData; - - [CommandLineOption(Description = "Wait for confirmation of each message before sending the next one.", - MinOccurs = 0)] public Boolean SyncPub; - - [CommandLineOption(Description = ">=0 delay between msg publish.", MinOccurs = 0)] - public double IntervalPub - { - get { return _interval_pub; } - set { _interval_pub = value; } - } - - private double _interval_pub; - - #endregion - - #region Subscriber - - [CommandLineOption(Description = "Create N subscribers.", MinOccurs = 0)] - public int Subs - { - get { return _subs; } - set { _subs = value; } - } - - private int _subs = 1; - - [CommandLineOption(Description = "N>0: Subscriber acks batches of N.\n N==0: Subscriber uses unconfirmed mode", - MinOccurs = 0)] - public int SubAck - { - get { return _suback; } - set { _suback = value; } - } - - private int _suback; - - [CommandLineOption(Description = ">=0 delay between msg consume", MinOccurs = 0)] - public double IntervalSub - { - get { return _interval_sub; } - set { _interval_sub = value; } - } - - private double _interval_sub; - - #endregion - - [CommandLineOption(Description = "Create N queues.", MinOccurs = 0)] - public int Queues - { - get { return _qt; } - set { _qt = value; } - } - - private int _qt = 1; - - [CommandLineOption(Description = "Desired number of iterations of the test.", MinOccurs = 0)] - public int Iterations - { - get { return _iterations; } - set { _iterations = value; } - } - - private int _iterations = 1; - - [CommandLineOption(Description = "If non-zero, the transaction batch size.", MinOccurs = 0)] - public int Tx - { - get { return _tx; } - set { _tx = value; } - } - - private int _tx; - - [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] public Boolean - QueueDurable; - - [CommandLineOption(Description = "Queue policy: count to trigger 'flow to disk'", MinOccurs = 0)] - public double QueueMaxCount - { - get { return _queueMaxCount; } - set { _queueMaxCount = value; } - } - - private double _queueMaxCount; - - [CommandLineOption(Description = "Queue policy: accumulated size to trigger 'flow to disk'", MinOccurs = 0)] - public double QueueMaxSize - { - get { return _queueMaxSize; } - set { _queueMaxSize = value; } - } - - private double _queueMaxSize; - - public double SubQuota - { - get { return _subQuota; } - set { _subQuota = value; } - } - - private double _subQuota; - } - - internal interface Startable - { - void Start(); - } - - public abstract class PerfTestClient : Startable - { - private readonly Client _connection; - private readonly ClientSession _session; - private readonly Options _options; - - public ClientSession Session - { - get { return _session; } - } - - public Options Options - { - get { return _options; } - } - - protected PerfTestClient(Options options) - { - _options = options; - _connection = new Client(); - _connection.connect(options.Broker, options.Port, "test", "guest", "guest"); - _session = _connection.createSession(50000); - } - - public abstract void Start(); - } - - public class SetupTest : PerfTestClient - { - public SetupTest(Options options) - : base(options) - { - } - - private void queueInit(String name, Boolean durable, Dictionary arguments) - { - Session.queueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); - Session.queuePurge(name); - Session.exchangeBind(name, "amq.direct", name); - Session.sync(); - } - - public override void Start() - { - queueInit("pub_start", false, null); - queueInit("pub_done", false, null); - queueInit("sub_ready", false, null); - queueInit("sub_done", false, null); - if (Options.Mode.Equals("shared")) - { - Dictionary settings = new Dictionary(); - if (Options.QueueMaxCount > 0) - settings.Add("qpid.max_count", Options.QueueMaxCount); - if (Options.QueueMaxSize > 0) - settings.Add("qpid.max_size", Options.QueueMaxSize); - for (int i = 0; i < Options.Queues; ++i) - { - string qname = "perftest" + i; - queueInit(qname, Options.Durable || Options.QueueDurable, settings); - } - } - } - } - - public class SubscribeThread : PerfTestClient - { - private readonly string _queue; - - public SubscribeThread(Options options, string key, string exchange) - : base(options) - { - _queue = "perftest" + (new UUID(10, 10)).ToString(); - Session.queueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, - Options.Durable ? Option.DURABLE : Option.NONE); - Session.exchangeBind(_queue, exchange, key); - } - - public SubscribeThread(Options options, string key) - : base(options) - { - _queue = key; - } - - public override void Start() - { - if (Options.Tx > 0) - { - Session.txSelect(); - Session.sync(); - } - CircularBuffer buffer = new CircularBuffer(100); - // Create a listener and subscribe it to the queue named "message_queue" - IMessageListener listener = new SyncListener(buffer); - string dest = "dest" + UUID.randomUUID().ToString(); - Session.attachMessageListener(listener, dest); - Session.messageSubscribe(_queue, dest, - Options.Tx > 0 || Options.SubAck > 0 - ? MessageAcceptMode.EXPLICIT - : MessageAcceptMode.NONE, - MessageAcquireMode.PRE_ACQUIRED, null, 0, null); - // issue credits - Session.messageSetFlowMode(dest, MessageFlowMode.WINDOW); - Session.messageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - - // Notify controller we are ready. - IMessage message = new Message(); - message.DeliveryProperties.setRoutingKey("sub_ready"); - - message.appendData(Encoding.UTF8.GetBytes("ready")); - Session.messageTransfer("amq.direct", message); - - if (Options.Tx > 0) - { - Session.txCommit(); - Session.sync(); - } - - - for (int j = 0; j < Options.Iterations; ++j) - { - - //need to allocate some more credit - Session.messageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); - - RangeSet range = new RangeSet(); - IMessage msg; - DateTime start = DateTime.Now; - for (long i = 0; i < Options.SubQuota; ++i) - { - msg = buffer.Dequeue(); - if (Options.Tx > 0 && ((i + 1)%Options.Tx == 0)) - { - Session.txCommit(); - Session.sync(); - } - if (Options.IntervalSub > 0) - { - Thread.Sleep((int) Options.IntervalSub*1000); - } - range.add(msg.Id); - } - if (Options.Tx > 0 || Options.SubAck > 0) - Session.messageAccept(range); - range.clear(); - if (Options.Tx > 0) - { - Session.txSelect(); - Session.sync(); - } - DateTime end = DateTime.Now; - - // Report to publisher. - message.DeliveryProperties.setRoutingKey("sub_done"); - message.clearData(); - message.appendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); - Session.messageTransfer("amq.direct", message); - if (Options.Tx > 0) - { - Session.txSelect(); - Session.sync(); - } - } - Session.close(); - } - } - - public class SyncListener : IMessageListener - { - private readonly CircularBuffer _buffer; - - public SyncListener(CircularBuffer buffer) - { - _buffer = buffer; - } - - public void messageTransfer(IMessage m) - { - _buffer.Enqueue(m); - } - } - - - public class PublishThread : PerfTestClient - { - private readonly string _exchange; - private readonly string _key; - - public PublishThread(Options options, string key, string exchange) - : base(options) - { - _key = key; - _exchange = exchange; - } - - - public override void Start() - { - byte[] data = new byte[Options.Size]; - // randomly populate data - Random r = new Random(34); - r.NextBytes(data); - IMessage message = new Message(); - message.appendData(data); - - message.DeliveryProperties.setRoutingKey(_key); - - if (Options.Durable) - message.DeliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); - - if (Options.Tx > 0) - { - Session.txSelect(); - Session.sync(); - } - - CircularBuffer buffer = new CircularBuffer(100); - // Create a listener and subscribe it to the queue named "pub_start" - IMessageListener listener = new SyncListener(buffer); - string localQueue = "localQueue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", "pub_start"); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); - if (Options.Tx > 0) - { - Session.txCommit(); - Session.sync(); - } - buffer.Dequeue(); - - for (int j = 0; j < Options.Iterations; ++j) - { - DateTime start = DateTime.Now; - for (long i = 0; i < Options.Count; ++i) - { - Session.messageTransfer(_exchange, message); - - if (Options.SyncPub) - { - Session.sync(); - } - if (Options.Tx > 0 && (i + 1)%Options.Tx == 0) - { - Session.txSelect(); - Session.sync(); - } - if (Options.IntervalPub > 0) - { - Thread.Sleep((int) Options.IntervalSub*1000); - } - } - Session.sync(); - DateTime end = DateTime.Now; - - // Report to publisher. - message.DeliveryProperties.setRoutingKey("pub_done"); - message.clearData(); - double time = end.Subtract(start).TotalMilliseconds; - byte[] rate = BitConverter.GetBytes( Options.Count / time ); - message.appendData(rate); - Session.messageTransfer("amq.direct", message); - if (Options.Tx > 0) - { - Session.txSelect(); - Session.sync(); - } - } - Session.close(); - } - } - - public class Controller : PerfTestClient - { - public Controller(Options options) - : base(options) - { - } - - private void process(int size, string queue) - { - CircularBuffer buffer = new CircularBuffer(100); - IMessageListener listener = new SyncListener(buffer); - string localQueue = "queue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", queue); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); - for (int i = 0; i < size; ++i) - { - buffer.Dequeue(); - } - } - - private double processRate(int size, string queue) - { - CircularBuffer buffer = new CircularBuffer(100); - IMessageListener listener = new SyncListener(buffer); - string localQueue = "queue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", queue); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); - double rate = 0; - RangeSet range = new RangeSet(); - for (int i = 0; i < size; ++i) - { - IMessage m = buffer.Dequeue(); - range.add(m.Id); - BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); - byte[] body = new byte[m.Body.Length - m.Body.Position]; - reader.Read(body, 0, body.Length); - rate += BitConverter.ToDouble(body,0); - } - Session.messageAccept(range); - return rate; - } - - private void send(int size, string queue, string data) - { - IMessage message = new Message(); - message.DeliveryProperties.setRoutingKey(queue); - message.appendData(Encoding.UTF8.GetBytes(data)); - for (int i = 0; i < size; ++i) - { - Session.messageTransfer("amq.direct", message); - } - } - - public override void Start() - { - process(Options.Subs, "sub_ready"); - for (int j = 0; j < Options.Iterations; ++j) - { - DateTime start = DateTime.Now; - send(Options.Pubs, "pub_start", "start"); // Start publishers - double pubrate = processRate(Options.Pubs, "pub_done"); - double subrate = processRate(Options.Subs, "sub_done"); - DateTime end = DateTime.Now; - - double transfers = (Options.Pubs*Options.Count) + (Options.Subs*Options.SubQuota); - double time = end.Subtract(start).TotalSeconds; - double txrate = transfers/time; - double mbytes = (txrate*Options.Size) / (1024 * 1024) ; - - Console.WriteLine("Total: " + transfers + " transfers of " + Options.Size + " bytes in " - + time + " seconds.\n" + - "Publish transfers/sec: " + pubrate * 1000 + "\n" + - "Subscribe transfers/sec: " + subrate * 1000 + "\n" + - "Total transfers/sec: " + txrate + "\n" + - "Total Mbytes/sec: " + mbytes); - Console.WriteLine("done"); - } - - } - } - - - public class PerfTest - { - private static int Main(string[] args) - { - Options options = new Options(); - CommandLineParser parser = new CommandLineParser(options); - parser.Parse(); - if (parser.HasErrors) - { - Console.WriteLine(parser.UsageInfo.GetErrorsAsString(78)); - return -1; - } - if (options.Help) - { - Console.WriteLine(parser.UsageInfo.GetOptionsAsString(78)); - return 0; - } - bool singleProcess = - (!options.Setup && !options.Control && !options.Publish && !options.Subscribe); - if (singleProcess) - { - options.Setup = options.Control = options.Publish = true; - options.Subscribe = true; - } - - - string exchange = "amq.direct"; - switch (options.Mode) - { - case "shared": - options.SubQuota = (options.Pubs*options.Count)/options.Subs; - break; - case "fanout": - options.SubQuota = (options.Pubs*options.Count); - exchange = "amq.fanout"; - break; - case "topic": - options.SubQuota = (options.Pubs*options.Count); - exchange = "amq.topic"; - break; - } - - if (options.Setup) - { - SetupTest setup = new SetupTest(options); - setup.Start(); // Set up queues - } - - Thread contT = null; - if ( options.Control) - { - Controller c = new Controller(options); - contT = new Thread(c.Start); - contT.Start(); - } - - Thread[] publishers = null; - Thread[] subscribers = null; - - // Start pubs/subs for each queue/topic. - for (int i = 0; i < options.Queues; ++i) - { - string key = "perftest" + i; // Queue or topic name. - if (options.Publish) - { - int n = singleProcess ? options.Pubs : 1; - publishers = new Thread[n]; - for (int j = 0; j < n; ++j) - { - PublishThread pt = new PublishThread(options, key, exchange); - publishers[i] = new Thread(pt.Start); - publishers[i].Start(); - } - } - if ( options.Subscribe) - { - int n = singleProcess ? options.Subs : 1; - subscribers = new Thread[n]; - for (int j = 0; j < n; ++j) - { - SubscribeThread st; - if (options.Mode.Equals("shared")) - st = new SubscribeThread(options, key); - else - st = new SubscribeThread(options, key, exchange); - subscribers[i] = new Thread(st.Start); - subscribers[i].Start(); - } - } - } - - if (options.Control) - { - contT.Join(); - } - - - // Wait for started threads. - if (options.Publish) - { - foreach (Thread t in publishers) - { - t.Join(); - } - } - - if (options.Subscribe) - { - foreach (Thread t in subscribers) - { - t.Join(); - } - } - - - return 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.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using common.org.apache.qpid.transport.util; +using org.apache.qpid.client; +using org.apache.qpid.transport; +using org.apache.qpid.transport.util; +using Plossum.CommandLine; + +namespace PerfTest +{ + [CommandLineManager(ApplicationName = "Qpid Perf Tests", Copyright = "Apache Software Foundation")] + public class Options + { + [CommandLineOption(Description = "Displays this help text")] public bool Help; + + [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] public Boolean Setup; + + [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] public Boolean Control; + + [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] public Boolean Publish; + + [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] public Boolean Subscribe; + + [CommandLineOption(Description = "Test mode: [shared|fanout|topic]", MinOccurs = 0)] + public string Mode + { + get { return _mMode; } + set + { + if (! value.Equals("shared") && ! value.Equals("fanout") && ! value.Equals("topic")) + throw new InvalidOptionValueException( + "The mode must not be shared|fanout|topic", false); + _mMode = value; + } + } + + private string _mMode = "shared"; + + [CommandLineOption(Description = "Specifies the broler name", MinOccurs = 0)] + public string Broker + { + get { return _broker; } + set + { + if (String.IsNullOrEmpty(value)) + throw new InvalidOptionValueException( + "The broker name must not be empty", false); + _broker = value; + } + } + + private string _broker = "localhost"; + + [CommandLineOption(Description = "Specifies the port name", MinOccurs = 0)] + public int Port + { + get { return _port; } + set { _port = value; } + } + + private int _port = 5672; + + #region Publisher + + [CommandLineOption(Description = "Create N publishers.", MinOccurs = 0)] + public int Pubs + { + get { return _pubs; } + set { _pubs = value; } + } + + private int _pubs = 1; + + [CommandLineOption(Description = "Each publisher sends N messages.", MinOccurs = 0)] + public double Count + { + get { return _count; } + set { _count = value; } + } + + private double _count = 5000; + + [CommandLineOption(Description = "Size of messages in bytes.", MinOccurs = 0)] + public long Size + { + get { return _size; } + set { _size = value; } + } + + private long _size = 1024; + + [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] public Boolean Confirm = true; + + [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] public Boolean Durable; + + [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] public Boolean UniqueData; + + [CommandLineOption(Description = "Wait for confirmation of each message before sending the next one.", + MinOccurs = 0)] public Boolean SyncPub; + + [CommandLineOption(Description = ">=0 delay between msg publish.", MinOccurs = 0)] + public double IntervalPub + { + get { return _interval_pub; } + set { _interval_pub = value; } + } + + private double _interval_pub; + + #endregion + + #region Subscriber + + [CommandLineOption(Description = "Create N subscribers.", MinOccurs = 0)] + public int Subs + { + get { return _subs; } + set { _subs = value; } + } + + private int _subs = 1; + + [CommandLineOption(Description = "N>0: Subscriber acks batches of N.\n N==0: Subscriber uses unconfirmed mode", + MinOccurs = 0)] + public int SubAck + { + get { return _suback; } + set { _suback = value; } + } + + private int _suback; + + [CommandLineOption(Description = ">=0 delay between msg consume", MinOccurs = 0)] + public double IntervalSub + { + get { return _interval_sub; } + set { _interval_sub = value; } + } + + private double _interval_sub; + + #endregion + + [CommandLineOption(Description = "Create N queues.", MinOccurs = 0)] + public int Queues + { + get { return _qt; } + set { _qt = value; } + } + + private int _qt = 1; + + [CommandLineOption(Description = "Desired number of iterations of the test.", MinOccurs = 0)] + public int Iterations + { + get { return _iterations; } + set { _iterations = value; } + } + + private int _iterations = 1; + + [CommandLineOption(Description = "If non-zero, the transaction batch size.", MinOccurs = 0)] + public int Tx + { + get { return _tx; } + set { _tx = value; } + } + + private int _tx; + + [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] public Boolean + QueueDurable; + + [CommandLineOption(Description = "Queue policy: count to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxCount + { + get { return _queueMaxCount; } + set { _queueMaxCount = value; } + } + + private double _queueMaxCount; + + [CommandLineOption(Description = "Queue policy: accumulated size to trigger 'flow to disk'", MinOccurs = 0)] + public double QueueMaxSize + { + get { return _queueMaxSize; } + set { _queueMaxSize = value; } + } + + private double _queueMaxSize; + + public double SubQuota + { + get { return _subQuota; } + set { _subQuota = value; } + } + + private double _subQuota; + } + + internal interface Startable + { + void Start(); + } + + public abstract class PerfTestClient : Startable + { + private readonly Client _connection; + private readonly ClientSession _session; + private readonly Options _options; + + public ClientSession Session + { + get { return _session; } + } + + public Options Options + { + get { return _options; } + } + + protected PerfTestClient(Options options) + { + _options = options; + _connection = new Client(); + _connection.connect(options.Broker, options.Port, "test", "guest", "guest"); + _session = _connection.createSession(50000); + } + + public abstract void Start(); + } + + public class SetupTest : PerfTestClient + { + public SetupTest(Options options) + : base(options) + { + } + + private void queueInit(String name, Boolean durable, Dictionary arguments) + { + Session.queueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); + Session.queuePurge(name); + Session.exchangeBind(name, "amq.direct", name); + Session.sync(); + } + + public override void Start() + { + queueInit("pub_start", false, null); + queueInit("pub_done", false, null); + queueInit("sub_ready", false, null); + queueInit("sub_done", false, null); + if (Options.Mode.Equals("shared")) + { + Dictionary settings = new Dictionary(); + if (Options.QueueMaxCount > 0) + settings.Add("qpid.max_count", Options.QueueMaxCount); + if (Options.QueueMaxSize > 0) + settings.Add("qpid.max_size", Options.QueueMaxSize); + for (int i = 0; i < Options.Queues; ++i) + { + string qname = "perftest" + i; + queueInit(qname, Options.Durable || Options.QueueDurable, settings); + } + } + } + } + + public class SubscribeThread : PerfTestClient + { + private readonly string _queue; + + public SubscribeThread(Options options, string key, string exchange) + : base(options) + { + _queue = "perftest" + (new UUID(10, 10)).ToString(); + Session.queueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, + Options.Durable ? Option.DURABLE : Option.NONE); + Session.exchangeBind(_queue, exchange, key); + } + + public SubscribeThread(Options options, string key) + : base(options) + { + _queue = key; + } + + public override void Start() + { + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "message_queue" + IMessageListener listener = new SyncListener(buffer); + string dest = "dest" + UUID.randomUUID().ToString(); + Session.attachMessageListener(listener, dest); + Session.messageSubscribe(_queue, dest, + Options.Tx > 0 || Options.SubAck > 0 + ? MessageAcceptMode.EXPLICIT + : MessageAcceptMode.NONE, + MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + // issue credits + Session.messageSetFlowMode(dest, MessageFlowMode.WINDOW); + Session.messageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + + // Notify controller we are ready. + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey("sub_ready"); + + message.appendData(Encoding.UTF8.GetBytes("ready")); + Session.messageTransfer("amq.direct", message); + + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + + + for (int j = 0; j < Options.Iterations; ++j) + { + + //need to allocate some more credit + Session.messageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); + + RangeSet range = new RangeSet(); + IMessage msg; + DateTime start = DateTime.Now; + for (long i = 0; i < Options.SubQuota; ++i) + { + msg = buffer.Dequeue(); + if (Options.Tx > 0 && ((i + 1)%Options.Tx == 0)) + { + Session.txCommit(); + Session.sync(); + } + if (Options.IntervalSub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + range.add(msg.Id); + } + if (Options.Tx > 0 || Options.SubAck > 0) + Session.messageAccept(range); + range.clear(); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("sub_done"); + message.clearData(); + message.appendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class SyncListener : IMessageListener + { + private readonly CircularBuffer _buffer; + + public SyncListener(CircularBuffer buffer) + { + _buffer = buffer; + } + + public void messageTransfer(IMessage m) + { + _buffer.Enqueue(m); + } + } + + + public class PublishThread : PerfTestClient + { + private readonly string _exchange; + private readonly string _key; + + public PublishThread(Options options, string key, string exchange) + : base(options) + { + _key = key; + _exchange = exchange; + } + + + public override void Start() + { + byte[] data = new byte[Options.Size]; + // randomly populate data + Random r = new Random(34); + r.NextBytes(data); + IMessage message = new Message(); + message.appendData(data); + + message.DeliveryProperties.setRoutingKey(_key); + + if (Options.Durable) + message.DeliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); + + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + + CircularBuffer buffer = new CircularBuffer(100); + // Create a listener and subscribe it to the queue named "pub_start" + IMessageListener listener = new SyncListener(buffer); + string localQueue = "localQueue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", "pub_start"); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + if (Options.Tx > 0) + { + Session.txCommit(); + Session.sync(); + } + buffer.Dequeue(); + + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + for (long i = 0; i < Options.Count; ++i) + { + Session.messageTransfer(_exchange, message); + + if (Options.SyncPub) + { + Session.sync(); + } + if (Options.Tx > 0 && (i + 1)%Options.Tx == 0) + { + Session.txSelect(); + Session.sync(); + } + if (Options.IntervalPub > 0) + { + Thread.Sleep((int) Options.IntervalSub*1000); + } + } + Session.sync(); + DateTime end = DateTime.Now; + + // Report to publisher. + message.DeliveryProperties.setRoutingKey("pub_done"); + message.clearData(); + double time = end.Subtract(start).TotalMilliseconds; + byte[] rate = BitConverter.GetBytes( Options.Count / time ); + message.appendData(rate); + Session.messageTransfer("amq.direct", message); + if (Options.Tx > 0) + { + Session.txSelect(); + Session.sync(); + } + } + Session.close(); + } + } + + public class Controller : PerfTestClient + { + public Controller(Options options) + : base(options) + { + } + + private void process(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + for (int i = 0; i < size; ++i) + { + buffer.Dequeue(); + } + } + + private double processRate(int size, string queue) + { + CircularBuffer buffer = new CircularBuffer(100); + IMessageListener listener = new SyncListener(buffer); + string localQueue = "queue-" + UUID.randomUUID().ToString(); + Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.exchangeBind(localQueue, "amq.direct", queue); + Session.attachMessageListener(listener, localQueue); + Session.messageSubscribe(localQueue); + double rate = 0; + RangeSet range = new RangeSet(); + for (int i = 0; i < size; ++i) + { + IMessage m = buffer.Dequeue(); + range.add(m.Id); + BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); + byte[] body = new byte[m.Body.Length - m.Body.Position]; + reader.Read(body, 0, body.Length); + rate += BitConverter.ToDouble(body,0); + } + Session.messageAccept(range); + return rate; + } + + private void send(int size, string queue, string data) + { + IMessage message = new Message(); + message.DeliveryProperties.setRoutingKey(queue); + message.appendData(Encoding.UTF8.GetBytes(data)); + for (int i = 0; i < size; ++i) + { + Session.messageTransfer("amq.direct", message); + } + } + + public override void Start() + { + process(Options.Subs, "sub_ready"); + for (int j = 0; j < Options.Iterations; ++j) + { + DateTime start = DateTime.Now; + send(Options.Pubs, "pub_start", "start"); // Start publishers + double pubrate = processRate(Options.Pubs, "pub_done"); + double subrate = processRate(Options.Subs, "sub_done"); + DateTime end = DateTime.Now; + + double transfers = (Options.Pubs*Options.Count) + (Options.Subs*Options.SubQuota); + double time = end.Subtract(start).TotalSeconds; + double txrate = transfers/time; + double mbytes = (txrate*Options.Size) / (1024 * 1024) ; + + Console.WriteLine("Total: " + transfers + " transfers of " + Options.Size + " bytes in " + + time + " seconds.\n" + + "Publish transfers/sec: " + pubrate * 1000 + "\n" + + "Subscribe transfers/sec: " + subrate * 1000 + "\n" + + "Total transfers/sec: " + txrate + "\n" + + "Total Mbytes/sec: " + mbytes); + Console.WriteLine("done"); + } + + } + } + + + public class PerfTest + { + private static int Main(string[] args) + { + Options options = new Options(); + CommandLineParser parser = new CommandLineParser(options); + parser.Parse(); + if (parser.HasErrors) + { + Console.WriteLine(parser.UsageInfo.GetErrorsAsString(78)); + return -1; + } + if (options.Help) + { + Console.WriteLine(parser.UsageInfo.GetOptionsAsString(78)); + return 0; + } + bool singleProcess = + (!options.Setup && !options.Control && !options.Publish && !options.Subscribe); + if (singleProcess) + { + options.Setup = options.Control = options.Publish = true; + options.Subscribe = true; + } + + + string exchange = "amq.direct"; + switch (options.Mode) + { + case "shared": + options.SubQuota = (options.Pubs*options.Count)/options.Subs; + break; + case "fanout": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.fanout"; + break; + case "topic": + options.SubQuota = (options.Pubs*options.Count); + exchange = "amq.topic"; + break; + } + + if (options.Setup) + { + SetupTest setup = new SetupTest(options); + setup.Start(); // Set up queues + } + + Thread contT = null; + if ( options.Control) + { + Controller c = new Controller(options); + contT = new Thread(c.Start); + contT.Start(); + } + + Thread[] publishers = null; + Thread[] subscribers = null; + + // Start pubs/subs for each queue/topic. + for (int i = 0; i < options.Queues; ++i) + { + string key = "perftest" + i; // Queue or topic name. + if (options.Publish) + { + int n = singleProcess ? options.Pubs : 1; + publishers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + PublishThread pt = new PublishThread(options, key, exchange); + publishers[i] = new Thread(pt.Start); + publishers[i].Start(); + } + } + if ( options.Subscribe) + { + int n = singleProcess ? options.Subs : 1; + subscribers = new Thread[n]; + for (int j = 0; j < n; ++j) + { + SubscribeThread st; + if (options.Mode.Equals("shared")) + st = new SubscribeThread(options, key); + else + st = new SubscribeThread(options, key, exchange); + subscribers[i] = new Thread(st.Start); + subscribers[i].Start(); + } + } + } + + if (options.Control) + { + contT.Join(); + } + + + // Wait for started threads. + if (options.Publish) + { + foreach (Thread t in publishers) + { + t.Join(); + } + } + + if (options.Subscribe) + { + foreach (Thread t in subscribers) + { + t.Join(); + } + } + + + return 0; + } + } +} diff --git a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs index 4ca588786e..7fc98fbf38 100644 --- a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs @@ -1,33 +1,54 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("perftest")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("perftest")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("11b542db-0d57-4a67-8b92-24ac1d4ed4cf")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("perftest")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("perftest")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("11b542db-0d57-4a67-8b92-24ac1d4ed4cf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj index 8f82f195b6..30953d6077 100644 --- a/qpid/dotnet/client-010/perftest/perftest.csproj +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -1,61 +1,82 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} - Exe - Properties - perftest - perftest - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\plossum\C5.dll - - - False - ..\lib\plossum\Plossum CommandLine.dll - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} + Exe + Properties + perftest + perftest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\plossum\C5.dll + + + False + ..\lib\plossum\Plossum CommandLine.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs index 7de372bb29..26a40b1f77 100644 --- a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs @@ -1,35 +1,56 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid Test")] -[assembly: AssemblyDescription("Built from svn revision number: ")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid Test")] -[assembly: AssemblyCopyright("Apache Software Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("3d62cb4f-4353-4eed-9669-3e1bc902081d")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("1.0.0.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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid Test")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid Test")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d62cb4f-4353-4eed-9669-3e1bc902081d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index a947a43a8d..7fa42c73d0 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -1,69 +1,90 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {95CB4C90-7C53-44A9-B11C-96235F158ACA} - Library - Properties - test - Qpid Test - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - False - ..\lib\nunit\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - \ No newline at end of file + + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {95CB4C90-7C53-44A9-B11C-96235F158ACA} + Library + Properties + test + Qpid Test + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + False + ..\lib\nunit\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + diff --git a/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs index 477c21fd40..0d60714528 100644 --- a/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid WCF")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid WCF")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a39d56ec-7d81-48e1-9602-347a3ce6f638")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a39d56ec-7d81-48e1-9602-347a3ce6f638")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs index 24ae32cf77..9ec3a08359 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.Designer.cs @@ -1,164 +1,185 @@ -namespace WindowsFormsBooking -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.comboBox1 = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); - this.button2 = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); - this.SuspendLayout(); - // - // comboBox1 - // - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Items.AddRange(new object[] { - "Hotel", - "Taxi", - "Train", - "Cinema", - "Theater", - "Restaurant"}); - this.comboBox1.Location = new System.Drawing.Point(60, 20); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(76, 21); - this.comboBox1.TabIndex = 0; - this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(23, 20); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(31, 13); - this.label1.TabIndex = 1; - this.label1.Text = "Type"; - // - // numericUpDown1 - // - this.numericUpDown1.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this.numericUpDown1.Location = new System.Drawing.Point(60, 49); - this.numericUpDown1.Maximum = new decimal(new int[] { - 200, - 0, - 0, - 0}); - this.numericUpDown1.Minimum = new decimal(new int[] { - 30, - 0, - 0, - 0}); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(76, 20); - this.numericUpDown1.TabIndex = 2; - this.numericUpDown1.Value = new decimal(new int[] { - 30, - 0, - 0, - 0}); - this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(23, 56); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(31, 13); - this.label2.TabIndex = 3; - this.label2.Text = "Price"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(142, 20); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(40, 49); - this.button1.TabIndex = 4; - this.button1.Text = "Add"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // richTextBox1 - // - this.richTextBox1.ForeColor = System.Drawing.SystemColors.ControlText; - this.richTextBox1.Location = new System.Drawing.Point(27, 113); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(155, 83); - this.richTextBox1.TabIndex = 5; - this.richTextBox1.Text = ""; - // - // button2 - // - this.button2.Location = new System.Drawing.Point(27, 81); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(155, 29); - this.button2.TabIndex = 6; - this.button2.Text = "Receipt"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(211, 211); - this.Controls.Add(this.button2); - this.Controls.Add(this.richTextBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.Controls.Add(this.numericUpDown1); - this.Controls.Add(this.label1); - this.Controls.Add(this.comboBox1); - this.Name = "Form1"; - this.Text = "Booking Client"; - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ComboBox comboBox1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.NumericUpDown numericUpDown1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.RichTextBox richTextBox1; - private System.Windows.Forms.Button button2; - } -} - +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 WindowsFormsBooking +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.button2 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Hotel", + "Taxi", + "Train", + "Cinema", + "Theater", + "Restaurant"}); + this.comboBox1.Location = new System.Drawing.Point(60, 20); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(76, 21); + this.comboBox1.TabIndex = 0; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(23, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Type"; + // + // numericUpDown1 + // + this.numericUpDown1.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericUpDown1.Location = new System.Drawing.Point(60, 49); + this.numericUpDown1.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDown1.Minimum = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(76, 20); + this.numericUpDown1.TabIndex = 2; + this.numericUpDown1.Value = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(23, 56); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(31, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Price"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(142, 20); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(40, 49); + this.button1.TabIndex = 4; + this.button1.Text = "Add"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // richTextBox1 + // + this.richTextBox1.ForeColor = System.Drawing.SystemColors.ControlText; + this.richTextBox1.Location = new System.Drawing.Point(27, 113); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(155, 83); + this.richTextBox1.TabIndex = 5; + this.richTextBox1.Text = ""; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(27, 81); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(155, 29); + this.button2.TabIndex = 6; + this.button2.Text = "Receipt"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(211, 211); + this.Controls.Add(this.button2); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label2); + this.Controls.Add(this.numericUpDown1); + this.Controls.Add(this.label1); + this.Controls.Add(this.comboBox1); + this.Name = "Form1"; + this.Text = "Booking Client"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.Button button2; + } +} + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs index e3ce7e0a3f..ea1a05a8d4 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs @@ -1,74 +1,95 @@ -using System; -using System.ServiceModel; -using System.Windows.Forms; -using org.apache.qpid.wcf.demo; -using org.apache.qpid.wcf.model; - -namespace WindowsFormsBooking -{ - public partial class Form1 : Form - { - private ChannelFactory _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(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; + +namespace WindowsFormsBooking +{ + public partial class Form1 : Form + { + private ChannelFactory _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(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/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs index 25e2cd2624..b616984a54 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs @@ -1,21 +1,42 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - -namespace WindowsFormsBooking -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.Linq; +using System.Windows.Forms; + +namespace WindowsFormsBooking +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs index 5c84747dec..1dbf952552 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Booking Client")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Booking Client")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fc8b1e0e-1ca9-46fe-9aae-b1ed046716b8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Booking Client")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Booking Client")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fc8b1e0e-1ca9-46fe-9aae-b1ed046716b8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs index ef98621391..42f9731a3d 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Resources.Designer.cs @@ -1,71 +1,92 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WindowsFormsBooking.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsBooking.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = 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. + * + */ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsBooking.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsBooking.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs index 028322e275..212fb91438 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/Settings.Designer.cs @@ -1,30 +1,51 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace WindowsFormsBooking.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; - } - } - } -} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.1433 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsBooking.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/wcf/demo/wcfBookingClient/wcBookingClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj index 62144a218c..b3480d6aaa 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj @@ -1,103 +1,124 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {4086B3FE-F745-4DCC-952A-682CAE01F4C9} - WinExe - Properties - WindowsFormsBooking - Booking Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - {B34E21C4-A742-4886-8569-1A89490E093E} - wcfBookingServer - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {4086B3FE-F745-4DCC-952A-682CAE01F4C9} + WinExe + Properties + WindowsFormsBooking + Booking Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + {B34E21C4-A742-4886-8569-1A89490E093E} + wcfBookingServer + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs index 286d8ed354..adcbad66f0 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Booking Server")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Booking Server")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("12ef158b-ac5f-43b3-99f6-e4a4c096d6f8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Booking Server")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Booking Server")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("12ef158b-ac5f-43b3-99f6-e4a4c096d6f8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj index 4b5cbdd9e8..18cfb868d6 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj @@ -1,77 +1,98 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {B34E21C4-A742-4886-8569-1A89490E093E} - Exe - Properties - wcfSession - Booking Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - - 3.0 - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {B34E21C4-A742-4886-8569-1A89490E093E} + Exe + Properties + wcfSession + Booking Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs index 59c03c642a..3f9d11e752 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid WCF Hello Client")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid WCF Hello Client")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f7628695-280a-4689-ac6f-1186177f9a25")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF Hello Client")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF Hello Client")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f7628695-280a-4689-ac6f-1186177f9a25")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj index 9640114524..076c558372 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj @@ -1,65 +1,86 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {A24E27DB-A38D-40C9-9879-8390B68C2F06} - Exe - Properties - wcfHelloClient - Qpid WCF Hello Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.0 - - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {A24E27DB-A38D-40C9-9879-8390B68C2F06} + Exe + Properties + wcfHelloClient + Qpid WCF Hello Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.0 + + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs index 229fd72767..940c10976b 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid WCF Hello Server")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid WCF Hello Server")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("afa87185-f224-4948-904c-b4f3cd19dadb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF Hello Server")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF Hello Server")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("afa87185-f224-4948-904c-b4f3cd19dadb")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj index aa75159b54..468a90bf6b 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj @@ -1,73 +1,94 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} - Exe - Properties - wcfHelloServer - Qpid WCF Hello Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} + Exe + Properties + wcfHelloServer + Qpid WCF Hello Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs index 7236da2e5b..d9e0a5f3d3 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs @@ -1,36 +1,57 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Qpid WCF UpperCase")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Apache Software Foundation")] -[assembly: AssemblyProduct("Qpid WCF UpperCase")] -[assembly: AssemblyCopyright("Copyright © Apache Software Foundation 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("14ba3707-3fcc-4033-8bbc-0db65c5424f3")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Qpid WCF UpperCase")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Qpid WCF UpperCase")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("14ba3707-3fcc-4033-8bbc-0db65c5424f3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj index 36d8d62e88..277c59d179 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj @@ -1,73 +1,94 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {C988F456-1025-486F-9BCD-49C0F83B91DB} - Exe - Properties - wcfRPC - Qpid WCF UpperCase - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.5 - - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {C988F456-1025-486F-9BCD-49C0F83B91DB} + Exe + Properties + wcfRPC + Qpid WCF UpperCase + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + + diff --git a/qpid/dotnet/client-010/wcf/wcf.csproj b/qpid/dotnet/client-010/wcf/wcf.csproj index a294f52be2..4a045e23fe 100644 --- a/qpid/dotnet/client-010/wcf/wcf.csproj +++ b/qpid/dotnet/client-010/wcf/wcf.csproj @@ -1,69 +1,90 @@ - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - Library - Properties - WCF - qpidWCFModel - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\client\bin\Debug\Qpid Client.dll - - - - - 3.0 - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + Library + Properties + WCF + qpidWCFModel + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\client\bin\Debug\Qpid Client.dll + + + + + 3.0 + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From fa2350ca3db41b1ef3041c299f5d8c2cd78c77e0 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Dec 2008 03:12:57 +0000 Subject: Yet another fix for licensing headers git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@727904 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/default.build | 71 ++- qpid/dotnet/client-010/default.build | 527 +++++++++++---------- qpid/dotnet/client-010/demo/default.build | 73 ++- .../direct/example-direct-Listener/default.build | 73 ++- .../direct/example-direct-producer/default.build | 73 ++- .../fanout/example-fanout-Listener/default.build | 73 ++- .../fanout/example-fanout-Producer/default.build | 73 ++- .../pub-sub/example-pub-sub-Listener/default.build | 73 ++- .../example-pub-sub-Publisher/default.build | 73 ++- .../example-request-response-Client/default.build | 73 ++- .../example-request-response-Server/default.build | 73 ++- qpid/dotnet/client-010/perftest/default.build | 79 +-- qpid/dotnet/client-010/test/default.build | 89 ++-- .../client-010/wcf/demo/wcfHelloServer/App.config | 4 +- 14 files changed, 850 insertions(+), 577 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/default.build b/qpid/dotnet/client-010/client/default.build index 16b1532af9..139796a58d 100644 --- a/qpid/dotnet/client-010/client/default.build +++ b/qpid/dotnet/client-010/client/default.build @@ -1,25 +1,46 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index ee3e9387f9..75eadf0a0c 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -1,253 +1,274 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - build.svnversion = ${build.svnversion} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + build.svnversion = ${build.svnversion} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/demo/default.build b/qpid/dotnet/client-010/demo/default.build index 01cad35665..8c64f8c045 100644 --- a/qpid/dotnet/client-010/demo/default.build +++ b/qpid/dotnet/client-010/demo/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build index f684a60990..f611fee6f6 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build index 58ac97b0d0..3382349ae6 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build index cbd5113ae1..bdf5cc80c5 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build index 0eec886470..874854a51b 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build index 564e099f55..ddd3168d08 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build index c85b2672a4..0a9c574d6e 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build index 760419b325..60713af386 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build index d17410a7a9..1a1bea225d 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build @@ -1,26 +1,47 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/perftest/default.build b/qpid/dotnet/client-010/perftest/default.build index a126a8bc86..756f6c6493 100644 --- a/qpid/dotnet/client-010/perftest/default.build +++ b/qpid/dotnet/client-010/perftest/default.build @@ -1,29 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/test/default.build b/qpid/dotnet/client-010/test/default.build index 76b1b3ea85..f9dadb174b 100644 --- a/qpid/dotnet/client-010/test/default.build +++ b/qpid/dotnet/client-010/test/default.build @@ -1,34 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config index 60e7e586be..96b6c90ad8 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config @@ -1,4 +1,4 @@ - + @@ -40,4 +40,4 @@ - \ No newline at end of file + -- cgit v1.2.1 From c35f4cf2f4a46c3f1baa6dc5225dcfb458b6ac07 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Dec 2008 03:27:11 +0000 Subject: Fixed the licensing headers for the following files. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@727909 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/test/test.config | 41 ++++++-- .../client-010/wcf/demo/wcfHelloClient/App.config | 91 +++++++++++------- .../client-010/wcf/demo/wcfHelloServer/App.config | 107 ++++++++++++--------- 3 files changed, 151 insertions(+), 88 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/test/test.config b/qpid/dotnet/client-010/test/test.config index 0499eddfbc..e62da47bb3 100644 --- a/qpid/dotnet/client-010/test/test.config +++ b/qpid/dotnet/client-010/test/test.config @@ -1,10 +1,31 @@ - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config index 3237fb8cc0..f78756dd1c 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config @@ -1,35 +1,56 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config index 96b6c90ad8..de71f890b5 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/App.config @@ -1,43 +1,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1 From de54a16ea46a41ec95cb888dddb7b9e91744ef40 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 19 Dec 2008 18:22:03 +0000 Subject: Added ASF licensing headers to the following files git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@728091 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/Composite.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/Constant.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/Invoker.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/MethodDelegate.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/Option.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/StructFactory.tpl | 23 ++++++++++++++++++++++- qpid/dotnet/client-010/gentool/Type.tpl | 23 ++++++++++++++++++++++- 7 files changed, 154 insertions(+), 7 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl b/qpid/dotnet/client-010/gentool/Composite.tpl index 44f3c1bc44..8f16d20189 100644 --- a/qpid/dotnet/client-010/gentool/Composite.tpl +++ b/qpid/dotnet/client-010/gentool/Composite.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.codec; using System.Collections.Generic; @@ -270,4 +291,4 @@ for f in fields: } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/Constant.tpl b/qpid/dotnet/client-010/gentool/Constant.tpl index 87652b6f7d..191a1dbd6e 100644 --- a/qpid/dotnet/client-010/gentool/Constant.tpl +++ b/qpid/dotnet/client-010/gentool/Constant.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 { @@ -13,4 +34,4 @@ for c in constants: value = c["@value"] out(" public const int $name = $value;\n") }} -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/Invoker.tpl b/qpid/dotnet/client-010/gentool/Invoker.tpl index 96f58b49ea..ca9abacc24 100644 --- a/qpid/dotnet/client-010/gentool/Invoker.tpl +++ b/qpid/dotnet/client-010/gentool/Invoker.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; @@ -43,4 +64,4 @@ for c in composites: } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl index 4c7010d5bb..49891e2b08 100644 --- a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl +++ b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 { @@ -11,4 +32,4 @@ for c in composites: out(" public virtual void $(dromedary(name))(C context, $name mystruct) {}\n") } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/Option.tpl b/qpid/dotnet/client-010/gentool/Option.tpl index ce4c0a3da1..d6e1a44870 100644 --- a/qpid/dotnet/client-010/gentool/Option.tpl +++ b/qpid/dotnet/client-010/gentool/Option.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 { public enum Option { @@ -18,4 +39,4 @@ for c in composites: BATCH, NONE } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/StructFactory.tpl b/qpid/dotnet/client-010/gentool/StructFactory.tpl index 2efa749bbf..2a11e2530c 100644 --- a/qpid/dotnet/client-010/gentool/StructFactory.tpl +++ b/qpid/dotnet/client-010/gentool/StructFactory.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 @@ -40,4 +61,4 @@ for c in composites: } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/gentool/Type.tpl b/qpid/dotnet/client-010/gentool/Type.tpl index 914f320519..c8ec7ac153 100644 --- a/qpid/dotnet/client-010/gentool/Type.tpl +++ b/qpid/dotnet/client-010/gentool/Type.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 @@ -79,4 +100,4 @@ for code in keys: out(" $(codes[code]) = $code,\n") } } -} \ No newline at end of file +} -- cgit v1.2.1 From 8b88af239285ae9a36b07d816384a133d466da2e Mon Sep 17 00:00:00 2001 From: Robert Greig Date: Mon, 5 Jan 2009 20:42:00 +0000 Subject: QPID-1552 Fixes to make the projects compile under VS, and tweak to handle close without an exception. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@731698 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 26 +- .../ExcelAddInMessageProcessor.csproj | 139 +++++----- .../ExcelAddInProducer/ExcelAddInProducer.csproj | 132 ++++------ qpid/dotnet/client-010/client/Client.csproj | 288 ++++----------------- qpid/dotnet/client-010/client/client.sln | 16 +- qpid/dotnet/client-010/client/client.suo | Bin 585728 -> 572416 bytes .../client/transport/network/io/IoReceiver.cs | 10 +- qpid/dotnet/client-010/demo/Demo.csproj | 183 ++++++------- .../demo/Properties/Resources.Designer.cs | 155 +++++------ .../demo/Properties/Settings.Designer.cs | 77 ++---- .../example-direct-Listener.csproj | 121 ++++----- .../example-direct-producer.csproj | 121 ++++----- .../example-fanout-Listener.csproj | 121 ++++----- .../example-fanout-Producer.csproj | 121 ++++----- .../example-pub-sub-Listener.csproj | 121 ++++----- .../example-pub-sub-Publisher.csproj | 121 ++++----- .../example-request-response-Client.csproj | 121 ++++----- .../example-request-response-Server.csproj | 121 ++++----- qpid/dotnet/client-010/perftest/perftest.csproj | 137 +++++----- qpid/dotnet/client-010/test/Test.csproj | 153 +++++------ .../client-010/wcf/demo/wcfBookingClient/Form1.cs | 191 +++++++------- .../wcf/demo/wcfBookingClient/Program.cs | 1 - .../demo/wcfBookingClient/wcBookingClient.csproj | 215 +++++++-------- .../wcf/demo/wcfBookingServer/Booking.cs | 6 +- .../wcf/demo/wcfBookingServer/IBooking.cs | 24 +- .../client-010/wcf/demo/wcfBookingServer/Order.cs | 8 +- .../wcf/demo/wcfBookingServer/Program.cs | 2 +- .../wcf/demo/wcfBookingServer/Receipt.cs | 2 +- .../demo/wcfBookingServer/wcfBookingServer.csproj | 163 +++++------- .../client-010/wcf/demo/wcfHelloClient/App.config | 6 +- .../wcf/demo/wcfHelloClient/HelloClient.cs | 2 +- .../wcf/demo/wcfHelloClient/IHelloService.cs | 2 +- .../client-010/wcf/demo/wcfHelloClient/Program.cs | 2 +- .../wcf/demo/wcfHelloClient/wcfHelloClient.csproj | 139 +++++----- .../wcf/demo/wcfHelloServer/HelloService.cs | 2 +- .../wcf/demo/wcfHelloServer/IHelloService.cs | 2 +- .../client-010/wcf/demo/wcfHelloServer/Program.cs | 2 +- .../wcf/demo/wcfHelloServer/wcfHelloServer.csproj | 149 +++++------ .../client-010/wcf/demo/wcfRPC/IUpperCase.cs | 2 +- qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs | 2 +- .../dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs | 2 +- .../client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 155 +++++------ .../client-010/wcf/model/QpidInputChannel.cs | 21 +- .../client-010/wcf/model/QpidOutputChannel.cs | 2 +- qpid/dotnet/client-010/wcf/wcf.csproj | 149 +++++------ qpid/dotnet/client-010/wcf/wcf.sln | 12 +- qpid/dotnet/client-010/wcf/wcf.suo | Bin 91648 -> 105984 bytes 47 files changed, 1477 insertions(+), 2070 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj index 6f44a998cb..ea2d6b7198 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -1,25 +1,4 @@ - - - + Debug AnyCPU @@ -66,8 +45,7 @@ - - + diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj index f29cb88c11..7929933ef7 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj @@ -1,78 +1,61 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {C2AE83A3-D5D1-469D-8611-A4738B9997CF} - Library - Properties - ExcelAddInMessageProcessor - ExcelAddInMessageProcessor - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - {85EFD719-39F6-4471-90FF-9E621430344B} - ExcelAddIn - - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {C2AE83A3-D5D1-469D-8611-A4738B9997CF} + Library + Properties + ExcelAddInMessageProcessor + ExcelAddInMessageProcessor + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + {85EFD719-39F6-4471-90FF-9E621430344B} + ExcelAddIn + + + + + \ 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 c0e4a03b90..0969c61bd4 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -1,75 +1,57 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {80F00C3B-EB38-4B3B-9F77-68977A30B155} - Exe - Properties - ExcelAddInProducer - Qpid Excel AddIn Producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {80F00C3B-EB38-4B3B-9F77-68977A30B155} + Exe + Properties + ExcelAddInProducer + Qpid Excel AddIn Producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 9e5e5bbe5a..e449781722 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -1,233 +1,55 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {B911FFD7-754F-4735-A188-218D5065BE79} - Library - Properties - client - Qpid Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {B911FFD7-754F-4735-A188-218D5065BE79} + Library + Properties + client + Qpid Client + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + \ 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 f6688b7a09..c94509e72a 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +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}" @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddIn", "..\addins\Exc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInProducer", "..\addins\ExcelAddInProducer\ExcelAddInProducer.csproj", "{80F00C3B-EB38-4B3B-9F77-68977A30B155}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePRocessor", "..\addins\MessagePRocessor\MessagePRocessor.csproj", "{244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}" -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}" @@ -31,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example-fanout-Listener", " 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 @@ -53,10 +53,6 @@ Global {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 - {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {244ACF6F-F632-47B0-9DCE-4C9421AE8EF0}.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 @@ -97,6 +93,10 @@ Global {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 diff --git a/qpid/dotnet/client-010/client/client.suo b/qpid/dotnet/client-010/client/client.suo index 1ccb5725ef..cfdbf4be93 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ 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 e080ee5899..4c59cf0a6c 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -151,12 +151,12 @@ namespace org.apache.qpid.transport.network.io while ((read = m_bufStream.Read(buffer, offset, m_bufferSize - offset)) > 0) { MemoryStream memStream = new MemoryStream(buffer, offset, read); - if(ReceivedBuffer != null) + if (ReceivedBuffer != null) { // call the event payload.Payload = memStream; ReceivedBuffer(this, payload); - } + } offset += read; if (offset > threshold) { @@ -166,8 +166,12 @@ namespace org.apache.qpid.transport.network.io } 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)); diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index 67e687008f..ce326f5822 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -1,99 +1,84 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E4C46FBC-7560-406D-BFEF-CA010E584DF4} - WinExe - Properties - demo - Qpid Demo - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {E4C46FBC-7560-406D-BFEF-CA010E584DF4} + WinExe + Properties + demo + Qpid Demo + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + + \ 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 d635c93dd4..6e11238248 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs @@ -1,92 +1,63 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("demo.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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/Settings.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs index e5d5c38547..467ca52f9f 100644 --- a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs @@ -1,51 +1,26 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace demo.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.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; - } - } - } -} +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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/examples/direct/example-direct-Listener/example-direct-Listener.csproj b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/example-direct-Listener.csproj index 22eed4c79b..3c9ae20af8 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} - Exe - Properties - example_direct_Listener - example-direct-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} + Exe + Properties + example_direct_Listener + example-direct-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 25f8491394..18dcc3a0d6 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {96FCB250-8142-40EE-9BDD-CA839EE21021} - Exe - Properties - example_direct_producer - example-direct-producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {96FCB250-8142-40EE-9BDD-CA839EE21021} + Exe + Properties + example_direct_producer + example-direct-producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 d03f0170f3..c2c8833e34 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} - Exe - Properties - example_fanout_Listener - example-fanout-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} + Exe + Properties + example_fanout_Listener + example-fanout-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 bf5811fbcd..83959fe3af 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {4513BF94-D54A-42FE-8506-FE2CD57B2C51} - Exe - Properties - example_fanout_Producer - example-fanout-Producer - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {4513BF94-D54A-42FE-8506-FE2CD57B2C51} + Exe + Properties + example_fanout_Producer + example-fanout-Producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 ee1a22fc25..0b9d259373 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} - Exe - Properties - example_pub_sub_Listener - example-pub-sub-Listener - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} + Exe + Properties + example_pub_sub_Listener + example-pub-sub-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 4068ac094e..7c47550420 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {F8857634-A134-44E7-A953-F2B22688C599} - Exe - Properties - example_pub_sub_Publisher - example-pub-sub-Publisher - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {F8857634-A134-44E7-A953-F2B22688C599} + Exe + Properties + example_pub_sub_Publisher + example-pub-sub-Publisher + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 2787aa4b6a..c92a920953 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1BC63815-4029-4039-9207-35E7E06ECC99} - Exe - Properties - example_request_response_Client - example-request-response-Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {1BC63815-4029-4039-9207-35E7E06ECC99} + Exe + Properties + example_request_response_Client + example-request-response-Client + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file 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 f35555aed8..be61ddaf01 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,74 +1,59 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {922FBA9C-E483-4AEF-ABE8-AC87421E829B} - Exe - Properties - example_request_response_Server - example-request-response-Server - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {922FBA9C-E483-4AEF-ABE8-AC87421E829B} + Exe + Properties + example_request_response_Server + example-request-response-Server + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ 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 30953d6077..f8fa7aa27c 100644 --- a/qpid/dotnet/client-010/perftest/perftest.csproj +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -1,82 +1,67 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} - Exe - Properties - perftest - perftest - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\plossum\C5.dll - - - False - ..\lib\plossum\Plossum CommandLine.dll - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} + Exe + Properties + perftest + perftest + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\plossum\C5.dll + + + False + ..\lib\plossum\Plossum CommandLine.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ 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 7fa42c73d0..e2680e16bc 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -1,90 +1,75 @@ - - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {95CB4C90-7C53-44A9-B11C-96235F158ACA} - Library - Properties - test - Qpid Test - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - False - ..\lib\nunit\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {95CB4C90-7C53-44A9-B11C-96235F158ACA} + Library + Properties + test + Qpid Test + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + False + ..\lib\nunit\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + - + --> + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs index ea1a05a8d4..86a2f6b774 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.cs @@ -1,95 +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; - -namespace WindowsFormsBooking -{ - public partial class Form1 : Form - { - private ChannelFactory _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(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 _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(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/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs index b616984a54..59189bf600 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Program.cs @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; namespace WindowsFormsBooking diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj index b3480d6aaa..1e096db9d1 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj @@ -1,124 +1,103 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {4086B3FE-F745-4DCC-952A-682CAE01F4C9} - WinExe - Properties - WindowsFormsBooking - Booking Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - {B34E21C4-A742-4886-8569-1A89490E093E} - wcfBookingServer - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4086B3FE-F745-4DCC-952A-682CAE01F4C9} + WinExe + Properties + WindowsFormsBooking + Booking Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + {B34E21C4-A742-4886-8569-1A89490E093E} + wcfBookingServer + + + - + --> + \ 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 8b5e9db760..3f0d37cbe8 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Booking.cs @@ -21,16 +21,16 @@ using System; using System.Collections.Generic; -using System.ServiceModel; +using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.bookingServer { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class Booking : IBooking { private Guid _id; - private List _orders; + private List _orders; public Booking() { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs index 80890617aa..34b6caa1c6 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/IBooking.cs @@ -22,22 +22,22 @@ using System; using System.ServiceModel; -namespace org.apache.qpid.wcf.demo -{ +namespace org.apache.qpid.wcf.demo.bookingServer +{ [ServiceContract(SessionMode=SessionMode.Required)] - public interface IBooking - { - [OperationContract] - void Add(Order order); - - [OperationContract] - Receipt Checkout(); - - Guid Id + 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 c6266366c3..79dfdefdb3 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Order.cs @@ -17,10 +17,10 @@ * specific language governing permissions and limitations * under the License. * -*/ -using System.Runtime.Serialization; - -namespace org.apache.qpid.wcf.demo +*/ +using System.Runtime.Serialization; + +namespace org.apache.qpid.wcf.demo.bookingServer { [DataContract] public sealed class Order diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs index 26e22b5103..cead7edb8c 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Program.cs @@ -26,7 +26,7 @@ using System.Threading; using org.apache.qpid.wcf.model; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.bookingServer { internal class Program { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs index 869fdabe21..655c26a26e 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Receipt.cs @@ -21,7 +21,7 @@ using System.Runtime.Serialization; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.bookingServer { [DataContract] public sealed class Receipt diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj index 18cfb868d6..eae7b2eaa6 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj @@ -1,98 +1,77 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {B34E21C4-A742-4886-8569-1A89490E093E} - Exe - Properties - wcfSession - Booking Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - - 3.0 - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {B34E21C4-A742-4886-8569-1A89490E093E} + Exe + Properties + wcfSession + Booking Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + - + --> + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config index f78756dd1c..1545d71d6f 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/App.config @@ -27,7 +27,7 @@ @@ -37,8 +37,8 @@ + host="localhost" + port="5672" /> diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs index 0158a0b1ab..39889ba28c 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/HelloClient.cs @@ -21,7 +21,7 @@ using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloClient { public class HelloClient : ClientBase, IHelloContract { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs index 5424a931a5..70667c1396 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/IHelloService.cs @@ -21,7 +21,7 @@ using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloClient { [ServiceContract] public interface IHelloContract diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs index 2d6beebfef..0c722708ac 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Program.cs @@ -21,7 +21,7 @@ using System; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloClient { class Program { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj index 076c558372..1f3271f32b 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj @@ -1,86 +1,65 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {A24E27DB-A38D-40C9-9879-8390B68C2F06} - Exe - Properties - wcfHelloClient - Qpid WCF Hello Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.0 - - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {A24E27DB-A38D-40C9-9879-8390B68C2F06} + Exe + Properties + wcfHelloClient + Qpid WCF Hello Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.0 + + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + - + --> + \ 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 7ccec54568..3a4affdc0c 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/HelloService.cs @@ -21,7 +21,7 @@ using System; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloServer { public class HelloService : IHelloContract { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs index 73bad2ab04..860eef3c4a 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/IHelloService.cs @@ -20,7 +20,7 @@ */ using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloServer { [ServiceContract] public interface IHelloContract diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs index f010a8b48c..7a5319fe66 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Program.cs @@ -22,7 +22,7 @@ using System; using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.helloServer { class Program { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj index 468a90bf6b..fa727e00fd 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj @@ -1,94 +1,67 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} - Exe - Properties - wcfHelloServer - Qpid WCF Hello Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} + Exe + Properties + wcfHelloServer + Qpid WCF Hello Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + - + --> + \ 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 10312c6fe6..607a165bdc 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/IUpperCase.cs @@ -20,7 +20,7 @@ */ using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.rpc { [ServiceContract] public interface IUpperCase diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs index 1c15813155..810175df4d 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs @@ -26,7 +26,7 @@ using System.Threading; using org.apache.qpid.wcf.model; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.rpc { internal class Program { diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs index 955b6132e5..f65296fa03 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs @@ -20,7 +20,7 @@ */ using System.ServiceModel; -namespace org.apache.qpid.wcf.demo +namespace org.apache.qpid.wcf.demo.rpc { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public sealed class UpperCase : IUpperCase diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj index 277c59d179..00efe7a6b9 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj @@ -1,94 +1,73 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {C988F456-1025-486F-9BCD-49C0F83B91DB} - Exe - Properties - wcfRPC - Qpid WCF UpperCase - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.5 - - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {C988F456-1025-486F-9BCD-49C0F83B91DB} + Exe + Properties + wcfRPC + Qpid WCF UpperCase + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + - + --> + \ No newline at end of file diff --git a/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs b/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs index 0bf50792cb..3e257a7744 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidInputChannel.cs @@ -26,7 +26,6 @@ using System.ServiceModel; using System.ServiceModel.Channels; using System.Text; using System.Threading; -using client.client; using org.apache.qpid.client; using org.apache.qpid.transport; using org.apache.qpid.transport.util; @@ -59,12 +58,12 @@ namespace org.apache.qpid.wcf.model } - public override Message Receive(TimeSpan timeout) + public override System.ServiceModel.Channels.Message Receive(TimeSpan timeout) { _session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1); _session.sync(); - MessageTransfer m = _queue.Dequeue(); - Message result = null; + IMessage m = _queue.Dequeue(); + System.ServiceModel.Channels.Message result = null; if (m != null) { var reader = new BinaryReader(m.Body, Encoding.UTF8); @@ -97,7 +96,7 @@ namespace org.apache.qpid.wcf.model return result; } - public override bool TryReceive(TimeSpan timeout, out Message message) + public override bool TryReceive(TimeSpan timeout, out System.ServiceModel.Channels.Message message) { message = Receive(timeout); return message != null; @@ -143,7 +142,7 @@ namespace org.apache.qpid.wcf.model } } - internal class WCFListener : MessageListener + internal class WCFListener : IMessageListener { private static readonly Logger _log = Logger.get(typeof (WCFListener)); private readonly BlockingQueue _q; @@ -153,7 +152,7 @@ namespace org.apache.qpid.wcf.model _q = q; } - public void messageTransfer(MessageTransfer m) + public void messageTransfer(IMessage m) { _log.debug("message received by listener"); _q.Enqueue(m); @@ -163,9 +162,9 @@ namespace org.apache.qpid.wcf.model internal class BlockingQueue { private int _count; - private readonly Queue _queue = new Queue(); + private readonly Queue _queue = new Queue(); - public MessageTransfer Dequeue(TimeSpan timeout) + public IMessage Dequeue(TimeSpan timeout) { lock (_queue) { @@ -185,7 +184,7 @@ namespace org.apache.qpid.wcf.model } } - public MessageTransfer Dequeue() + public IMessage Dequeue() { lock (_queue) { @@ -202,7 +201,7 @@ namespace org.apache.qpid.wcf.model } } - public void Enqueue(MessageTransfer data) + public void Enqueue(IMessage data) { if (data != null) { diff --git a/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs b/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs index b88b20fd19..cd580d4ce5 100644 --- a/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs +++ b/qpid/dotnet/client-010/wcf/model/QpidOutputChannel.cs @@ -47,7 +47,7 @@ namespace org.apache.qpid.wcf.model _session = session; } - public override void Send(Message message, TimeSpan timeout) + public override void Send(System.ServiceModel.Channels.Message message, TimeSpan timeout) { if (message.State != MessageState.Closed) { diff --git a/qpid/dotnet/client-010/wcf/wcf.csproj b/qpid/dotnet/client-010/wcf/wcf.csproj index 4a045e23fe..ace42dabd9 100644 --- a/qpid/dotnet/client-010/wcf/wcf.csproj +++ b/qpid/dotnet/client-010/wcf/wcf.csproj @@ -1,90 +1,59 @@ - - - - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - Library - Properties - WCF - qpidWCFModel - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\client\bin\Debug\Qpid Client.dll - - - - - 3.0 - - - - - - - - - - - - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + Library + Properties + WCF + qpidWCFModel + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\client\bin\Debug\Qpid Client.dll + + + + + 3.0 + + + + + + + + + + + + \ 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 2d80874a23..b978f28250 100644 --- a/qpid/dotnet/client-010/wcf/wcf.sln +++ b/qpid/dotnet/client-010/wcf/wcf.sln @@ -1,8 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcf", "wcf.csproj", "{F1D80D9D-FE22-4213-A760-BFFDE7D131DD}" -EndProject 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}" @@ -13,16 +11,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wcBookingClient", "demo\wcf 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 - {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 {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 @@ -43,6 +39,10 @@ Global {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 diff --git a/qpid/dotnet/client-010/wcf/wcf.suo b/qpid/dotnet/client-010/wcf/wcf.suo index 8efca1318e..60339d33e4 100644 Binary files a/qpid/dotnet/client-010/wcf/wcf.suo and b/qpid/dotnet/client-010/wcf/wcf.suo differ -- cgit v1.2.1 From 71eea97e76057db06a69368053fc4af1c19facad Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Wed, 11 Mar 2009 17:20:22 +0000 Subject: Update versions to 0.5 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@752533 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/default.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 75eadf0a0c..3a99354e56 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -30,7 +30,7 @@ - + -- cgit v1.2.1 From 6587e4ae777224625c6d8371f626e6486da16f72 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 19 Jun 2009 20:27:57 +0000 Subject: QPID-1906 - C# QMF console from Bryan Kearney git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@786655 13f79535-47bb-0310-9956-ffa450edef68 --- .../addins/ExcelAddIn/Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../ExcelAddInProducer/Properties/AssemblyInfo.cs | 2 +- .../client-010/client/Properties/AssemblyInfo.cs | 2 +- .../client/transport/codec/AbstractDecoder.cs | 9 +- .../client/transport/codec/AbstractEncoder.cs | 8 +- .../client-010/client/transport/codec/Decoder.cs | 11 +- .../client-010/client/transport/codec/Encoder.cs | 10 +- .../client-010/client/transport/codec/MSDecoder.cs | 30 +- .../client-010/client/transport/codec/MSEncoder.cs | 33 +- .../client/transport/util/ByteEncoder.cs | 25 + qpid/dotnet/client-010/default.build | 1 + .../client-010/demo/Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../management/console/AbstractConsole.cs | 45 ++ qpid/dotnet/client-010/management/console/Agent.cs | 75 ++ .../dotnet/client-010/management/console/Broker.cs | 351 +++++++++ .../client-010/management/console/BrokerURL.cs | 72 ++ .../client-010/management/console/ClassKey.cs | 107 +++ .../client-010/management/console/Console.cs | 46 ++ .../client-010/management/console/MethodResult.cs | 67 ++ .../client-010/management/console/ObjectID.cs | 88 +++ .../client-010/management/console/QMFEvent.cs | 74 ++ .../client-010/management/console/QMFObject.cs | 294 ++++++++ .../management/console/SchemaArgument.cs | 59 ++ .../client-010/management/console/SchemaClass.cs | 141 ++++ .../client-010/management/console/SchemaMethod.cs | 66 ++ .../management/console/SchemaProperty.cs | 59 ++ .../management/console/SchemaStatistic.cs | 54 ++ .../management/console/SchemaVariable.cs | 84 +++ .../management/console/SequenceManager.cs | 62 ++ .../client-010/management/console/Session.cs | 818 +++++++++++++++++++++ qpid/dotnet/client-010/management/console/Util.cs | 150 ++++ .../client-010/management/console/XMLUtil.cs | 106 +++ .../client-010/management/console/console.csproj | 74 ++ .../client-010/management/console/console.sln | 20 + .../management/console/console.userprefs | 42 ++ .../management/console/console.usertasks | 2 + .../client-010/management/console/default.build | 54 ++ .../client-010/perftest/Properties/AssemblyInfo.cs | 2 +- .../client-010/test/Properties/AssemblyInfo.cs | 2 +- qpid/dotnet/client-010/test/test.config | 4 +- .../client-010/wcf/Properties/AssemblyInfo.cs | 4 +- .../wcfBookingClient/Properties/AssemblyInfo.cs | 4 +- .../wcfBookingServer/Properties/AssemblyInfo.cs | 4 +- .../demo/wcfHelloClient/Properties/AssemblyInfo.cs | 4 +- .../demo/wcfHelloServer/Properties/AssemblyInfo.cs | 4 +- .../wcf/demo/wcfRPC/Properties/AssemblyInfo.cs | 4 +- 55 files changed, 3159 insertions(+), 36 deletions(-) create mode 100644 qpid/dotnet/client-010/management/console/AbstractConsole.cs create mode 100644 qpid/dotnet/client-010/management/console/Agent.cs create mode 100644 qpid/dotnet/client-010/management/console/Broker.cs create mode 100644 qpid/dotnet/client-010/management/console/BrokerURL.cs create mode 100644 qpid/dotnet/client-010/management/console/ClassKey.cs create mode 100644 qpid/dotnet/client-010/management/console/Console.cs create mode 100644 qpid/dotnet/client-010/management/console/MethodResult.cs create mode 100644 qpid/dotnet/client-010/management/console/ObjectID.cs create mode 100644 qpid/dotnet/client-010/management/console/QMFEvent.cs create mode 100644 qpid/dotnet/client-010/management/console/QMFObject.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaArgument.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaClass.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaMethod.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaProperty.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaStatistic.cs create mode 100644 qpid/dotnet/client-010/management/console/SchemaVariable.cs create mode 100644 qpid/dotnet/client-010/management/console/SequenceManager.cs create mode 100644 qpid/dotnet/client-010/management/console/Session.cs create mode 100644 qpid/dotnet/client-010/management/console/Util.cs create mode 100644 qpid/dotnet/client-010/management/console/XMLUtil.cs create mode 100644 qpid/dotnet/client-010/management/console/console.csproj create mode 100644 qpid/dotnet/client-010/management/console/console.sln create mode 100644 qpid/dotnet/client-010/management/console/console.userprefs create mode 100644 qpid/dotnet/client-010/management/console/console.usertasks create mode 100644 qpid/dotnet/client-010/management/console/default.build (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs index db5fa500bc..67e95f69a3 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs index f6bef8ac1d..302007674f 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs index edac96cfc4..28fe3427cb 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs index 5ab0be9a99..2b6c525b86 100644 --- a/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/client/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs index 44aecb0933..411813fe99 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs @@ -86,6 +86,13 @@ namespace org.apache.qpid.transport.codec 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(); @@ -389,4 +396,4 @@ namespace org.apache.qpid.transport.codec } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs index c89b96462e..2e5ba56c28 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -115,6 +115,12 @@ namespace org.apache.qpid.transport.codec } } + 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) { @@ -580,4 +586,4 @@ namespace org.apache.qpid.transport.codec } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/codec/Decoder.cs b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs index 207bd60df1..f0de3f61ef 100644 --- a/qpid/dotnet/client-010/client/transport/codec/Decoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/Decoder.cs @@ -38,7 +38,14 @@ namespace org.apache.qpid.transport.codec int readUint16(); long readUint32(); long readUint64(); - + + short readInt8(); + int readInt16(); + long readInt32(); + long readInt64(); + + double readDouble() ; + float readFloat() ; long readDatetime(); UUID readUuid(); @@ -62,4 +69,4 @@ namespace org.apache.qpid.transport.codec Struct readStruct(int type); } -} \ 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 32950ee02e..c071c4cbaf 100644 --- a/qpid/dotnet/client-010/client/transport/codec/Encoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/Encoder.cs @@ -37,6 +37,14 @@ namespace org.apache.qpid.transport.codec 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); @@ -59,4 +67,4 @@ namespace org.apache.qpid.transport.codec void writeStruct(int type, Struct s); } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs index cc8971d38b..68d73232c5 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs @@ -78,5 +78,33 @@ namespace org.apache.qpid.transport.codec { 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() ; + } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs index b2ccbb89ae..127b9c73ba 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs @@ -93,6 +93,37 @@ namespace org.apache.qpid.transport.codec _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; @@ -138,4 +169,4 @@ namespace org.apache.qpid.transport.codec _out.Seek(cur, SeekOrigin.Begin); } } -} \ 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 ac493a9b62..c900e3adae 100644 --- a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -80,6 +80,15 @@ namespace org.apache.qpid.transport.util } return value; } + + public static double GetBigEndian(double value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } /// /// Returns the value encoded in Little Endian (x86, NDR) format. @@ -136,6 +145,15 @@ namespace org.apache.qpid.transport.util } return swapByteOrder(value); } + + public static double GetLittleEndian(double value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } /// /// Swaps the Byte order of an . @@ -187,6 +205,13 @@ namespace org.apache.qpid.transport.util 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/default.build b/qpid/dotnet/client-010/default.build index 3a99354e56..5d6a4c581e 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -40,6 +40,7 @@ + diff --git a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs index 5b993bb917..58c7baf4b4 100644 --- a/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/demo/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs index cfcafd19a2..2fab6a538a 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs index 3ca7a80095..84590e67c1 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs index 6454ae44db..45ff62073e 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs index 3054ba09db..c19bb5b949 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs index 6a1f505206..ef791c6738 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs index fbbe6f04fc..b6d7f3c818 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs index 59c9f10f62..a438acaa1f 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs index 468cdf557a..ba702a28cc 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/management/console/AbstractConsole.cs b/qpid/dotnet/client-010/management/console/AbstractConsole.cs new file mode 100644 index 0000000000..315b2b6d48 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/AbstractConsole.cs @@ -0,0 +1,45 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; + +namespace org.apache.qpid.console +{ + public class AbstractConsole : Console + { + public AbstractConsole(){} + public virtual void NewAgent(Agent agent) {} + public virtual void AgentRemoved(Agent agent) {} + public virtual void BrokerConnected(Broker broker) {} + public virtual void BrokerDisconnected(Broker broker) {} + public virtual void BrokerInformation(Broker broker) {} + public virtual void NewPackage(String packageName) {} + public virtual void NewClass(short kind, ClassKey key) {} + public virtual void ObjectProperties(Broker broker, QMFObject obj) {} + public virtual void ObjectStatistics(Broker broker, QMFObject obj) {} + public virtual void MethodResponse(Broker broker, long seq, MethodResult response) {} + public virtual void EventRecieved(Broker broker, QMFEvent anEvent) {} + public virtual void HearbeatRecieved(Agent agent, long timestamp) {} + public virtual Type TypeMapping(ClassKey key) { + return typeof(QMFObject) ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/Agent.cs b/qpid/dotnet/client-010/management/console/Agent.cs new file mode 100644 index 0000000000..50e2be34fe --- /dev/null +++ b/qpid/dotnet/client-010/management/console/Agent.cs @@ -0,0 +1,75 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using log4net ; + +namespace org.apache.qpid.console +{ + + /** + * Local representation of a remote agent which has been found on the bus. + */ + public class Agent + { + public static ILog log = LogManager.GetLogger(typeof(Agent)) ; + + public Broker Broker {get;set;} + public long BrokerBank {get;set;} + public long AgentBank {get;set;} + public string label {get;set;} + + public Agent(Broker broker, long agentBank, string label) + { + this.Broker = broker ; + this.BrokerBank = broker.BrokerBank() ; + this.AgentBank = agentBank ; + this.label = label ; + } + + public string AgentKey() { + return Agent.AgentKey(AgentBank, BrokerBank) ; + } + + public string RoutingCode() { + return Agent.RoutingCode(AgentBank, BrokerBank) ; + } + + public static string AgentKey(long AgentBank, long BrokerBank) { + return String.Format("{0}:{1}", AgentBank, BrokerBank) ; + } + + public static string RoutingCode(long AgentBank, long BrokerBank) { + return String.Format("agent.{0}.{1}", BrokerBank, AgentBank) ; + } + + public static long getBrokerBank(string routingKey) { + string delim = "." ; + return long.Parse(routingKey.Split(delim.ToCharArray())[2]) ; + } + + public static long getAgentBank(string routingKey) { + string delim = "." ; + return long.Parse(routingKey.Split(delim.ToCharArray())[3]) ; + } + + } +} diff --git a/qpid/dotnet/client-010/management/console/Broker.cs b/qpid/dotnet/client-010/management/console/Broker.cs new file mode 100644 index 0000000000..c1e17abfda --- /dev/null +++ b/qpid/dotnet/client-010/management/console/Broker.cs @@ -0,0 +1,351 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 org.apache.qpid.client ; +using org.apache.qpid.transport ; +using org.apache.qpid.transport.codec ; +using log4net ; + +namespace org.apache.qpid.console +{ + + /** + * Controls all communication with a broker. Works with the session to provide + * synhchronous method calls across the asynchronous QMF bus. + */ + public class Broker : IMessageListener + { + public static ILog log = LogManager.GetLogger(typeof(Broker)) ; + public static int SYNC_TIME = 60000 ; + + public BrokerURL url ; + public Dictionary Agents = new Dictionary() ; + + private Client client ; + private ClientSession clientSession ; + //FIXME This second session should not be needed. There is a bug in the underlieing code. + private ClientSession outSession ; + private int timeout = 50000 ; + private string replyName ; + private string topicName ; + private bool connected = false ; + private bool syncInFlight = false ; + private bool topicBound = false ; + private int reqsOutstanding = 0 ; + private org.apache.qpid.console.Session consoleSession ; + private object lockObject = new Object() ; + + + public Broker(org.apache.qpid.console.Session session, BrokerURL url) + { + log.Debug("Creating a new Broker for url " + url) ; + this.url = url; + consoleSession = session ; + this.TryToConnect() ; + } + + ~Broker() { + if (connected) { + this.Shutdown() ; + } + } + + public int BrokerBank() { + return 1 ; + } + + public bool IsConnected() { + return connected ; + } + + protected void TryToConnect() { + reqsOutstanding = 1 ; + Agent newAgent = new Agent(this,0,"BrokerAgent") ; + Agents.Add(newAgent.AgentKey(), newAgent) ; + client = new Client() ; + client.connect(url.Hostname, url.Port, null, url.AuthName, url.AuthPassword) ; + clientSession = client.createSession(timeout) ; + //clientSession.setAutoSync(false) ; + string name = System.Text.Encoding.UTF8.GetString(clientSession.getName()) ; + replyName = "reply-" + name ; + topicName = "topic-" + name ; + clientSession.setAutoSync(true) ; + Option[] options = new Option[] {Option.EXCLUSIVE, Option.AUTO_DELETE} ; + + // This queue is used for responses to messages which are sent. + clientSession.queueDeclare(replyName,options) ; + clientSession.exchangeBind(replyName,"amq.direct",replyName) ; + clientSession.attachMessageListener(this, "rdest") ; + clientSession.messageSubscribe(replyName,"rdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; + clientSession.messageSetFlowMode("rdest", MessageFlowMode.WINDOW); + clientSession.messageFlow("rdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.messageFlow("rdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + + // This queue is used for unsolicited messages sent to this class. + clientSession.queueDeclare(topicName, options) ; + clientSession.attachMessageListener(this, "tdest") ; + clientSession.messageSubscribe(topicName,"tdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; + clientSession.messageSetFlowMode("tdest", MessageFlowMode.WINDOW); + clientSession.messageFlow("tdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.messageFlow("tdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + + outSession = client.createSession(timeout) ; + outSession.exchangeBind(replyName,"amq.direct",replyName) ; + + connected = true ; + consoleSession.HandleBrokerConnect(this) ; + + + Encoder encoder = CreateEncoder() ; + this.SetHeader(encoder, 'B', 0) ; + this.Send(encoder) ; + } + + public void Shutdown() { + if (connected) { + this.WaitForStable() ; + clientSession.messageStop("rdest") ; + clientSession.messageStop("tdest") ; + clientSession.close() ; + client.close() ; + this.connected = false ; + } + } + + public void UpdateAgent(QMFObject obj) { + long agentBank = (long)obj.GetProperty("agentBank") ; + long brokerBank = (long)obj.GetProperty("brokerBank") ; + String key = Agent.AgentKey(agentBank, brokerBank) ; + if (obj.IsDeleted()) { + if (Agents.ContainsKey(key)) { + Agent agent = Agents[key] ; + Agents.Remove(key) ; + consoleSession.HandleAgentRemoved(agent) ; + } + } + else { + if (! Agents.ContainsKey(key)) { + Agent newAgent = new Agent(this, agentBank, (string)obj.GetProperty("label")) ; + Agents.Add(key, newAgent) ; + consoleSession.HandleNewAgent(newAgent) ; + } + } + } + + public Encoder CreateEncoder() { + return new MSEncoder(1000) ; + } + + + public Encoder CreateEncoder(char opcode, long sequence) { + return SetHeader(this.CreateEncoder(), opcode, sequence) ; + } + + public Encoder SetHeader(Encoder enc, char opcode, long sequence) { + enc.writeUint8((short)'A') ; + enc.writeUint8((short)'M') ; + enc.writeUint8((short)'3') ; + enc.writeUint8((short)opcode) ; + enc.writeUint32(sequence) ; + return enc ; + } + + public Message CreateMessage(Encoder enc) { + return this.CreateMessage(enc, "broker", -1) ; + } + + public Message CreateMessage(Encoder enc, string routingKey) { + return this.CreateMessage(enc, routingKey, -1) ; + } + + public Message CreateMessage(Encoder enc, string routingKey, long ttl) { + Message msg = new Message() ; + msg.Body = ((MSEncoder)enc).segment() ; + msg.DeliveryProperties.setRoutingKey(routingKey) ; + if (-1 != ttl) { + msg.DeliveryProperties.setTtl(ttl) ; + } + msg.MessageProperties.setContentType("x-application/qmf") ; + msg.MessageProperties.setReplyTo(new ReplyTo("amq.direct", replyName)) ; + return msg ; + } + + public void Send(Encoder enc) { + this.Send(this.CreateMessage(enc)) ; + } + + public void Send(Message msg) { + + lock (lockObject) { + log.Debug(String.Format("Sending message to routing key '{0}'", msg.DeliveryProperties.getRoutingKey())) ; + //log.Debug(System.Text.Encoding.UTF8.GetString(msg.Body.ToArray())) ; + outSession.messageTransfer("qpid.management", msg) ; + //clientSession.sync() ; + } + } + + protected bool CheckHeader(Decoder decoder, out char opcode, out long sequence) { + bool returnValue = false ; + opcode = 'x' ; + sequence = -1 ; + if(decoder.hasRemaining()) { + char character = (char) decoder.readUint8() ; + if (character != 'A') { + return returnValue ; + } + character = (char) decoder.readUint8() ; + if (character != 'M') { + return returnValue ; + } + character = (char) decoder.readUint8() ; + if (character != '3') { + return returnValue ; + } + returnValue = true ; + opcode = (char) decoder.readUint8() ; + sequence = decoder.readUint32() ; + } + return returnValue ; + } + + public void messageTransfer(IMessage msg) { + MSDecoder decoder = new MSDecoder() ; + decoder.init(msg.Body) ; + RangeSet rangeSet = new RangeSet() ; + rangeSet.add(msg.Id) ; + char opcode = 'x' ; + long seq = -1 ; + while (this.CheckHeader(decoder, out opcode, out seq)) { + //log.Debug("Message recieved with opcode " + opcode + " and sequence " + seq) ; + //log.Debug(System.Text.Encoding.UTF8.GetString(msg.Body.ToArray())) ; + switch (opcode) { + case 'b': + consoleSession.HandleBrokerResponse(this, decoder, seq) ; + break ; + case 'p': + consoleSession.HandlePackageIndicator(this, decoder, seq) ; + break ; + case 'z': + consoleSession.HandleCommandComplete(this, decoder, seq) ; + break ; + case 'q': + consoleSession.HandleClassIndicator(this, decoder, seq) ; + break ; + case 'm': + consoleSession.HandleMethodResponse(this, decoder, seq) ; + break ; + case 'h': + consoleSession.HandleHeartbeatIndicator(this, decoder, seq, msg) ; + break ; + case 'e': + consoleSession.HandleEventIndicator(this, decoder, seq) ; + break ; + case 's': + consoleSession.HandleSchemaResponse(this, decoder, seq) ; + break ; + case 'c': + consoleSession.HandleContentIndicator(this, decoder, seq, true, false) ; + break ; + case 'i': + consoleSession.HandleContentIndicator(this, decoder, seq, false, true) ; + break ; + case 'g': + consoleSession.HandleContentIndicator(this, decoder, seq, true, true) ; + break ; + default: + log.Error("Invalid message type recieved with opcode " + opcode) ; + break ; + } + } + lock (lockObject) { + outSession.messageAccept(rangeSet) ; + } + } + + public void IncrementOutstanding() { + lock (lockObject) { + this.reqsOutstanding += 1 ; + } + } + + public void DecrementOutstanding() { + lock (lockObject) { + this.reqsOutstanding -= 1 ; + if ((reqsOutstanding == 0) & !topicBound) { + foreach (string key in consoleSession.BindingKeys()) { + //this.clientSession.exchangeBind(topicName, "qpid.mannagement", key) ; + log.Debug("Setting Topic Binding " + key) ; + this.outSession.exchangeBind(topicName, "qpid.management", key) ; + } + topicBound = true ; + } + if ((reqsOutstanding == 0) & syncInFlight) { + syncInFlight = false ; + Monitor.PulseAll(lockObject) ; + } + } + } + + public void WaitForStable() { + lock (lockObject) { + if (connected) { + DateTime start = DateTime.Now ; + syncInFlight = true ; + while (reqsOutstanding != 0) { + log.Debug("Waiting to recieve messages") ; + Monitor.Wait(lockObject,SYNC_TIME) ; + TimeSpan duration = DateTime.Now - start; + if (duration.TotalMilliseconds > SYNC_TIME) { + throw new Exception("Timeout waiting for Broker to Sync") ; + } + } + } + } + } + + public void SetSyncInFlight(bool inFlight) { + lock(lockObject) { + syncInFlight = inFlight ; + Monitor.PulseAll(lockObject) ; + } + } + + public bool GetSyncInFlight() { + return syncInFlight ; + } + + public void WaitForSync(int timeout) { + lock(lockObject) { + DateTime start = DateTime.Now ; + while (syncInFlight) { + Monitor.Wait(lockObject,timeout) ; + } + TimeSpan duration = DateTime.Now - start; + if (duration.TotalMilliseconds > timeout) { + throw new Exception("Timeout waiting for Broker to Sync") ; + } + } + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/BrokerURL.cs b/qpid/dotnet/client-010/management/console/BrokerURL.cs new file mode 100644 index 0000000000..c98c62e41a --- /dev/null +++ b/qpid/dotnet/client-010/management/console/BrokerURL.cs @@ -0,0 +1,72 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Net ; + +namespace org.apache.qpid.console +{ + + /** + * URL which defines the connection to the broker to hook up to the QMF + * Bus. + */ + public class BrokerURL + { + public string Hostname {get;set;} + public int Port {get;set;} + public string AuthName {get;set;} + public string AuthPassword {get;set;} + public string AuthMechanism {get;set;} + protected bool ssl = false ; + + public BrokerURL(string str) + { + Uri uri = new Uri(str) ; + this.Hostname = uri.Host ; + if (uri.Scheme.Equals("amqp")) { + Port=5672 ; + } else { + ssl = true ; + Port=5673 ; + } + + //FIXME Make this more robust + this.AuthName = "guest" ; + this.AuthPassword = "guest" ; + this.AuthMechanism = "PLAIN" ; + } + + public string GetURI() { + return Hostname ; + } + + public override string ToString () + { + if (ssl) { + return String.Format("amqps://{0}:{1}", Hostname, Port) ; + } else { + return String.Format("amqp://{0}:{1}", Hostname, Port) ; + } + } + + } +} diff --git a/qpid/dotnet/client-010/management/console/ClassKey.cs b/qpid/dotnet/client-010/management/console/ClassKey.cs new file mode 100644 index 0000000000..81beb60249 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/ClassKey.cs @@ -0,0 +1,107 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Globalization ; +using org.apache.qpid.transport.util; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Identifies a specific class and version on the bus. + */ + public class ClassKey + { + public string PackageName { get; set; } + public string ClassName { get; set; } + public long[] Hash = new long[4] ; + + public ClassKey(String keyString) { + string delims = ":()" ; + string[] parts = keyString.Split(delims.ToCharArray()) ; + if (parts.Length < 3) { + throw new Exception("Invalid class key format. Format should be package:class(bytes)") ; + } + PackageName = parts[0] ; + ClassName = parts[1] ; + delims = "-" ; + string[] bytes = parts[2].Split(delims.ToCharArray()) ; + if (bytes.Length != 4) { + throw new Exception("Invalid class key format. Bytes should be in the format HEX-HEX-HEX-HEX") ; + } + Hash[0] = long.Parse(bytes[0], NumberStyles.HexNumber) ; + Hash[1] = long.Parse(bytes[1], NumberStyles.HexNumber) ; + Hash[2] = long.Parse(bytes[2], NumberStyles.HexNumber) ; + Hash[3] = long.Parse(bytes[3], NumberStyles.HexNumber) ; + } + + public ClassKey(Decoder dec) { + PackageName = dec.readStr8() ; + ClassName = dec.readStr8() ; + Hash[0] = dec.readUint32() ; + Hash[1] = dec.readUint32() ; + Hash[2] = dec.readUint32() ; + Hash[3] = dec.readUint32() ; + + } + + public string GetKeyString() { + string hashString = GetHashString() ; + return String.Format("{0}:{1}({2})", PackageName, ClassName, hashString) ; + } + + public string GetHashString() { + return String.Format("{0:x8}-{1:x8}-{2:x8}-{3:x8}", (long) Hash[0],Hash[1], Hash[2],Hash[3]) ; + } + + public void encode(Encoder enc) { + enc.writeStr8(PackageName) ; + enc.writeStr8(ClassName) ; + enc.writeUint32(Hash[0]) ; + enc.writeUint32(Hash[1]) ; + enc.writeUint32(Hash[2]) ; + enc.writeUint32(Hash[3]) ; + } + + override public string ToString() { + return String.Format("ClassKey: {0}", GetKeyString()) ; + } + + public override int GetHashCode () + { + return GetKeyString().GetHashCode() ; + } + + public override bool Equals (object obj) + { + if (obj.GetType().Equals(this.GetType())) { + ClassKey other = (ClassKey) obj ; + return (other.GetKeyString().Equals(this.GetKeyString())) ; + } + else { + return false ; + } + } + + } +} diff --git a/qpid/dotnet/client-010/management/console/Console.cs b/qpid/dotnet/client-010/management/console/Console.cs new file mode 100644 index 0000000000..8ff201c676 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/Console.cs @@ -0,0 +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.console +{ + /** + * Callbacks which are exposed by the Session. Clients should create anm implementaiton of this + * for more fine grained interaction with the bus. + */ + public interface Console + { + void NewAgent(Agent agent) ; + void AgentRemoved(Agent agent) ; + void BrokerConnected(Broker broker) ; + void BrokerDisconnected(Broker broker) ; + void BrokerInformation(Broker broker) ; + void NewPackage(String packageName) ; + void NewClass(short kind, ClassKey key) ; + void ObjectProperties(Broker broker, QMFObject obj) ; + void ObjectStatistics(Broker broker, QMFObject obj) ; + void MethodResponse(Broker broker, long seq, MethodResult response) ; + void EventRecieved(Broker broker, QMFEvent anEvent) ; + void HearbeatRecieved(Agent agent, long timestamp) ; + Type TypeMapping(ClassKey key) ; + } +} diff --git a/qpid/dotnet/client-010/management/console/MethodResult.cs b/qpid/dotnet/client-010/management/console/MethodResult.cs new file mode 100644 index 0000000000..7215f5dcbc --- /dev/null +++ b/qpid/dotnet/client-010/management/console/MethodResult.cs @@ -0,0 +1,67 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; + +namespace org.apache.qpid.console +{ + /** + * The result on invoking a method on a managed object + */ + public class MethodResult + { + + public long ReturnCode {get;set;} + public string Text {get;set;} + protected Dictionary ReturnValues ; + + public MethodResult(long aCode, string aMsg, Dictionary args) + { + ReturnCode = aCode ; + Text = aMsg ; + ReturnValues = args ; + } + + public object GetReturnValue(string name) { + object returnValue = null ; + if (ReturnValues.ContainsKey(name)) { + returnValue = ReturnValues[name] ; + } + return returnValue ; + } + + public Dictionary GetReturnValues() { + return ReturnValues ; + } + + public override string ToString() + { + string returnString = "" ; + foreach (KeyValuePair pair in ReturnValues) { + returnString = returnString + String.Format("(Key: '{0}' Value: '{1}')", pair.Key, pair.Value) ; + } + + return string.Format("MethodResult: ReturnCode={0}, Text={1} Values=[{2}]", ReturnCode, Text, returnString); + } + + } +} diff --git a/qpid/dotnet/client-010/management/console/ObjectID.cs b/qpid/dotnet/client-010/management/console/ObjectID.cs new file mode 100644 index 0000000000..af3c161f71 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/ObjectID.cs @@ -0,0 +1,88 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Uniquely identifies an object on the bus. + */ + public class ObjectID + { + + protected long first ; + protected long second ; + + public ObjectID() { + } + + public ObjectID(Decoder dec) + { + first = (long)dec.readUint64() ; + second = (long)dec.readUint64() ; + } + + public ObjectID(long first, long second) { + this.first = first ; + this.second = second ; + } + + public long Flags() { + return (long) ((ulong)this.first & 0xF000000000000000) >> 60 ; + } + + public long Sequence() { + return (long)((ulong)this.first & 0x0FFF000000000000) >> 48 ; + } + + public long BrokerBank() { + return (long)((ulong)this.first & 0x0000FFFFF0000000) >> 28 ; + } + + public long AgentBank() { + return (this.first & 0x000000000FFFFFFF) ; + } + + public long Object() { + return second ; + } + + public bool IsDurable() { + return Sequence() == 0 ; + } + + public void encode(Encoder enc) { + enc.writeUint64((long)first) ; + enc.writeUint64((long)second) ; + } + + override public string ToString() { + return "" + Flags() + "-" + Sequence() + "-" + BrokerBank() + "-" + AgentBank() + "-" + Object() ; + } + + public string RoutingCode() { + return Agent.RoutingCode((long)AgentBank(), (long)BrokerBank()) ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/QMFEvent.cs b/qpid/dotnet/client-010/management/console/QMFEvent.cs new file mode 100644 index 0000000000..1fe6cdb388 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/QMFEvent.cs @@ -0,0 +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.Collections.Generic; +using org.apache.qpid.transport.codec ; + + +namespace org.apache.qpid.console +{ + public enum EventSeverity : short { + EMER = 0 , + ALERT = 1 , + CRIT = 2 , + ERROR = 3 , + WARN = 4 , + NOTIC = 5 , + INFO = 6 , + DEBUG = 7 + } + + /** + * An event raised by an agent on the bus. + */ + public class QMFEvent + { + public Session Session { get;set; } + public ClassKey ClassKey {get;set;} + //FIXME time? + public long Timestamp {get;set;} + public EventSeverity Severity {get;set;} + public Dictionary Arguments {get;set;} + + public QMFEvent(Session session, Decoder dec) + { + Session = session ; + ClassKey = new ClassKey(dec) ; + Timestamp = dec.readInt64() ; + Severity = (EventSeverity) dec.readUint8() ; + SchemaClass sClass = Session.GetSchema(ClassKey) ; + Arguments = new Dictionary() ; + + if (sClass != null) { + foreach (SchemaArgument arg in sClass.Arguments) { + Arguments[arg.Name] = Session.DecodeValue(dec, arg.Type) ; + } + } + } + + public object GetArgument(string argName) { + object returnValue = null ; + Arguments.TryGetValue(argName, out returnValue) ; + return returnValue ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/QMFObject.cs b/qpid/dotnet/client-010/management/console/QMFObject.cs new file mode 100644 index 0000000000..d7141cb371 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/QMFObject.cs @@ -0,0 +1,294 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using log4net ; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * An object which is returned from an agent by the Session. It can have + * methods, properties, and statistics. + */ + public class QMFObject + { + + public static ILog log = LogManager.GetLogger(typeof(QMFObject)) ; + + public Session Session {get;set;} + protected SchemaClass _Schema ; + virtual public SchemaClass Schema {get {return _Schema;} set {_Schema=value;}} + bool Managed ; + public DateTime CurrentTime {get;set;} + public DateTime CreateTime {get;set;} + public DateTime DeleteTime {get;set;} + public ObjectID ObjectID {get;set;} + public Dictionary Properties = new Dictionary() ; + public Dictionary Statistics = new Dictionary() ; + + + // This constructor is the "naked" constructor which creates + // an object without a session or a schema. It is used by + // subclasses which are auto generated + public QMFObject() { + } + + public QMFObject(QMFObject source) { + this.Session = source.Session ; + this.Schema = source.Schema ; + this.Managed = source.Managed ; + this.CurrentTime = source.CurrentTime ; + this.CreateTime = source.CreateTime ; + this.DeleteTime = source.DeleteTime ; + this.ObjectID = source.ObjectID ; + this.Properties = source.Properties ; + this.Statistics = source.Statistics ; + } + + // This constructor is used by a session make object call to + // create a blank object from a schema. + public QMFObject(Session session, SchemaClass schema, bool hasProperties, bool hasStats , bool isManaged) { + Session = session ; + Schema = schema ; + Managed = isManaged ; + + if (hasProperties) { + foreach (SchemaProperty prop in Schema.GetAllProperties()) { + object propValue = null ; + if (!prop.Optional) { + propValue = Util.DefaultValue(prop.Type) ; + } + this.SetProperty(prop.Name, propValue) ; + } + } + + if (hasStats) { + foreach (SchemaStatistic stat in Schema.Statistics) { + SetStatistic(stat.Name, Util.DefaultValue(stat.Type)) ; + } + } + } + + // This constructor is used by the session to create an object based on a data + // stream by the agent. + public QMFObject(Session session, SchemaClass schema, Decoder dec, bool hasProperties, bool hasStats , bool isManaged) + { + Session = session ; + Schema = schema ; + Managed = isManaged ; + + if (Managed) { + // FIXME DateTime or Uint64?? + CurrentTime = new DateTime(dec.readDatetime()) ; + CreateTime = new DateTime(dec.readDatetime()) ; + DeleteTime = new DateTime(dec.readDatetime()) ; + ObjectID = new ObjectID(dec) ; + } + + if (hasProperties) { + List excluded = ProcessPresenceMasks(dec, Schema) ; + + foreach (SchemaProperty prop in Schema.GetAllProperties()) { + if (excluded.Contains(prop.Name)) { + log.Debug(String.Format("Setting Property Default {0}", prop.Name)) ; + safeAddProperty(prop.Name, null) ; + } else { + //log.Debug(String.Format("Setting Property {0}", prop.Name)) ; + safeAddProperty(prop.Name, session.DecodeValue(dec, prop.Type)) ; + } + } + } + + if (hasStats) { + foreach (SchemaStatistic stat in Schema.GetAllStatistics()) { + //log.Debug(String.Format("Setting Statistic {0}", stat.Name)) ; + Statistics.Add(stat.Name, session.DecodeValue(dec, stat.Type)) ; + } + } + + } + + protected List ProcessPresenceMasks(Decoder dec, SchemaClass schema) { + List excludes = new List () ; + short bit = 0 ; + short mask = 0 ; + foreach (SchemaProperty prop in Schema.GetAllProperties()) { + if (prop.Optional) { + //log.Debug(String.Format("Property named {0} is optional", prop.Name)) ; + if (bit == 0) { + mask=dec.readUint8() ; + bit = 1 ; + } + + if ((mask & bit) == 0) { + //log.Debug(String.Format("Property named {0} is not present", prop.Name)) ; + excludes.Add(prop.Name) ; + } + bit *= 2 ; + if (bit == 256) { + bit = 0 ; + } + } + } + return excludes ; + } + + protected List getMethods() { + return Schema.GetAllMethods() ; + } + + public object GetProperty(string attributeName) { + //FIXME any object refs? + object returnValue = null ; + Properties.TryGetValue(attributeName, out returnValue) ; + return returnValue ; + } + + protected void SetStatistic(string attributeName, object newValue) { + Statistics.Remove(attributeName) ; + Statistics.Add(attributeName, newValue) ; + } + + public void SetProperty(string attributeName, object newValue) { + Properties.Remove(attributeName) ; + Properties.Add(attributeName, newValue) ; + } + + public bool IsDeleted() { + return !DeleteTime.Equals(new DateTime(0)) ; + } + + public string RoutingKey() { + return ObjectID.RoutingCode() ; + } + + public long AgentBank() { + return ObjectID.AgentBank() ; + } + + public long BrokerBank() { + return ObjectID.BrokerBank() ; + } + + override public string ToString() { + string propertyString = "" ; + foreach (KeyValuePair pair in Properties) { + propertyString = propertyString + String.Format("(Name: '{0}' Value: '{1}')", pair.Key, pair.Value) ; + } + + string statsString = "" ; + foreach (KeyValuePair sPair in Statistics) { + statsString = statsString + String.Format("(Name: '{0}' Value: '{1}')", sPair.Key, sPair.Value) ; + } + if (Managed) { + return String.Format("Managed QMFObject {0}:{1}({2}) Properties: [{3}] Statistics: [{4}])", Schema.PackageName, Schema.ClassName, ObjectID, propertyString, statsString) ; + } else { + return String.Format("QMFObject {0}:{1} Properties: [{2}] Statistics: [{3}]", Schema.PackageName, Schema.ClassName, propertyString, statsString) ; + } + } + + public MethodResult InvokeMethod(string name, params object[] args) { + return this.InternalInvokeMethod(name, new List(args), true, Broker.SYNC_TIME ) ; + } + + public MethodResult InvokeMethod(string name, int timeToLive, params object[] args) { + return this.InternalInvokeMethod(name, new List(args), true, timeToLive) ; + } + + public MethodResult InvokeMethod(string name, bool synchronous, int timeToLive, params object[] args) { + return this.InternalInvokeMethod(name, new List(args), synchronous, timeToLive ) ; + } + + public MethodResult InvokeMethod(string name, bool synchronous, params object[] args) { + return this.InternalInvokeMethod(name, new List(args), synchronous, Broker.SYNC_TIME) ; + } + + protected MethodResult InternalInvokeMethod(string name, List args, bool synchronous, int timeToLive) { + if (!Managed) { + throw new Exception ("Object is not Managed") ; + } + if (Schema.GetMethod(name) == null) { + throw new Exception (String.Format("Method named '{0}' does not exist", name)) ; + } + return Session.InvokeMethod(this, name, args, synchronous, timeToLive) ; + } + + public void Encode (Encoder enc) { + int mask = 0 ; + int bit = 0 ; + List propsToEncode = new List() ; + log.Debug(String.Format("Encoding class {0}:{1}", Schema.PackageName, Schema.ClassName)) ; + + enc.writeUint8(20) ; + Schema.Key.encode(enc) ; + + foreach (SchemaProperty prop in Schema.GetAllProperties()) { + if (prop.Optional) { + if (bit == 0) { + bit =1 ; + } + if ((Properties.ContainsKey(prop.Name)) && (Properties[prop.Name] != null)) { + mask |= bit ; + propsToEncode.Add(prop) ; + } else { + } + bit = bit << 1 ; + if (bit == 256) { + bit = 0 ; + enc.writeUint8((short)mask) ; + mask = 0 ; + } + } else { + propsToEncode.Add(prop) ; + } + } + if (bit != 0) { + enc.writeUint8((short)mask) ; + } + + foreach (SchemaProperty prop in propsToEncode) { + object obj = Properties[prop.Name] ; + //log.Debug(String.Format("Encoding property {0}", prop.Name)) ; + Session.EncodeValue(enc, prop.Type, obj) ; + } + foreach (SchemaStatistic stat in Schema.Statistics) { + object obj = Statistics[stat.Name] ; + Session.EncodeValue(enc, stat.Type, obj) ; + } + log.Debug("Done") ; + + } + + + protected void safeAddProperty(string propName, object value) { + if (Properties.ContainsKey(propName)) { + Properties[propName] = value ; + } else { + Properties.Add(propName, value) ; + } + } + + + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/SchemaArgument.cs b/qpid/dotnet/client-010/management/console/SchemaArgument.cs new file mode 100644 index 0000000000..e1ace84fe0 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaArgument.cs @@ -0,0 +1,59 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata that describes the mapping of a method parameter to a QMF Object + */ + public class SchemaArgument : SchemaVariable + { + + public string Direction {get;set;} + + public SchemaArgument(Decoder dec, bool methodArg) + { + Dictionary map = dec.readMap() ; + base.PopulateData(map) ; + + if (map.ContainsKey("dir")) { + Direction = (string) map["dir"] ; + } + } + + public bool IsInput() { + return Direction.Equals("I") | Direction.Equals("IO") ; + } + + public bool IsOutput() { + return Direction.Equals("O") | Direction.Equals("IO") ; + } + + public bool IsBidirectional() { + return Direction.Equals("IO") ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SchemaClass.cs b/qpid/dotnet/client-010/management/console/SchemaClass.cs new file mode 100644 index 0000000000..7d49accf61 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaClass.cs @@ -0,0 +1,141 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; +using org.apache.qpid.transport.codec ; + +using log4net ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata that describes the mapping of a class to a QMF Object + */ + public class SchemaClass + { + public static int CLASS_KIND_TABLE = 1 ; + public static int CLASS_KIND_EVENT = 2 ; + + public static ILog log = LogManager.GetLogger(typeof(SchemaClass)) ; + + + public ClassKey Key {get;set;} + public ClassKey SuperType {get;set;} + public int Kind {get;set;} + public List Methods = new List() ; + public List Arguments = new List() ; + public List Properties = new List() ; + public List Statistics = new List() ; + + public string ClassName { get { return Key.ClassName;}} + public string PackageName { get { return Key.PackageName;}} + public string ClassKeyString { get { return Key.GetKeyString();}} + + protected Session Session {get;set;} + + public SchemaClass(int kind, ClassKey key, Decoder dec, Session session) + { + log.Debug(String.Format("New schema class {0}", key)) ; + Kind = kind ; + Session = session ; + this.Key = key ; + bool hasSupertype = !(dec.readUint8().Equals(0)) ; + + if (kind == CLASS_KIND_TABLE) { + int propCount = dec.readUint16() ; + int statCount = dec.readUint16() ; + int methodCount = dec.readUint16() ; + + if (hasSupertype) { + SuperType = new ClassKey(dec) ; + } + + for(int x = 0 ; x < propCount ; x++) { + Properties.Add(new SchemaProperty(dec)) ; + } + for(int x = 0 ; x < statCount ; x++) { + Statistics.Add(new SchemaStatistic(dec)) ; + } + for(int x = 0 ; x < methodCount ; x++) { + Methods.Add(new SchemaMethod(dec)) ; + } + } + + if (kind == CLASS_KIND_EVENT) { + int argCount = dec.readUint16() ; + if (hasSupertype) { + SuperType = new ClassKey(dec) ; + } + for(int x = 0 ; x < argCount ; x++) { + Arguments.Add(new SchemaArgument(dec, false)) ; + } + } + } + + public SchemaMethod GetMethod(string name) { + SchemaMethod returnValue = null ; + foreach(SchemaMethod method in Methods) { + if (method.Name.Equals(name)) { + returnValue = method ; + break ; + } + } + return returnValue ; + } + + public List GetAllProperties() { + if (SuperType == null) { + return Properties ; + } else { + List allProperties = new List(Properties) ; + allProperties.AddRange(Session.GetSchema(SuperType).GetAllProperties()) ; + return allProperties ; + } + } + + public List GetAllStatistics() { + if (SuperType == null) { + return Statistics ; + } else { + List allStats = new List(Statistics) ; + allStats.AddRange(Session.GetSchema(SuperType).GetAllStatistics()) ; + return allStats ; + } + } + + public List GetAllMethods() { + if (SuperType == null) { + return Methods ; + } else { + List allMethods = new List(Methods) ; + allMethods.AddRange(Session.GetSchema(SuperType).GetAllMethods()) ; + return allMethods ; + } + } + + public bool HasSuperType() { + return SuperType != null ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SchemaMethod.cs b/qpid/dotnet/client-010/management/console/SchemaMethod.cs new file mode 100644 index 0000000000..0410234741 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaMethod.cs @@ -0,0 +1,66 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using org.apache.qpid.transport; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata that describes the mapping of a method to a QMF Object + */ + public class SchemaMethod + { + public string Name {get;set;} + public int ArgCount {get;set;} + public int InputArgCount {get;set;} + public int OutputArgCount {get;set;} + public int BidirectionalArgCount {get;set;} + public string Description {get;set;} + public List Arguments = new List(); + + public SchemaMethod(Decoder dec) + { + Dictionary map = dec.readMap() ; + Name = (string) map["name"] ; + ArgCount = (int) map["argCount"] ; + if (map.ContainsKey("desc")) { + Description = (string) map["desc"] ; + } + for (int x = 0 ; x < ArgCount ; x++) { + SchemaArgument arg = new SchemaArgument(dec, true) ; + Arguments.Add(arg) ; + if (arg.IsInput()) { + InputArgCount += 1 ; + } + if (arg.IsOutput()) { + OutputArgCount += 1 ; + } + if (arg.IsBidirectional()) { + BidirectionalArgCount += 1 ; + } + } + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SchemaProperty.cs b/qpid/dotnet/client-010/management/console/SchemaProperty.cs new file mode 100644 index 0000000000..80be5bd6fb --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaProperty.cs @@ -0,0 +1,59 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata that describes the mapping of an object property to a QMF Object + */ + public class SchemaProperty : SchemaVariable + { + public int Access {get;set;} + public bool Index {get;set;} + public bool Optional {get;set;} + + public SchemaProperty(Decoder dec) + { + Dictionary map = dec.readMap() ; + base.PopulateData(map) ; + Name = (string) map["name"] ; + + if (map.ContainsKey("optional")) { + //System.Console.WriteLine("optional") ; + Optional = (int)map["optional"] != 0 ; + } + if (map.ContainsKey("index")) { + //System.Console.WriteLine("index") ; + Index = (int)map["index"] != 0 ; + } + if (map.ContainsKey("access")) { + //System.Console.WriteLine("access") ; + Access = (int) map["access"] ; + } + + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SchemaStatistic.cs b/qpid/dotnet/client-010/management/console/SchemaStatistic.cs new file mode 100644 index 0000000000..74aea113c3 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaStatistic.cs @@ -0,0 +1,54 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata that describes the mapping of an object Statistic + */ + public class SchemaStatistic + { + + public string Name {get;set;} + public short Type {get;set;} + public string Description {get;set;} + public string Unit {get;set;} + + public SchemaStatistic(Decoder dec) + { + Dictionary map = dec.readMap() ; + Name = (string) map["name"] ; + Type = (short) short.Parse(""+map["type"]) ; + + if (map.ContainsKey("unit")) { + Unit = (string) map["unit"] ; + } + if (map.ContainsKey("description")) { + Description = (string) map["description"] ; + } + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SchemaVariable.cs b/qpid/dotnet/client-010/management/console/SchemaVariable.cs new file mode 100644 index 0000000000..50455ab38a --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SchemaVariable.cs @@ -0,0 +1,84 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic ; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Metadata for mapping properties, arguments, and statistics + */ + public abstract class SchemaVariable + { + public string Name {get;set;} + public short Type {get;set;} + public string Description {get;set;} + public string Unit {get;set;} + public int? Min {get;set;} + public int? Max {get;set;} + public int? MaxLength {get;set;} + public string Default {get;set;} + public string RefPackage {get;set;} + public string RefClass {get;set;} + + public SchemaVariable() { + } + + protected void PopulateData(Dictionary map) + { + + if (map.ContainsKey("name")) { + Name = (string) map["name"] ; + } + if (map.ContainsKey("type")) { + Type = short.Parse((""+ map["type"])) ; + } + + if (map.ContainsKey("unit")) { + Unit = (string) map["unit"] ; + } + if (map.ContainsKey("min")) { + Min = (int) map["min"] ; + } + if (map.ContainsKey("max")) { + Max = (int) map["max"] ; + } + if (map.ContainsKey("maxlen")) { + MaxLength = (int) map["maxlen"] ; + } + if (map.ContainsKey("description")) { + Description = (string) map["description"] ; + } + if (map.ContainsKey("refClass")) { + RefClass = (string) map["refClass"] ; + } + if (map.ContainsKey("refPackage")) { + RefPackage = (string) map["refPackage"] ; + } + if (map.ContainsKey("Default")) { + Default = (string) map["default"] ; + } + } + } +} diff --git a/qpid/dotnet/client-010/management/console/SequenceManager.cs b/qpid/dotnet/client-010/management/console/SequenceManager.cs new file mode 100644 index 0000000000..29f1ba26b0 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/SequenceManager.cs @@ -0,0 +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.Threading ; + +namespace org.apache.qpid.console +{ + + /** + * Holds state during asynchronous calls to the broker. + */ + public class SequenceManager + { + long sequence = 0 ; + Dictionary pending = new Dictionary() ; + Object lockObject = new Object() ; + + public SequenceManager() + { + } + + public long Reserve(Object data) { + long returnValue = 0 ; + lock(lockObject) { + returnValue = sequence ; + sequence += 1 ; + pending.Add(returnValue, data) ; + } + return returnValue; + } + + public Object Release(long seq) { + Object returnValue = null ; + lock(lockObject) { + returnValue = pending[seq] ; + pending.Remove(seq) ; + } + + return returnValue ; + } + } +} diff --git a/qpid/dotnet/client-010/management/console/Session.cs b/qpid/dotnet/client-010/management/console/Session.cs new file mode 100644 index 0000000000..8c04f21f00 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/Session.cs @@ -0,0 +1,818 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.Reflection ; +using System.Threading ; +using log4net ; +using org.apache.qpid.client ; +using org.apache.qpid.transport.util; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + + /** + * Main Interaction point for interaction with the bus. Can be used to locate objects + * on the bus, and invoke messages on them. + */ + public class Session + { + public static ILog log = LogManager.GetLogger(typeof(Session)) ; + + public static int CONTEXT_SYNC = 1 ; + public static int CONTEXT_STARTUP = 2 ; + public static int CONTEXT_MULTIGET = 3 ; + public static int DEFAULT_GET_WAIT_TIME = 60000 ; + + public bool RecieveObjects = true ; + public bool RecieveEvents = true ; + public bool RecieveHeartbeat = true ; + public bool UserBindings = false ; + public Console Console ; + + protected Dictionary> Packages = new Dictionary>() ; + protected List Brokers = new List() ; + protected SequenceManager SequenceManager = new SequenceManager() ; + protected object LockObject = new Object(); + protected List SyncSequenceList = new List() ; + protected List GetResult ; + protected Object SyncResult ; + + public Session() + { + } + + public Session(Console console) { + Console = console ; + } + + public void AddBroker(string url) { + BrokerURL brokerurl = GetBrokerURL(url) ; + Broker broker = new Broker(this, brokerurl) ; + Brokers.Add(broker) ; + + Dictionary args = new Dictionary() ; + args.Add("_class", "agent") ; + args.Add("_broker", broker) ; + this.GetObjects(args) ; + } + + public void RemoveBroker(Broker broker) { + if (Brokers.Contains(broker)) { + Brokers.Remove(broker) ; + } + + broker.Shutdown() ; + } + + public void Close() { + foreach (Broker broker in Brokers.ToArray()) { + this.RemoveBroker(broker) ; + } + } + + protected BrokerURL GetBrokerURL(string url) { + return new BrokerURL(url) ; + } + + + public List GetObjects(Dictionary args) { + List brokerList = null ; + List agentList = new List() ; + + if (args.ContainsKey("_broker")) { + brokerList = new List() ; + brokerList.Add((Broker)args["_broker"]) ; + } else { + brokerList = this.Brokers ; + } + + foreach (Broker broker in brokerList) { + broker.WaitForStable() ; + } + + if (args.ContainsKey("_agent")) { + Agent agent = (Agent)args["_agent"] ; + if (brokerList.Contains(agent.Broker)) { + agentList.Add(agent) ; + } else { + throw new Exception("Agent is not managed by this console or the supplied broker") ; + } + } else { + if (args.ContainsKey("_objectId")) { + ObjectID oid = (ObjectID) args["_objectId"] ; + foreach (Broker broker in Brokers) { + foreach (Agent agent in broker.Agents.Values) { + if ((agent.AgentBank == oid.AgentBank()) && (agent.BrokerBank == oid.BrokerBank())) { + agentList.Add(agent) ; + } + } + } + } + else { + foreach (Broker broker in brokerList) { + foreach (Agent agent in broker.Agents.Values) { + if (agent.Broker.IsConnected()) { + agentList.Add(agent) ; + } + } + } + } + } + + GetResult = new List() ; + + if (agentList.Count > 0) { + //FIXME Add a bunch of other suff too + foreach (Agent agent in agentList) { + Dictionary getParameters = new Dictionary() ; + Broker broker = agent.Broker ; + long seq = -1 ; + lock(LockObject) { + seq = SequenceManager.Reserve(Session.CONTEXT_MULTIGET) ; + SyncSequenceList.Add(seq) ; + } + object packageName = null ; + object className = null ; + object key = null ; + object sClass = null ; + object oid = null ; + object hash = null ; + + args.TryGetValue("_schema", out sClass) ; + args.TryGetValue("_key", out key) ; + args.TryGetValue("_class", out className) ; + args.TryGetValue("_package", out packageName) ; + args.TryGetValue("_objectID", out oid) ; + args.TryGetValue("_hash", out hash) ; + + if ((className == null) && (oid == null) && (oid == null)) { + throw new Exception("No class supplied, use '_schema', '_key', '_class', or '_objectId' argument") ; + } + + if (oid != null) { + getParameters.Add("_objectID", oid) ; + } + else { + if (sClass != null) { + key = key ?? ((SchemaClass)sClass).Key ; + } + if (key != null) { + ClassKey cKey = (ClassKey)key ; + className = className ?? cKey.ClassName ; + packageName = packageName ?? cKey.PackageName ; + hash = hash ?? cKey.Hash ; + } + + if (packageName != null) { + getParameters.Add("_package", packageName) ; + } + if (className != null) { + getParameters.Add("_class", className) ; + } + if (hash != null) { + getParameters.Add("_hash", hash) ; + } + foreach (KeyValuePair pair in args) { + if (!pair.Key.StartsWith("_")) { + getParameters.Add(pair.Key, pair.Value) ; + } + } + } + + Encoder enc = broker.CreateEncoder('G', seq) ; + enc.writeMap(getParameters) ; + string routingKey = String.Format("agent.{0}.{1}", agent.BrokerBank, agent.AgentBank) ; + Message msg = broker.CreateMessage(enc, routingKey) ; + log.Debug("Get Object Keys: ") ; + foreach (string pKey in getParameters.Keys) { + log.Debug(String.Format("\tKey: '{0}' Value: '{1}'", pKey, getParameters[pKey])) ; + } + broker.Send(msg) ; + } + + int waittime = DEFAULT_GET_WAIT_TIME ; + bool timeout = false ; + if (args.ContainsKey("_timeout")) { + waittime = (int) args["_timeout"] ; + } + DateTime start = DateTime.Now ; + lock (LockObject) { + // FIXME ERROR + while (SyncSequenceList.Count > 0){ + Monitor.Wait(LockObject,waittime) ; + TimeSpan duration = DateTime.Now - start; + if (duration.TotalMilliseconds > waittime) { + foreach (long pendingSeq in SyncSequenceList) { + SequenceManager.Release(pendingSeq) ; + } + SyncSequenceList.Clear() ; + timeout = true ; + } + } + } + + //FIXME Add the error logic + if ((GetResult.Count == 0) && timeout) { + throw new Exception ("Get Request timed out") ; + } + } + return GetResult ; + } + + public List GetPackages() { + this.WaitForStable() ; + List returnValue = new List() ; + foreach (String name in Packages.Keys) { + returnValue.Add(name) ; + } + + return returnValue ; + } + + public List GetClasses(string packageName) { + List returnValue = new List() ; + this.WaitForStable() ; + + if (Packages.ContainsKey(packageName)) { + foreach (SchemaClass sClass in Packages[packageName].Values) { + returnValue.Add(sClass.Key) ; + } + } + + return returnValue ; + } + + public SchemaClass GetSchema(ClassKey key) { + return GetSchema(key, true) ; + } + + protected SchemaClass GetSchema(ClassKey key, bool waitForStable) { + if (waitForStable) { + this.WaitForStable() ; + } + + SchemaClass returnValue = null ; + + try { + returnValue = Packages[key.PackageName][key.GetKeyString()] ; + } + catch (KeyNotFoundException) { + // eat it + } + + return returnValue ; + } + + + protected void WaitForStable() { + foreach (Broker broker in Brokers) { + broker.WaitForStable() ; + } + } + + + public Broker GetBroker(long BrokerBank) { + Broker returnValue = null ; + + foreach (Broker broker in Brokers) { + if (broker.BrokerBank() == BrokerBank) { + returnValue = broker ; + break ; + } + } + + return returnValue ; + } + + public MethodResult InvokeMethod(QMFObject obj, string name, List args, bool synchronous, int timeToLive) { + Broker aBroker = this.GetBroker(obj.BrokerBank()) ; + + long seq = this.SendMethodRequest(obj, aBroker, name, args, synchronous, timeToLive) ; + if (seq != 0) { + if (!synchronous) { + return null ; + } + try { + aBroker.WaitForSync(timeToLive) ; + } catch (Exception e) { + SequenceManager.Release(seq) ; + throw e ; + } + + // FIXME missing error logic in the broker + return (MethodResult) SyncResult ; + } + + return null ; + } + + protected long SendMethodRequest(QMFObject obj, Broker aBroker, string name, List args, bool synchronous, int timeToLive) { + + SchemaMethod method = obj.Schema.GetMethod(name) ; + if (args == null) { + args = new List() ; + } + + long seq = 0 ; + if (method != null) { + KeyValuePair pair = new KeyValuePair(method, synchronous) ; + seq = SequenceManager.Reserve(pair) ; + Encoder enc = aBroker.CreateEncoder('M', seq) ; + obj.ObjectID.encode(enc) ; + obj.Schema.Key.encode(enc) ; + enc.writeStr8(name) ; + + if (args.Count < method.InputArgCount) { + throw new Exception(String.Format("Incorrect number of arguments: expected {0}, got{1}", method.InputArgCount, args.Count)) ; + } + + int argIndex = 0 ; + foreach (SchemaArgument arg in method.Arguments) { + if (arg.IsInput()) {; + this.EncodeValue(enc, arg.Type, args[argIndex]) ; + argIndex += 1 ; + } + } + + Message msg = aBroker.CreateMessage(enc,obj.RoutingKey(),timeToLive) ; + + if (synchronous) { + aBroker.SetSyncInFlight(true) ; + } + aBroker.Send(msg) ; + } + return seq ; + } + + public QMFObject MakeObject(ClassKey key) { + SchemaClass sClass = this.GetSchema(key) ; + if (sClass == null) { + throw new Exception("No schema found for class " + key.ToString()) ; + } + + return this.CreateQMFObject(sClass, true, true, false) ; + } + + public QMFObject MakeObject(String keyString) { + return this.MakeObject(new ClassKey(keyString)) ; + } + + // Callback Methods + public void HandleNewAgent(Agent agent) { + if (Console != null) { + Console.NewAgent(agent) ; + } + } + + public void HandleAgentRemoved(Agent agent) { + if (Console != null) { + Console.AgentRemoved(agent) ; + } + } + + public void HandleBrokerConnect(Broker broker) { + if (Console != null) { + Console.BrokerConnected(broker) ; + } + } + + public void HandleBrokerDisconnect(Broker broker) { + if (Console != null) { + Console.BrokerDisconnected(broker) ; + } + } + + public void HandleBrokerResponse(Broker broker, Decoder decoder, long sequence) { + if (Console != null) { + Console.BrokerInformation(broker) ; + } + + long seq = SequenceManager.Reserve(CONTEXT_STARTUP) ; + Encoder endocder = broker.CreateEncoder('P', seq) ; + broker.Send(endocder) ; + } + + public void HandlePackageIndicator(Broker broker, Decoder decoder, long sequence) { + string packageName = decoder.readStr8() ; + bool notify = false ; + if (!Packages.ContainsKey(packageName)) { + lock (LockObject) { + Packages[packageName] = new Dictionary() ; + notify = true ; + } + } + + if (notify && Console != null) { + Console.NewPackage(packageName) ; + } + + broker.IncrementOutstanding() ; + long seq = SequenceManager.Reserve(Session.CONTEXT_STARTUP) ; + Encoder enc = broker.CreateEncoder('Q', seq) ; + enc.writeStr8(packageName) ; + broker.Send(enc) ; + } + + public void HandleCommandComplete(Broker broker, Decoder decoder, long sequence) { + + long code = decoder.readUint32() ; + string text = decoder.readStr8() ; + Object context = this.SequenceManager.Release(sequence) ; + + if (context.Equals(CONTEXT_STARTUP)) { + broker.DecrementOutstanding() ; + } else { + if ((context.Equals(CONTEXT_SYNC)) & broker.GetSyncInFlight()) { + broker.SetSyncInFlight(false) ; + } else { + if (context.Equals(CONTEXT_MULTIGET) && SyncSequenceList.Contains(sequence)) { + lock(LockObject) { + SyncSequenceList.Remove(sequence) ; + if (SyncSequenceList.Count == 0) { + Monitor.PulseAll(LockObject) ; + } + } + } + } + } + } + + public void HandleClassIndicator(Broker broker, Decoder decoder, long sequence) { + short kind = decoder.readUint8() ; + ClassKey classKey = new ClassKey(decoder) ; + bool unknown = false ; + + + lock (LockObject) { + if (Packages.ContainsKey(classKey.PackageName)) { + if (!Packages[classKey.PackageName].ContainsKey(classKey.GetKeyString())) { + unknown = true ; + } + } + } + + if (unknown) { + broker.IncrementOutstanding() ; + long seq = SequenceManager.Reserve(Session.CONTEXT_STARTUP) ; + Encoder enc = broker.CreateEncoder('S', seq) ; + classKey.encode(enc) ; + broker.Send(enc) ; + } + } + + public void HandleMethodResponse(Broker broker, Decoder decoder, long sequence) { + long code = decoder.readUint32() ; + string text = decoder.readStr16() ; + + Dictionary outArgs = new Dictionary() ; + object obj = SequenceManager.Release(sequence) ; + + if (obj == null) { + return ; + } + + KeyValuePair pair = (KeyValuePair) obj ; + if (code == 0) { + foreach (SchemaArgument arg in pair.Key.Arguments) { + if (arg.IsOutput()) { + outArgs.Add(arg.Name, this.DecodeValue(decoder, arg.Type)) ; + } + } + } + + MethodResult result = new MethodResult(code, text, outArgs) ; + + if (pair.Value) { + this.SyncResult = result; + broker.SetSyncInFlight(false) ; + } + + if (Console != null) { + Console.MethodResponse(broker, sequence, result) ; + } + } + + public void HandleHeartbeatIndicator(Broker broker, Decoder decoder, long sequence, IMessage msg) { + if (Console != null) { + long brokerBank = 1 ; + long agentBank = 0 ; + try { + string routingKey = msg.DeliveryProperties.getRoutingKey() ; + if (routingKey != null) { + agentBank = Agent.getBrokerBank(routingKey) ; + brokerBank = Agent.getBrokerBank(routingKey) ; + } + } + catch (Exception e) { + log.Warn("Internal QPID error", e) ; + } + + string agentKey = Agent.AgentKey(agentBank, brokerBank) ; + long timestamp = decoder.readUint64() ; + if (broker.Agents.ContainsKey(agentKey)) { + Agent agent = broker.Agents[agentKey] ; + Console.HearbeatRecieved(agent, timestamp) ; + } + } + + } + + public void HandleEventIndicator(Broker broker, Decoder decoder, long sequence) { + if (Console != null) { + QMFEvent newEvent = new QMFEvent(this, decoder) ; + Console.EventRecieved(broker, newEvent) ; + } + } + + public void HandleSchemaResponse(Broker broker, Decoder decoder, long sequence) { + short kind = decoder.readUint8() ; + ClassKey classKey = new ClassKey(decoder) ; + SchemaClass sClass = new SchemaClass(kind, classKey, decoder, this) ; + lock(LockObject) { + Dictionary classMappings = Packages[sClass.PackageName] ; + classMappings.Remove(sClass.ClassKeyString) ; + classMappings.Add(sClass.ClassKeyString, sClass) ; + } + + SequenceManager.Release(sequence) ; + broker.DecrementOutstanding() ; + if (Console != null) { + this.Console.NewClass(kind, classKey) ; + } + } + + public void HandleContentIndicator(Broker broker, Decoder decoder, long sequence, bool hasProperties, bool hasStatistics) { + + ClassKey key = new ClassKey(decoder) ; + SchemaClass sClass = null ;; + lock (LockObject) { + sClass = GetSchema(key, false) ; + } + if (sClass != null) { + QMFObject obj = this.CreateQMFObject(sClass, decoder, hasProperties, hasStatistics, true) ; + + if (key.PackageName.Equals("org.apache.qpid.broker") && key.ClassName.Equals("agent") && hasProperties) { + broker.UpdateAgent(obj) ; + } + + lock (LockObject) { + if (SyncSequenceList.Contains(sequence)) { + if (!obj.IsDeleted() && this.SelectMatch(obj)) { + GetResult.Add(obj) ; + } + } + } + + if (Console != null) { + if (hasProperties) { + Console.ObjectProperties(broker, obj) ; + } + if (hasStatistics) { + Console.ObjectStatistics(broker, obj) ; + } + } + } + } + + public bool SelectMatch(QMFObject obj) { + return true ; + } + + public object DecodeValue(Decoder dec, short type) { + + switch (type) { + case 1: return dec.readUint8() ; // U8 + case 2: return dec.readUint16() ; // U16 + case 3: return dec.readUint32() ; // U32 + case 4: return dec.readUint64() ; // U64 + case 6: return dec.readStr8() ; // SSTR + case 7: return dec.readStr16() ; // LSTR + case 8: return dec.readDatetime() ; // ABSTIME + case 9: return dec.readUint32() ; // DELTATIME + case 10: return new ObjectID(dec) ; // ref + case 11: return dec.readUint8() != 0 ; // bool + case 12: return dec.readFloat() ; // float + case 13: return dec.readDouble() ; // double + case 14: return dec.readUuid() ; // UUID + case 15: // Ftable + Dictionary ftable = new Dictionary() ; + MSDecoder sc = new MSDecoder() ; + sc.init(new MemoryStream(dec.readVbin32())) ; + if (sc.hasRemaining()) { + long count = sc.readUint32() ; + while (count > 0) { + string key = sc.readStr8() ; + short code = sc.readUint8() ; + object newValue = this.DecodeValue(sc, code) ; + ftable.Add(key, newValue) ; + count -= 1 ; + } + } + return ftable ; + case 16: return dec.readInt8() ; // int8 + case 17: return dec.readInt16() ; // int16 + case 18: return dec.readInt32() ; // int32 + case 19: return dec.readInt64() ; // int64 + case 20: // Object + // Peek into the inner type code, make sure + // it is actually an object + object returnValue = null ; + short innerTypeCode = dec.readUint8() ; + if (innerTypeCode != 20) { + returnValue = this.DecodeValue(dec, innerTypeCode) ; + } + else { + ClassKey classKey = new ClassKey(dec) ; + lock(LockObject) { + SchemaClass sClass = GetSchema(classKey) ; + if (sClass != null) { + returnValue = this.CreateQMFObject(sClass, dec, true, true, false) ; + } + } + } + return returnValue; + case 21: // List + MSDecoder lDec = new MSDecoder() ; + lDec.init(new MemoryStream(dec.readVbin32())) ; + long count = lDec.readUint32() ; + List newList = new List() ; + while (count > 0){ + short innerType = lDec.readUint8() ; + newList.Add(this.DecodeValue(lDec, innerType)) ; + count -= 1 ; + } + return newList ; + case 22: // Array + MSDecoder aDec = new MSDecoder() ; + aDec.init(new MemoryStream(dec.readVbin32())) ; + long cnt = aDec.readUint32() ; + short innerType = aDec.readUint8() ; + List aList = new List() ; + while (cnt > 0){ + aList.Add(this.DecodeValue(aDec, innerType)) ; + cnt -= 1 ; + } + return aList ; + default: + throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; + } + } + + + public void EncodeValue(Encoder enc, short type, object val) { + try { + switch ((int)type) { + case 1: enc.writeUint8((short) val) ; break; // U8 + case 2: enc.writeUint16((int) val) ; break; // U16 + case 3: enc.writeUint32((long) val) ; break; // U32 + case 4: enc.writeUint64((long) val) ; break; // U64 + case 6: enc.writeStr8((string) val) ; break; // SSTR + case 7: enc.writeStr16((string) val) ; break; // LSTR + case 8: enc.writeDatetime((long) val); break; // ABSTIME + case 9: enc.writeUint32((long) val); break; // DELTATIME + case 10: ((ObjectID)val).encode(enc) ; break; // ref + case 11: + if ((bool) val) { + enc.writeUint8(1) ; + } else { + enc.writeUint8(0) ; + } + break ; + case 12: enc.writeFloat((float) val); break; // FLOAT + case 13: enc.writeDouble((double) val); break; // DOUBLE + case 14: enc.writeUuid((UUID) val) ; break ; // UUID + case 15: // Ftable + Dictionary ftable = (Dictionary) val ; + MSEncoder sc = new MSEncoder(1) ; + sc.init() ; + sc.writeUint32(ftable.Count) ; + foreach (String key in ftable.Keys) { + object obj = ftable[key] ; + short innerType = Util.QMFType(obj) ; + sc.writeStr8(key) ; + sc.writeUint8(innerType) ; + this.EncodeValue(sc,innerType,obj) ; + } + byte[] bytes = sc.segment().ToArray() ; + enc.writeVbin32(bytes) ; + break ; + case 16: enc.writeInt8((short) val) ; break; // int8 + case 17: enc.writeInt16((int) val) ; break; // int16 + case 18: enc.writeInt32(long.Parse(""+ val)) ; break; // int32 + case 19: enc.writeInt64(long.Parse("" + val)) ; break; // int64 + case 20: // Object + // Check that the object has a session, if not + // take ownership of it + QMFObject qObj = (QMFObject) val ; + if (qObj.Session == null) { + qObj.Session = this ; + } + qObj.Encode(enc) ; + break; + case 21: // List + List items = (List) val ; + MSEncoder lEnc = new MSEncoder(1) ; + lEnc.init() ; + lEnc.writeUint32(items.Count) ; + foreach (object obj in items) { + short innerType = Util.QMFType(obj) ; + lEnc.writeUint8(innerType) ; + this.EncodeValue(lEnc,innerType,obj) ; + } + enc.writeVbin32(lEnc.segment().ToArray()) ; + break ; + case 22: // Array + List aItems = (List) val ; + MSEncoder aEnc = new MSEncoder(1) ; + aEnc.init() ; + long aCount = aItems.Count ; + aEnc.writeUint32(aCount) ; + if (aCount > 0) { + Object anObj = aItems[0] ; + short innerType = Util.QMFType(anObj) ; + aEnc.writeUint8(innerType) ; + foreach (object obj in aItems) { + this.EncodeValue(aEnc,innerType,obj) ; + } + } + enc.writeVbin32(aEnc.segment().ToArray()) ; + break ; + default: + throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; + } + } + catch (System.InvalidCastException e) { + string msg = String.Format("Class cast exception for typecode {0}, type {1} ", type, val.GetType()) ; + log.Error(msg) ; + throw new Exception(msg + type, e) ; + } + } + + public List BindingKeys() { + List bindings = new List() ; + bindings.Add("schema.#") ; + if (RecieveObjects & RecieveEvents & RecieveHeartbeat & !UserBindings) { + bindings.Add("console.#") ; + } + else { + if (RecieveObjects & !UserBindings) { + bindings.Add("console.obj.#") ; + } + else { + bindings.Add("console.obj.*.*.org.apache.qpid.broker.agent") ; + } + if (RecieveEvents) { + bindings.Add("console.event.#") ; + } + if (RecieveHeartbeat) { + bindings.Add("console.heartbeat.#") ; + } + } + return bindings ; + } + + protected QMFObject CreateQMFObject(SchemaClass schema, bool hasProperties, bool hasStats , bool isManaged) { + Type realClass = typeof(QMFObject) ; + if (Console != null) { + realClass = Console.TypeMapping(schema.Key) ; + } + Type[] types = new Type[] {typeof(Session), typeof(SchemaClass), typeof(bool), typeof(bool),typeof(bool)} ; + object[] args = new object[] {this, schema, hasProperties, hasStats, isManaged} ; + ConstructorInfo ci = realClass.GetConstructor(types); + return (QMFObject) ci.Invoke(args) ; + } + + protected QMFObject CreateQMFObject(SchemaClass schema, Decoder dec, bool hasProperties, bool hasStats , bool isManaged) { + Type realClass = typeof(QMFObject) ; + if (Console != null) { + realClass = Console.TypeMapping(schema.Key) ; + } + Type[] types = new Type[] {typeof(Session), typeof(SchemaClass), typeof(Decoder), typeof(bool), typeof(bool),typeof(bool)} ; + object[] args = new object[] {this, schema, dec, hasProperties, hasStats, isManaged} ; + ConstructorInfo ci = realClass.GetConstructor(types); + return (QMFObject) ci.Invoke(args) ; + } + } +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/Util.cs b/qpid/dotnet/client-010/management/console/Util.cs new file mode 100644 index 0000000000..4a06f4e6af --- /dev/null +++ b/qpid/dotnet/client-010/management/console/Util.cs @@ -0,0 +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.Generic; +using org.apache.qpid.client ; +using org.apache.qpid.transport.util; +using org.apache.qpid.transport.codec ; + +namespace org.apache.qpid.console +{ + public class Util + { + static Dictionary ENCODINGS = new Dictionary() ; + + + static Util() { + ENCODINGS.Add(typeof(string), 7) ; + ENCODINGS.Add(typeof(short), 1) ; + //ENCODINGS.Add(typeof(int), 2) ; + //ENCODINGS.Add(typeof(long), 3) ; + ENCODINGS.Add(typeof(float), 13) ; + ENCODINGS.Add(typeof(QMFObject), 20) ; + ENCODINGS.Add(typeof(int), 17) ; + ENCODINGS.Add(typeof(long), 18) ; + ENCODINGS.Add(typeof(System.Collections.Generic.List<>), 21) ; + } + + /** + * Converts type numbers to schema type names + */ + public static string TypeName(short type) { + switch(type) { + //case 0: return "UNKNOWN" ; + case 1: return "uint8" ; + case 2: return "uint16" ; + case 3: return "uint32" ; + case 4: return "uint64" ; + case 5: return "bool" ; + case 6: return "short-string" ; + case 7: return "long-string" ; + case 8: return "abs-time" ; + case 9: return "delta-time" ; + case 10: return "reference" ; + case 11: return "boolean" ; + case 12: return "float" ; + case 13: return "double" ; + case 14: return "uuid" ; + case 15: return "field-table" ; + case 16: return "int8" ; + case 17: return "int16" ; + case 18: return "int32" ; + case 19: return "int64" ; + case 20: return "object" ; + case 21: return "list" ; + case 22: return "array" ; + } + + throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; + } + + /** + * Converts schema numbers to schema access names + */ + public static string AccessName(int type) { + switch(type) { + //case 0: return "UNKNOWN" ; + case 1: return "ReadCreate" ; + case 2: return "ReadWrite" ; + case 3: return "ReadOnly" ; + } + + throw new Exception(String.Format("Invalid Access Code: {0}", type)) ; + } + + /** + * Default values per schema type + */ + public static object DefaultValue(short type) { + switch(type) { + //case 0: return "UNKNOWN" ; + case 1: return 0 ; + case 2: return 0 ; + case 3: return 0l ; + case 4: return 0l ; + case 5: return false ; + case 6: return "" ; + case 7: return "" ; + case 8: return 0l ; + case 9: return 0l ; + case 10: return new ObjectID() ; + case 11: return false ; + case 12: return 0f ; + case 13: return 0d ; + case 14: return new UUID(0,0) ; + case 15: return new Dictionary(); + case 16: return 0 ; + case 17: return 0 ; + case 18: return 0l ; + case 19: return 0l ; + case 20: return null ; + case 21: return new List() ; + case 22: return new List() ; + } + + throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; + } + + /** + * Returns a QMF type based on C# object type + */ + public static short QMFType(object obj) { + if (ENCODINGS.ContainsKey(obj.GetType())) { + return ENCODINGS[obj.GetType()] ; + } else { + throw new Exception (String.Format("Unkown Type of {0}", obj.GetType())) ; + } + } + + /** + * Grabs a friendly string version of bytes. + */ + public static string ByteString(byte[] bytes) { + return System.Text.Encoding.UTF8.GetString(bytes) ; + } + + protected Util() + { + + } + } +} diff --git a/qpid/dotnet/client-010/management/console/XMLUtil.cs b/qpid/dotnet/client-010/management/console/XMLUtil.cs new file mode 100644 index 0000000000..255b9c4dd1 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/XMLUtil.cs @@ -0,0 +1,106 @@ + +using System; +using System.Collections.Generic; +using org.apache.qpid.client ; + +namespace org.apache.qpid.console +{ + + + public class XMLUtil + { + + public static string CommonAttributes(SchemaVariable var) { + string returnString = "" ; + if (var.Description != null){ + returnString = returnString + String.Format(" desc='{0}'", var.Description) ; + } + + if (var.RefPackage != null){ + returnString = returnString + String.Format(" refPackage='{0}'", var.RefPackage) ; + } + + if (var.RefClass != null){ + returnString = returnString + String.Format(" refClass='{0}'", var.RefClass) ; + } + + if (var.Unit != null){ + returnString = returnString + String.Format(" unit='{0}'", var.Unit) ; + } + + if (var.Min != null){ + returnString = returnString + String.Format(" min='{0}'", var.Min) ; + } + if (var.Max != null){ + returnString = returnString + String.Format(" max='{0}'", var.Max) ; + } + if (var.MaxLength != null){ + returnString = returnString + String.Format(" maxLength='{0}'", var.MaxLength) ; + } + + return returnString ; + } + + public static string SchemaXML(Session sess, string packageName) { + string returnValue = String.Format("\n", packageName) ; + foreach (ClassKey key in sess.GetClasses(packageName)) { + SchemaClass schema = sess.GetSchema(key) ; + if (schema.Kind == 1) { + if (schema.SuperType == null) + returnValue += String.Format("\t\n", key.ClassName, key.GetHashString()) ; + else + returnValue += String.Format("\t\n", key.ClassName, key.GetHashString(), schema.SuperType.GetKeyString()) ; + foreach (SchemaProperty prop in schema.Properties) { + object[] attributes = new object[5] ; + attributes[0] = prop.Name ; + attributes[1] = Util.TypeName(prop.Type) ; + attributes[2] = Util.AccessName(prop.Access) ; + attributes[3] = prop.Optional ; + attributes[4] = XMLUtil.CommonAttributes(prop); + returnValue += String.Format("\t\t\n", attributes) ; + } + foreach (SchemaMethod meth in schema.Methods) { + returnValue += String.Format("\t\t\n", meth.Name) ; + foreach (SchemaArgument arg in meth.Arguments) { + object[] attributes = new object[4] ; + attributes[0] = arg.Name ; + attributes[1] = arg.Direction ; + attributes[2] = Util.TypeName(arg.Type) ; + attributes[3] = XMLUtil.CommonAttributes(arg); + returnValue += String.Format("\t\t\t\n", attributes) ; + } + returnValue += String.Format("\t\t\n") ; + } + returnValue += String.Format("\t\n") ; + } else { + returnValue += String.Format("\t\n", key.ClassName, key.GetHashString()) ; + foreach (SchemaArgument arg in schema.Arguments) { + object[] attributes = new object[4] ; + attributes[0] = arg.Name ; + attributes[1] = Util.TypeName(arg.Type) ; + attributes[2] = XMLUtil.CommonAttributes(arg); + returnValue += String.Format("\t\t\t\n", attributes) ; + } + returnValue += String.Format("\t\n") ; + } + } + returnValue += String.Format("\n") ; + + return returnValue ; + } + + public static string SchemaXML(Session sess, string[] packageNames) { + string returnValue = "\n" ; + foreach (string package in packageNames) { + returnValue += XMLUtil.SchemaXML(sess, package) ; + returnValue += "\n" ; + } + returnValue += "\n" ; + return returnValue ; + } + + protected XMLUtil() + { + } + } +} diff --git a/qpid/dotnet/client-010/management/console/console.csproj b/qpid/dotnet/client-010/management/console/console.csproj new file mode 100644 index 0000000000..6e1a4a5586 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/console.csproj @@ -0,0 +1,74 @@ + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {42E3CD17-EFDC-4533-95AA-4AF67FF534B5} + Exe + console + + + true + full + false + bin\Debug + DEBUG + prompt + 4 + + + none + false + bin\Release + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + False + + + False + + + False + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/console.sln b/qpid/dotnet/client-010/management/console/console.sln new file mode 100644 index 0000000000..d5e70001a5 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/console.sln @@ -0,0 +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 diff --git a/qpid/dotnet/client-010/management/console/console.userprefs b/qpid/dotnet/client-010/management/console/console.userprefs new file mode 100644 index 0000000000..3dbea952ee --- /dev/null +++ b/qpid/dotnet/client-010/management/console/console.userprefs @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/console.usertasks b/qpid/dotnet/client-010/management/console/console.usertasks new file mode 100644 index 0000000000..d887d0ef8d --- /dev/null +++ b/qpid/dotnet/client-010/management/console/console.usertasks @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/default.build b/qpid/dotnet/client-010/management/console/default.build new file mode 100644 index 0000000000..c71e695569 --- /dev/null +++ b/qpid/dotnet/client-010/management/console/default.build @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs index 7fc98fbf38..415ad1f1ae 100644 --- a/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/perftest/Properties/AssemblyInfo.cs @@ -50,5 +50,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs index 26a40b1f77..871d450240 100644 --- a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/test/test.config b/qpid/dotnet/client-010/test/test.config index e62da47bb3..2a2fb72b61 100644 --- a/qpid/dotnet/client-010/test/test.config +++ b/qpid/dotnet/client-010/test/test.config @@ -24,8 +24,8 @@ - - + + diff --git a/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs index 0d60714528..66f2bb1268 100644 --- a/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs index 1dbf952552..be301395d3 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs index adcbad66f0..cc0208c9ca 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs index 3f9d11e752..83dfbcd5f4 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs index 940c10976b..a32f32e864 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs index d9e0a5f3d3..703fb9fcea 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyVersion("0.10.0.0")] +// [assembly: AssemblyVersion("0.5.0.0")] +[assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.2.1 From 306ff6372fd8108ee47e2f026339a857775d5240 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Mon, 6 Jul 2009 14:42:03 +0000 Subject: QPID-1897 - Patch from Julien Lavigne du Cadet ToString() on UUID class should override and not hide Object.ToString() git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@791494 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/client/transport/util/UUID.cs | 41 ++++++++++++++++++++-- .../client-010/test/transport/util/UUIDTest.cs | 21 +++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/util/UUID.cs b/qpid/dotnet/client-010/client/transport/util/UUID.cs index 788c5b99c8..ff237f689e 100644 --- a/qpid/dotnet/client-010/client/transport/util/UUID.cs +++ b/qpid/dotnet/client-010/client/transport/util/UUID.cs @@ -28,6 +28,7 @@ namespace org.apache.qpid.transport.util private long _mostSigBits; private long _leastSigBits; + private static readonly Random _random = new Random(); public UUID(long mostSigBits, long leastSigBits) @@ -61,8 +62,7 @@ namespace org.apache.qpid.transport.util public static UUID randomUUID() { byte[] randomBytes = new byte[16]; - Random random = new Random(); - random.NextBytes(randomBytes); + _random.NextBytes(randomBytes); randomBytes[6] &= 0x0f; randomBytes[6] |= 0x40; randomBytes[8] &= 0x3f; @@ -70,7 +70,7 @@ namespace org.apache.qpid.transport.util return new UUID(randomBytes); } - public new String ToString() + public override String ToString() { return (digits(_mostSigBits >> 32, 8) + "-" + digits(_mostSigBits >> 16, 4) + "-" + @@ -84,5 +84,40 @@ namespace org.apache.qpid.transport.util 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/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs index c073f1139a..83faec49f8 100644 --- a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs @@ -37,5 +37,26 @@ namespace test.transport.util 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()); + } } } -- cgit v1.2.1 From f5f57b9857d0853a235ac1594a4d3921760eaa85 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 3 Dec 2009 22:03:51 +0000 Subject: fix line endings. sigh git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@886940 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/README.txt | 134 +-- .../client-010/addins/ExcelAddIn/Excel.exe.config | 22 +- .../client-010/addins/ExcelAddIn/ExcelAddIn.cs | 578 +++++----- .../ExcelAddInMessageProcessor.csproj | 120 +- .../addins/ExcelAddInMessageProcessor/Processor.cs | 86 +- .../ExcelAddInProducer/ExcelAddInProducer.csproj | 112 +- .../addins/ExcelAddInProducer/Program.cs | 110 +- qpid/dotnet/client-010/addins/README.txt | 56 +- qpid/dotnet/client-010/client/Client.csproj | 108 +- qpid/dotnet/client-010/client/client.sln | 208 ++-- qpid/dotnet/client-010/client/client.suo | Bin 572416 -> 572415 bytes qpid/dotnet/client-010/client/client/Client.cs | 290 ++--- .../client/client/ClientConnectionDelegate.cs | 194 ++-- .../client-010/client/client/ClientInterface.cs | 118 +- .../client/client/ClientSessionDelegate.cs | 108 +- .../client/client/ClosedListenerInterface.cs | 58 +- qpid/dotnet/client-010/client/client/ErrorCode.cs | 278 ++--- qpid/dotnet/client-010/client/client/IMessage.cs | 96 +- qpid/dotnet/client-010/client/client/Message.cs | 262 ++--- .../client/client/MessageListenerInterface.cs | 62 +- qpid/dotnet/client-010/client/transport/Binary.cs | 256 ++--- qpid/dotnet/client-010/client/transport/Binding.cs | 66 +- qpid/dotnet/client-010/client/transport/Channel.cs | 346 +++--- .../client-010/client/transport/ChannelDelegate.cs | 80 +- .../client-010/client/transport/ClientDelegate.cs | 70 +- .../client-010/client/transport/Connection.cs | 344 +++--- .../client/transport/ConnectionDelegate.cs | 214 ++-- qpid/dotnet/client-010/client/transport/Field.cs | 148 +-- qpid/dotnet/client-010/client/transport/Future.cs | 74 +- qpid/dotnet/client-010/client/transport/Header.cs | 164 +-- qpid/dotnet/client-010/client/transport/Method.cs | 298 ++--- .../client/transport/ProtocolDelegate.cs | 72 +- .../client-010/client/transport/ProtocolError.cs | 170 +-- .../client-010/client/transport/ProtocolEvent.cs | 82 +- .../client-010/client/transport/ProtocolHeader.cs | 248 ++--- qpid/dotnet/client-010/client/transport/Range.cs | 232 ++-- .../dotnet/client-010/client/transport/RangeSet.cs | 298 ++--- .../client-010/client/transport/ReceivedPayload.cs | 86 +- .../dotnet/client-010/client/transport/Receiver.cs | 74 +- qpid/dotnet/client-010/client/transport/Sender.cs | 62 +- qpid/dotnet/client-010/client/transport/Session.cs | 1042 ++++++++--------- .../client-010/client/transport/SessionDelegate.cs | 250 ++--- qpid/dotnet/client-010/client/transport/Struct.cs | 242 ++-- .../client/transport/codec/AbstractDecoder.cs | 798 ++++++------- .../client/transport/codec/AbstractEncoder.cs | 1178 ++++++++++---------- .../client-010/client/transport/codec/Decoder.cs | 144 +-- .../client-010/client/transport/codec/Encodable.cs | 72 +- .../client-010/client/transport/codec/Encoder.cs | 140 +-- .../client-010/client/transport/codec/MSDecoder.cs | 220 ++-- .../client-010/client/transport/codec/MSEncoder.cs | 344 +++--- .../transport/exception/ConnectionException.cs | 96 +- .../client/transport/exception/ExceptionArgs.cs | 82 +- .../exception/ProtocolVersionException.cs | 116 +- .../transport/exception/SessionClosedException.cs | 74 +- .../client/transport/exception/SessionException.cs | 88 +- .../transport/exception/TransportException.cs | 90 +- .../client/transport/network/Assembler.cs | 562 +++++----- .../client/transport/network/Disassembler.cs | 442 ++++---- .../client-010/client/transport/network/Frame.cs | 284 ++--- .../client/transport/network/IIoSender.cs | 56 +- .../client/transport/network/InputHandler.cs | 562 +++++----- .../client/transport/network/NetworkDelegate.cs | 78 +- .../client/transport/network/NetworkEvent.cs | 62 +- .../client/transport/network/io/IIoTransport.cs | 114 +- .../client/transport/network/io/IoReceiver.cs | 376 +++---- .../client/transport/network/io/IoSSLTransport.cs | 388 +++---- .../client/transport/network/io/IoSender.cs | 266 ++--- .../client/transport/network/io/IoTransport.cs | 284 ++--- .../client/transport/util/ByteEncoder.cs | 436 ++++---- .../client/transport/util/CircularBuffer.cs | 264 ++--- .../client-010/client/transport/util/Functions.cs | 80 +- .../client-010/client/transport/util/Logger.cs | 226 ++-- .../client-010/client/transport/util/Serial.cs | 186 ++-- .../client-010/client/transport/util/UUID.cs | 246 ++-- qpid/dotnet/client-010/demo/Demo.csproj | 166 +-- .../demo/Properties/Resources.Designer.cs | 126 +-- .../client-010/demo/Properties/Resources.resx | 232 ++-- .../demo/Properties/Settings.Designer.cs | 52 +- .../client-010/demo/Properties/Settings.settings | 14 +- .../direct/example-direct-Listener/Listener.cs | 224 ++-- .../example-direct-Listener.csproj | 104 +- .../direct/example-direct-producer/Producer.cs | 174 +-- .../example-direct-producer.csproj | 104 +- .../fanout/example-fanout-Listener/Listener.cs | 242 ++-- .../example-fanout-Listener.csproj | 104 +- .../fanout/example-fanout-Producer/Producer.cs | 168 +-- .../example-fanout-Producer.csproj | 104 +- .../pub-sub/example-pub-sub-Listener/Listener.cs | 276 ++--- .../example-pub-sub-Listener.csproj | 104 +- .../pub-sub/example-pub-sub-Publisher/Publisher.cs | 186 ++-- .../example-pub-sub-Publisher.csproj | 104 +- .../example-request-response-Client/Client.cs | 274 ++--- .../example-request-response-Client.csproj | 104 +- .../example-request-response-Server/Server.cs | 272 ++--- .../example-request-response-Server.csproj | 104 +- qpid/dotnet/client-010/gentool/build.xml | 104 +- .../client-010/lib/log4net/log4net-licence.txt | 402 +++---- qpid/dotnet/client-010/lib/nunit/nunit-licence.txt | 46 +- qpid/dotnet/client-010/lib/plossum/C5-License.txt | 54 +- qpid/dotnet/client-010/lib/plossum/license.txt | 56 +- .../client-010/management/console/console.sln | 40 +- qpid/dotnet/client-010/perftest/README.txt | 74 +- qpid/dotnet/client-010/perftest/perftest.csproj | 120 +- qpid/dotnet/client-010/test/Test.csproj | 136 +-- qpid/dotnet/client-010/test/interop/Admin.cs | 180 +-- .../client-010/test/interop/ApplicationHeaders.cs | 166 +-- qpid/dotnet/client-010/test/interop/Message.cs | 358 +++--- qpid/dotnet/client-010/test/interop/TestCase.cs | 234 ++-- .../test/transport/util/ByteEncoderTest.cs | 212 ++-- .../test/transport/util/CircularBufferTest.cs | 178 +-- .../test/transport/util/ResultFutureTest.cs | 206 ++-- .../client-010/test/transport/util/SerialTest.cs | 150 +-- .../client-010/test/transport/util/UUIDTest.cs | 124 +-- .../client-010/wcf/demo/wcfBookingClient/Form1.cs | 192 ++-- .../wcf/demo/wcfBookingClient/Form1.resx | 244 ++-- .../wcfBookingClient/Properties/Resources.resx | 232 ++-- .../wcfBookingClient/Properties/Settings.settings | 14 +- .../demo/wcfBookingClient/wcBookingClient.csproj | 192 ++-- .../wcf/demo/wcfBookingServer/Booking.cs | 124 +-- .../wcf/demo/wcfBookingServer/IBooking.cs | 86 +- .../client-010/wcf/demo/wcfBookingServer/Order.cs | 90 +- .../wcf/demo/wcfBookingServer/Program.cs | 196 ++-- .../wcf/demo/wcfBookingServer/Receipt.cs | 92 +- .../demo/wcfBookingServer/wcfBookingServer.csproj | 140 +-- .../wcf/demo/wcfHelloClient/HelloClient.cs | 72 +- .../wcf/demo/wcfHelloClient/IHelloService.cs | 66 +- .../client-010/wcf/demo/wcfHelloClient/Program.cs | 96 +- .../wcf/demo/wcfHelloClient/wcfHelloClient.csproj | 116 +- .../wcf/demo/wcfHelloServer/HelloService.cs | 68 +- .../wcf/demo/wcfHelloServer/IHelloService.cs | 64 +- .../client-010/wcf/demo/wcfHelloServer/Program.cs | 94 +- .../wcf/demo/wcfHelloServer/wcfHelloServer.csproj | 120 +- .../client-010/wcf/demo/wcfRPC/IUpperCase.cs | 62 +- qpid/dotnet/client-010/wcf/demo/wcfRPC/Program.cs | 226 ++-- .../demo/wcfRPC/QpidBindingConfigurationElement.cs | 410 +++---- .../dotnet/client-010/wcf/demo/wcfRPC/UpperCase.cs | 66 +- .../client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 132 +-- .../client-010/wcf/model/CommunicationOperation.cs | 62 +- qpid/dotnet/client-010/wcf/model/QpidBinding.cs | 368 +++--- .../dotnet/client-010/wcf/model/QpidChannelBase.cs | 334 +++--- .../client-010/wcf/model/QpidChannelFactory.cs | 148 +-- .../client-010/wcf/model/QpidChannelListener.cs | 158 +-- .../wcf/model/QpidChannelListenerBase.cs | 222 ++-- .../client-010/wcf/model/QpidInputChannel.cs | 436 ++++---- .../client-010/wcf/model/QpidInputChannelBase.cs | 202 ++-- .../client-010/wcf/model/QpidOutputChannel.cs | 178 +-- .../client-010/wcf/model/QpidOutputChannelBase.cs | 154 +-- .../wcf/model/QpidTransportBindingElement.cs | 372 +++---- .../client-010/wcf/model/QpidTransportElement.cs | 364 +++--- qpid/dotnet/client-010/wcf/wcf.csproj | 116 +- qpid/dotnet/client-010/wcf/wcf.sln | 100 +- 151 files changed, 14379 insertions(+), 14379 deletions(-) (limited to 'qpid/dotnet/client-010') 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 /dotnet/client-010/gentool: - - $ cd /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 /dotnet/client-010/ - $ nant - - -To build for Mono on Linux (to bin/mono-2.0): - - $ cd /dotnet/client-010/ - $ nant -t:mono-2.0 - -Releasing -========= - -For .NET 2.0 - - $ cd /dotnet/client-010/ - $ nant release-pkg - -Generates ./bin/net-2.0/release/Qpid.NET-net-2.0-yyyyMMdd.zip - -For Mono - - $ cd /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 /dotnet/client-010/gentool: + + $ cd /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 /dotnet/client-010/ + $ nant + + +To build for Mono on Linux (to bin/mono-2.0): + + $ cd /dotnet/client-010/ + $ nant -t:mono-2.0 + +Releasing +========= + +For .NET 2.0 + + $ cd /dotnet/client-010/ + $ nant release-pkg + +Generates ./bin/net-2.0/release/Qpid.NET-net-2.0-yyyyMMdd.zip + +For Mono + + $ cd /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 @@ - - - - - - - - - - + + + + + + + + + + \ 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); - - /// - /// This interface must be implemented so to use a user defined message processor - /// - public interface MessageProcessor - { - string ProcessMessage(IMessage m); - } - - [ComVisible(true), ProgId("Qpid")] - public class ExcelAddIn : IRtdServer - { - private IRTDUpdateEvent _onMessage; - private readonly Dictionary _topicMessages = new Dictionary(); - private readonly Dictionary _queueListener = new Dictionary(); - private readonly Dictionary _topicQueueName = new Dictionary(); - private Client _client; - private ClientSession _session; - private ProcessMessage _messageProcessor; - - #region properties - - public IRTDUpdateEvent OnMessage - { - get { return _onMessage; } - } - - public Dictionary TopicMessages - { - get { return _topicMessages; } - } - - public ClientSession Session - { - get { return _session; } - } - - #endregion - - - #region IRtdServer Members - - /// - /// Called when Excel requests the first RTD topic for the server. - /// Connect to the broker, returns a on success and 0 otherwise - /// - /// - /// - 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; - } - - /// - /// Called whenever Excel requests a new RTD topic from the RealTimeData server. - /// - /// - /// - /// - /// - 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"; - } - - /// - /// Called whenever Excel no longer requires a specific topic. - /// - /// - 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 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 _topics = new List(); - - 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); + + /// + /// This interface must be implemented so to use a user defined message processor + /// + public interface MessageProcessor + { + string ProcessMessage(IMessage m); + } + + [ComVisible(true), ProgId("Qpid")] + public class ExcelAddIn : IRtdServer + { + private IRTDUpdateEvent _onMessage; + private readonly Dictionary _topicMessages = new Dictionary(); + private readonly Dictionary _queueListener = new Dictionary(); + private readonly Dictionary _topicQueueName = new Dictionary(); + private Client _client; + private ClientSession _session; + private ProcessMessage _messageProcessor; + + #region properties + + public IRTDUpdateEvent OnMessage + { + get { return _onMessage; } + } + + public Dictionary TopicMessages + { + get { return _topicMessages; } + } + + public ClientSession Session + { + get { return _session; } + } + + #endregion + + + #region IRtdServer Members + + /// + /// Called when Excel requests the first RTD topic for the server. + /// Connect to the broker, returns a on success and 0 otherwise + /// + /// + /// + 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; + } + + /// + /// Called whenever Excel requests a new RTD topic from the RealTimeData server. + /// + /// + /// + /// + /// + 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"; + } + + /// + /// Called whenever Excel no longer requires a specific topic. + /// + /// + 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 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 _topics = new List(); + + 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 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {C2AE83A3-D5D1-469D-8611-A4738B9997CF} - Library - Properties - ExcelAddInMessageProcessor - ExcelAddInMessageProcessor - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - {85EFD719-39F6-4471-90FF-9E621430344B} - ExcelAddIn - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {C2AE83A3-D5D1-469D-8611-A4738B9997CF} + Library + Properties + ExcelAddInMessageProcessor + ExcelAddInMessageProcessor + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + {85EFD719-39F6-4471-90FF-9E621430344B} + ExcelAddIn + + + + \ 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 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {80F00C3B-EB38-4B3B-9F77-68977A30B155} - Exe - Properties - ExcelAddInProducer - Qpid Excel AddIn Producer - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {80F00C3B-EB38-4B3B-9F77-68977A30B155} + Exe + Properties + ExcelAddInProducer + Qpid Excel AddIn Producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + \ 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: - - -- 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: + + +- 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 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {B911FFD7-754F-4735-A188-218D5065BE79} - Library - Properties - client - Qpid Client - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {B911FFD7-754F-4735-A188-218D5065BE79} + Library + Properties + client + Qpid Client + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + \ 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 index cfdbf4be93..0640275f99 100644 Binary files a/qpid/dotnet/client-010/client/client.suo and b/qpid/dotnet/client-010/client/client.suo differ 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 - - /// - /// Establishes a connection with a broker using the provided user auths - /// - /// - /// Host name on which a broker is deployed - /// Broker port - /// virtual host name - /// User Name - /// Password - 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(); - } - - /// - /// Establishes a connection with a broker using SSL - /// - /// - /// Host name on which a broker is deployed - /// Broker port - /// virtual host name - /// User Name - /// Password - /// Name of the SSL server - /// Path to the X509 certificate to be used for client authentication - /// If true connection will not be established if the broker is not trusted - 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 + + /// + /// Establishes a connection with a broker using the provided user auths + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + 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(); + } + + /// + /// Establishes a connection with a broker using SSL + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + /// Name of the SSL server + /// Path to the X509 certificate to be used for client authentication + /// If true connection will not be established if the broker is not trusted + 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 props = new Dictionary(); - 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 props = new Dictionary(); + 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 - { - /// - /// Establish a connection with the broker using the given parameters - /// - /// - /// host name - /// port number - /// virtualHost the virtual host name - /// username user name - /// password password - void connect(String host, int port, String virtualHost, String username, String passwor); - - /// - /// Close this client - /// - void close(); - - /// - /// Create a session for this connection. - /// The returned session is suspended - /// (i.e. this session is not attached to an underlying channel) - /// - /// Expiry time expressed in seconds, if the value is less than - /// or equal to 0 then the session does not expire. - /// A newly created (suspended) session. - ClientSession createSession(long expiryInSeconds); - - /// - /// If the communication layer detects a serious problem with a connection, it - // informs the client's ClosedListener - /// - /// - 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 + { + /// + /// Establish a connection with the broker using the given parameters + /// + /// + /// host name + /// port number + /// virtualHost the virtual host name + /// username user name + /// password password + void connect(String host, int port, String virtualHost, String username, String passwor); + + /// + /// Close this client + /// + void close(); + + /// + /// Create a session for this connection. + /// The returned session is suspended + /// (i.e. this session is not attached to an underlying channel) + /// + /// Expiry time expressed in seconds, if the value is less than + /// or equal to 0 then the session does not expire. + /// A newly created (suspended) session. + ClientSession createSession(long expiryInSeconds); + + /// + /// If the communication layer detects a serious problem with a connection, it + // informs the client's ClosedListener + /// + /// + 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 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 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()); - } - - 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 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()); + } + + 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 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 - { - /// - /// Inform the listener of the message transfer - /// - /// The message transfer object - 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 + { + /// + /// Inform the listener of the message transfer + /// + /// The message transfer object + 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 -{ - - - /// - /// Binary - /// - - 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 +{ + + + /// + /// Binary + /// + + 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 -{ - /// - /// Binding - /// - internal interface Binding - { - E endpoint(Sender sender); - - Receiver receiver(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 +{ + /// + /// Binding + /// + internal interface Binding + { + E endpoint(Sender sender); + + Receiver receiver(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 -{ - /// - /// Channel - /// - public class Channel : Invoker, ProtocolDelegate - { - private static readonly Logger log = Logger.get(typeof (Channel)); - - private readonly Connection _connection; - private readonly int _channel; - private readonly MethodDelegate _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 payload) - { - if (payload.Payload.Channel == _channel) - { - payload.Payload.ProcessProtocolEvent(null, this); - } - } - - #region ProtocolDelegate - - 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 +{ + /// + /// Channel + /// + public class Channel : Invoker, ProtocolDelegate + { + private static readonly Logger log = Logger.get(typeof (Channel)); + + private readonly Connection _connection; + private readonly int _channel; + private readonly MethodDelegate _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 payload) + { + if (payload.Payload.Channel == _channel) + { + payload.Payload.ProcessProtocolEvent(null, this); + } + } + + #region ProtocolDelegate + + 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 -{ - /// - /// ChannelDelegate - /// - /// - internal class ChannelDelegate : MethodDelegate - { - 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 +{ + /// + /// ChannelDelegate + /// + /// + internal class ChannelDelegate : MethodDelegate + { + 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 -{ - /// - /// Connection - /// - public class Connection - { - private static readonly Logger log = Logger.get(typeof (Connection)); - - private readonly Sender _sender; - private readonly ConnectionDelegate _connDdelegate; - private int _channelMax = 1; - private int _connectionId; - private readonly Receiver> _receiver; - - private readonly Dictionary _channels = new Dictionary(); - - public Connection(Receiver> receiver, Sender 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 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 +{ + /// + /// Connection + /// + public class Connection + { + private static readonly Logger log = Logger.get(typeof (Connection)); + + private readonly Sender _sender; + private readonly ConnectionDelegate _connDdelegate; + private int _channelMax = 1; + private int _connectionId; + private readonly Receiver> _receiver; + + private readonly Dictionary _channels = new Dictionary(); + + public Connection(Receiver> receiver, Sender 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 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 -{ - /// - /// ConnectionDelegate - /// - /// Currently only implemented client specific methods - /// - public abstract class ConnectionDelegate : MethodDelegate - { - 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 plain = new List(); - plain.Add("PLAIN"); - List utf8 = new List(); - 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 props = new Dictionary(); - 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 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 +{ + /// + /// ConnectionDelegate + /// + /// Currently only implemented client specific methods + /// + public abstract class ConnectionDelegate : MethodDelegate + { + 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 plain = new List(); + plain.Add("PLAIN"); + List utf8 = new List(); + 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 props = new Dictionary(); + 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 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 -{ - /// - /// Field - /// - public abstract class Field - { - 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 +{ + /// + /// Field + /// + public abstract class Field + { + 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 -{ - /// - /// Future - /// - 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 +{ + /// + /// Future + /// + 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 -{ - /// - /// Header - /// - public class Header - { - private readonly Struct[] _mystructs; - - public Header(List 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 +{ + /// + /// Header + /// + public class Header + { + private readonly Struct[] _mystructs; + + public Header(List 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 -{ - /// - /// Method - /// - 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 context, MethodDelegate mdelegate ); - - #region ProtocolEvent - - public int Channel - { - get { return channel; } - set { channel = value; } - } - - public abstract byte EncodedTrack { get; set; } - - public void ProcessProtocolEvent(C context, ProtocolDelegate 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 +{ + /// + /// Method + /// + 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 context, MethodDelegate mdelegate ); + + #region ProtocolEvent + + public int Channel + { + get { return channel; } + set { channel = value; } + } + + public abstract byte EncodedTrack { get; set; } + + public void ProcessProtocolEvent(C context, ProtocolDelegate 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 -{ - /// - /// ProtocolDelegate - /// - public interface ProtocolDelegate - { - 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 +{ + /// + /// ProtocolDelegate + /// + public interface ProtocolDelegate + { + 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 -{ - /// - /// ProtocolError - /// - 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 context, ProtocolDelegate 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 +{ + /// + /// ProtocolError + /// + 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 context, ProtocolDelegate 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 -{ - /// - /// ProtocolEvent - /// - public interface ProtocolEvent - { - int Channel - { - get; - set; - } - - byte EncodedTrack - { - set; - get; - } - - void ProcessProtocolEvent(C context, ProtocolDelegate 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 +{ + /// + /// ProtocolEvent + /// + public interface ProtocolEvent + { + int Channel + { + get; + set; + } + + byte EncodedTrack + { + set; + get; + } + + void ProcessProtocolEvent(C context, ProtocolDelegate 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 -{ - /// ProtocolHeader - /// - /// - 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 context, ProtocolDelegate 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 +{ + /// ProtocolHeader + /// + /// + 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 context, ProtocolDelegate 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 -{ - - /// - /// Range - /// - - - 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 subtract(Range range) - { - List result = new List(); - - 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 +{ + + /// + /// Range + /// + + + 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 subtract(Range range) + { + List result = new List(); + + 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 -{ - /// - /// RangeSet - /// - public sealed class RangeSet : IEnumerable - { - private readonly List _ranges = new List(); - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public IEnumerator 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 +{ + /// + /// RangeSet + /// + public sealed class RangeSet : IEnumerable + { + private readonly List _ranges = new List(); + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public IEnumerator 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 : 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 : 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 -{ - /// - /// a receiver will raise an event when: - /// - data is received - /// - an exception is thrown - /// - it is closed - /// - public interface Receiver where T : EventArgs - { - event EventHandler Received; - event EventHandler 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 +{ + /// + /// a receiver will raise an event when: + /// - data is received + /// - an exception is thrown + /// - it is closed + /// + public interface Receiver where T : EventArgs + { + event EventHandler Received; + event EventHandler 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 -{ - /// - /// Sender - /// - public interface Sender - { - 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 +{ + /// + /// Sender + /// + public interface Sender + { + 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 -{ - /// - /// Session - /// - /// - 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 _commands = new Dictionary(); - private int _maxComplete = - 1; - private bool _needSync = false; - private bool _closed; - private readonly Dictionary _results = new Dictionary(); - private readonly List _exceptions = new List(); - - - 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 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 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 getExceptions() - { - lock (_exceptions) - { - return new List(_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 +{ + /// + /// Session + /// + /// + 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 _commands = new Dictionary(); + private int _maxComplete = - 1; + private bool _needSync = false; + private bool _closed; + private readonly Dictionary _results = new Dictionary(); + private readonly List _exceptions = new List(); + + + 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 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 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 getExceptions() + { + lock (_exceptions) + { + return new List(_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 -{ - /// - /// SessionDelegate - /// - /// - public abstract class SessionDelegate : MethodDelegate, ProtocolDelegate - { - 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 +{ + /// + /// SessionDelegate + /// + /// + public abstract class SessionDelegate : MethodDelegate, ProtocolDelegate + { + 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 -{ - /// - /// Struct - /// - - 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(Field f) - { - return Equals(f.Type, typeof(Boolean)); - } - - private bool packed() - { - return getPackWidth() > 0; - } - - private bool encoded(Field 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 Fields - { - get; - } - - public String toString() - { - StringBuilder str = new StringBuilder(); - str.Append(GetType()); - str.Append("("); - bool first = true; - foreach (KeyValuePair 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 +{ + /// + /// Struct + /// + + 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(Field f) + { + return Equals(f.Type, typeof(Boolean)); + } + + private bool packed() + { + return getPackWidth() > 0; + } + + private bool encoded(Field 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 Fields + { + get; + } + + public String toString() + { + StringBuilder str = new StringBuilder(); + str.Append(GetType()); + str.Append("("); + bool first = true; + foreach (KeyValuePair 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 -{ - /// - /// AbstractDecoder - /// - public abstract class AbstractDecoder : Decoder - { - private readonly Dictionary str8cache = new Dictionary(); - - 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 readMap() - { - long size = readUint32(); - - if (size == 0) - { - return null; - } - - long count = readUint32(); - - Dictionary result = new Dictionary(); - 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 readList() - { - long size = readUint32(); - - if (size == 0) - { - return null; - } - - long count = readUint32(); - - List result = new List(); - 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 readArray() - { - long size = readUint32(); - - if (size == 0) - { - return null; - } - - byte code = get(); - QpidType t = getType(code); - long count = readUint32(); - - List result = new List(); - 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 +{ + /// + /// AbstractDecoder + /// + public abstract class AbstractDecoder : Decoder + { + private readonly Dictionary str8cache = new Dictionary(); + + 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 readMap() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + Dictionary result = new Dictionary(); + 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 readList() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + long count = readUint32(); + + List result = new List(); + 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 readArray() + { + long size = readUint32(); + + if (size == 0) + { + return null; + } + + byte code = get(); + QpidType t = getType(code); + long count = readUint32(); + + List result = new List(); + 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 -{ - /// - /// AbstractEncoder - /// - public abstract class AbstractEncoder : Encoder - { - private static readonly Dictionary ENCODINGS = new Dictionary(); - private readonly Dictionary str8cache = new Dictionary(); - - 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), Code.MAP); - ENCODINGS.Add(typeof (List), 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 map) - { - int pos = beginSize32(); - if (map != null) - { - writeUint32(map.Count); - writeMapEntries(map); - } - endSize32(pos); - } - - protected void writeMapEntries(Dictionary map) - { - foreach (KeyValuePair 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 list) - { - int pos = beginSize32(); - if (list != null) - { - writeUint32(list.Count); - writeListEntries(list); - } - endSize32(pos); - } - - protected void writeListEntries(List list) - { - foreach (Object value in list) - { - Code type = encoding(value); - put((byte) type); - write(type, value); - } - } - - public void writeArray(List array) - { - int pos = beginSize32(); - if (array != null) - { - writeArrayEntries(array); - } - endSize32(pos); - } - - protected void writeArrayEntries(List 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) value); - break; - case Code.LIST: - writeList((List) value); - break; - case Code.ARRAY: - writeList((List) 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 +{ + /// + /// AbstractEncoder + /// + public abstract class AbstractEncoder : Encoder + { + private static readonly Dictionary ENCODINGS = new Dictionary(); + private readonly Dictionary str8cache = new Dictionary(); + + 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), Code.MAP); + ENCODINGS.Add(typeof (List), 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 map) + { + int pos = beginSize32(); + if (map != null) + { + writeUint32(map.Count); + writeMapEntries(map); + } + endSize32(pos); + } + + protected void writeMapEntries(Dictionary map) + { + foreach (KeyValuePair 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 list) + { + int pos = beginSize32(); + if (list != null) + { + writeUint32(list.Count); + writeListEntries(list); + } + endSize32(pos); + } + + protected void writeListEntries(List list) + { + foreach (Object value in list) + { + Code type = encoding(value); + put((byte) type); + write(type, value); + } + } + + public void writeArray(List array) + { + int pos = beginSize32(); + if (array != null) + { + writeArrayEntries(array); + } + endSize32(pos); + } + + protected void writeArrayEntries(List 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) value); + break; + case Code.LIST: + writeList((List) value); + break; + case Code.ARRAY: + writeList((List) 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 -{ - /// - /// Decoder - /// - - 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 readMap(); - List readList(); - List 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 +{ + /// + /// Decoder + /// + + 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 readMap(); + List readList(); + List 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 -{ - - - /// - /// Encodable - /// - - 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 +{ + + + /// + /// Encodable + /// + + 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 -{ - /// - /// Encoder - /// - - 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 map); - void writeList(List list); - void writeArray(List 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 +{ + /// + /// Encoder + /// + + 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 map); + void writeList(List list); + void writeArray(List 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 -{ - - - /// - /// MSDecoder - /// - /// - - - 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 +{ + + + /// + /// MSDecoder + /// + /// + + + 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 -{ - /// - /// MSEncoder - /// - 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 +{ + /// + /// MSEncoder + /// + 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 -{ - - - /// - /// ConnectionException - /// - - [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 +{ + + + /// + /// ConnectionException + /// + + [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 -{ - - - /// ProtocolVersionException - /// - /// - - [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 +{ + + + /// ProtocolVersionException + /// + /// + + [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 -{ - - - /// - /// SessionClosedException - /// - - public class SessionClosedException : SessionException - { - - public SessionClosedException(): base(new List()) - { - } - } +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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 +{ + + + /// + /// SessionClosedException + /// + + public class SessionClosedException : SessionException + { + + public SessionClosedException(): base(new List()) + { + } + } } \ 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 -{ - /// - /// SessionException - /// - public class SessionException : Exception - { - private readonly List _exceptions; - - public SessionException(List exceptions) - : base(exceptions.Count == 0 ? "" : exceptions.ToString()) - - { - _exceptions = exceptions; - } - - public List 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 +{ + /// + /// SessionException + /// + public class SessionException : Exception + { + private readonly List _exceptions; + + public SessionException(List exceptions) + : base(exceptions.Count == 0 ? "" : exceptions.ToString()) + + { + _exceptions = exceptions; + } + + public List 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 -{ - - - /// - /// TransportException - /// - - - 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 +{ + + + /// + /// TransportException + /// + + + 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 -{ - /// - /// Assembler - /// - public delegate void Processor(NetworkDelegate ndelegate); - - public class Assembler : NetworkDelegate, Receiver> - { - private static readonly Logger log = Logger.get(typeof (Assembler)); - private readonly Dictionary> 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> ReceivedEvent; - public event EventHandler ExceptionProcessing; - public event EventHandler HandlerClosed; - - event EventHandler> Receiver>.Received - { - add - { - lock (m_objectLock) - { - ReceivedEvent += value; - } - } - remove - { - lock (m_objectLock) - { - ReceivedEvent -= value; - } - } - } - - event EventHandler Receiver>.Exception - { - add - { - lock (m_objectLock) - { - ExceptionProcessing += value; - } - } - remove - { - lock (m_objectLock) - { - ExceptionProcessing -= value; - } - } - } - - event EventHandler Receiver>.Closed - { - add - { - lock (m_objectLock) - { - HandlerClosed += value; - } - } - remove - { - lock (m_objectLock) - { - HandlerClosed -= value; - } - } - } - - public Assembler() - { - segments = new Dictionary>(); - incomplete = new Method[64*1024]; - } - - // Invoked when a network event is received - public void On_ReceivedEvent(object sender, ReceivedPayload 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 frames; - if (frame.isFirstFrame()) - { - frames = new List(); - 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 structs = new List(); - 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 getSegment(Frame frame) - { - return segments[segmentKey(frame)]; - } - - private void setSegment(Frame frame, List 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 payload = new ReceivedPayload(); - 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 +{ + /// + /// Assembler + /// + public delegate void Processor(NetworkDelegate ndelegate); + + public class Assembler : NetworkDelegate, Receiver> + { + private static readonly Logger log = Logger.get(typeof (Assembler)); + private readonly Dictionary> 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> ReceivedEvent; + public event EventHandler ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver>.Closed + { + add + { + lock (m_objectLock) + { + HandlerClosed += value; + } + } + remove + { + lock (m_objectLock) + { + HandlerClosed -= value; + } + } + } + + public Assembler() + { + segments = new Dictionary>(); + incomplete = new Method[64*1024]; + } + + // Invoked when a network event is received + public void On_ReceivedEvent(object sender, ReceivedPayload 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 frames; + if (frame.isFirstFrame()) + { + frames = new List(); + 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 structs = new List(); + 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 getSegment(Frame frame) + { + return segments[segmentKey(frame)]; + } + + private void setSegment(Frame frame, List 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 payload = new ReceivedPayload(); + 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 -{ - /// - /// Disassembler - /// - public sealed class Disassembler : Sender, ProtocolDelegate - { - private readonly IIOSender _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 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 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 +{ + /// + /// Disassembler + /// + public sealed class Disassembler : Sender, ProtocolDelegate + { + private readonly IIOSender _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 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 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:Sender - { - 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:Sender + { + 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 -{ - /// - /// InputHandler - /// - public sealed class InputHandler : Receiver> - { - 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> ReceivedEvent; - public event EventHandler ExceptionProcessing; - public event EventHandler HandlerClosed; - - event EventHandler> Receiver>.Received - { - add - { - lock (m_objectLock) - { - ReceivedEvent += value; - } - } - remove - { - lock (m_objectLock) - { - ReceivedEvent -= value; - } - } - } - - event EventHandler Receiver>.Exception - { - add - { - lock (m_objectLock) - { - ExceptionProcessing += value; - } - } - remove - { - lock (m_objectLock) - { - ExceptionProcessing -= value; - } - } - } - - event EventHandler Receiver>.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 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 payload = new ReceivedPayload(); - 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 +{ + /// + /// InputHandler + /// + public sealed class InputHandler : Receiver> + { + 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> ReceivedEvent; + public event EventHandler ExceptionProcessing; + public event EventHandler HandlerClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedEvent += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedEvent -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionProcessing += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionProcessing -= value; + } + } + } + + event EventHandler Receiver>.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 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 payload = new ReceivedPayload(); + 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 -{ - - - /// - /// NetworkDelegate - /// - - 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 +{ + + + /// + /// NetworkDelegate + /// + + 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 -{ - - /// - /// NetworkEvent - /// - - 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 +{ + + /// + /// NetworkEvent + /// + + 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> 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> 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 -{ - /// - /// IoReceiver - /// - public sealed class IoReceiver : Receiver> - { - 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> ReceivedBuffer; - event EventHandler ExceptionReading; - event EventHandler ReceiverClosed; - - event EventHandler> Receiver>.Received - { - add - { - lock (m_objectLock) - { - ReceivedBuffer += value; - } - } - remove - { - lock (m_objectLock) - { - ReceivedBuffer -= value; - } - } - } - - event EventHandler Receiver>.Exception - { - add - { - lock (m_objectLock) - { - ExceptionReading += value; - } - } - remove - { - lock (m_objectLock) - { - ExceptionReading -= value; - } - } - } - - event EventHandler Receiver>.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 payload = new ReceivedPayload(); - 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 +{ + /// + /// IoReceiver + /// + public sealed class IoReceiver : Receiver> + { + 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> ReceivedBuffer; + event EventHandler ExceptionReading; + event EventHandler ReceiverClosed; + + event EventHandler> Receiver>.Received + { + add + { + lock (m_objectLock) + { + ReceivedBuffer += value; + } + } + remove + { + lock (m_objectLock) + { + ReceivedBuffer -= value; + } + } + } + + event EventHandler Receiver>.Exception + { + add + { + lock (m_objectLock) + { + ExceptionReading += value; + } + } + remove + { + lock (m_objectLock) + { + ExceptionReading -= value; + } + } + } + + event EventHandler Receiver>.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 payload = new ReceivedPayload(); + 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> 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> 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> 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> 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 - { - 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 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(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 + { + 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 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(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 -{ - /// - /// 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 - /// - 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> 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> 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 +{ + /// + /// 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 + /// + 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> 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> 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 - /// - /// Returns the value encoded in Big Endian (PPC, XDR) format. - /// - /// Value to encode. - /// Big-endian encoded value. - public static Int32 GetBigEndian(Int32 value) - { - if (BitConverter.IsLittleEndian) - { - return swapByteOrder(value); - } - return value; - } - - /// - /// Returns the value encoded in Big Endian (PPC, XDR) format. - /// - /// Value to encode. - /// Big-endian encoded value. - public static UInt16 GetBigEndian(UInt16 value) - { - if (BitConverter.IsLittleEndian) - { - return swapByteOrder(value); - } - return value; - } - - /// - /// Returns the value encoded in Big Endian (PPC, XDR) format. - /// - /// Value to encode. - /// Big-endian encoded value. - public static UInt32 GetBigEndian(UInt32 value) - { - if (BitConverter.IsLittleEndian) - { - return swapByteOrder(value); - } - return value; - } - - /// - /// Returns the value encoded in Big Endian (PPC, XDR) format. - /// - /// Value to encode. - /// Big-endian encoded value. - 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; - } - - /// - /// Returns the value encoded in Little Endian (x86, NDR) format. - /// - /// Value to encode. - /// Little-endian encoded value. - public static Int32 GetLittleEndian(Int32 value) - { - if (BitConverter.IsLittleEndian) - { - return value; - } - return swapByteOrder(value); - } - - /// - /// Returns the value encoded in Little Endian (x86, NDR) format. - /// - /// Value to encode. - /// Little-endian encoded value. - public static UInt32 GetLittleEndian(UInt32 value) - { - if (BitConverter.IsLittleEndian) - { - return value; - } - return swapByteOrder(value); - } - - /// - /// Returns the value encoded in Little Endian (x86, NDR) format. - /// - /// Value to encode. - /// Little-endian encoded value. - public static UInt16 GetLittleEndian(UInt16 value) - { - if (BitConverter.IsLittleEndian) - { - return value; - } - return swapByteOrder(value); - } - - /// - /// Returns the value encoded in Little Endian (x86, NDR) format. - /// - /// Value to encode. - /// Little-endian encoded value. - 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); - } - - /// - /// Swaps the Byte order of an . - /// - /// to swap the bytes of. - /// Byte order swapped . - private static Int32 swapByteOrder(Int32 value) - { - Int32 swapped = (Int32)((0x000000FF) & (value >> 24) - | (0x0000FF00) & (value >> 8) - | (0x00FF0000) & (value << 8) - | (0xFF000000) & (value << 24)); - return swapped; - } - - /// - /// Swaps the byte order of a . - /// - /// to swap the bytes of. - /// Byte order swapped . - private static UInt16 swapByteOrder(UInt16 value) - { - return (UInt16)((0x00FF & (value >> 8)) - | (0xFF00 & (value << 8))); - } - - /// - /// Swaps the byte order of a . - /// - /// to swap the bytes of. - /// Byte order swapped . - private static UInt32 swapByteOrder(UInt32 value) - { - UInt32 swapped = ((0x000000FF) & (value >> 24) - | (0x0000FF00) & (value >> 8) - | (0x00FF0000) & (value << 8) - | (0xFF000000) & (value << 24)); - return swapped; - } - - /// - /// Swaps the byte order of a (double precision IEEE 754) - /// - /// to swap. - /// Byte order swapped value. - 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 + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static Int32 GetBigEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static UInt16 GetBigEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + public static UInt32 GetBigEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return swapByteOrder(value); + } + return value; + } + + /// + /// Returns the value encoded in Big Endian (PPC, XDR) format. + /// + /// Value to encode. + /// Big-endian encoded value. + 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; + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static Int32 GetLittleEndian(Int32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static UInt32 GetLittleEndian(UInt32 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + public static UInt16 GetLittleEndian(UInt16 value) + { + if (BitConverter.IsLittleEndian) + { + return value; + } + return swapByteOrder(value); + } + + /// + /// Returns the value encoded in Little Endian (x86, NDR) format. + /// + /// Value to encode. + /// Little-endian encoded value. + 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); + } + + /// + /// Swaps the Byte order of an . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static Int32 swapByteOrder(Int32 value) + { + Int32 swapped = (Int32)((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// + /// Swaps the byte order of a . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static UInt16 swapByteOrder(UInt16 value) + { + return (UInt16)((0x00FF & (value >> 8)) + | (0xFF00 & (value << 8))); + } + + /// + /// Swaps the byte order of a . + /// + /// to swap the bytes of. + /// Byte order swapped . + private static UInt32 swapByteOrder(UInt32 value) + { + UInt32 swapped = ((0x000000FF) & (value >> 24) + | (0x0000FF00) & (value >> 8) + | (0x00FF0000) & (value << 8) + | (0xFF000000) & (value << 24)); + return swapped; + } + + /// + /// Swaps the byte order of a (double precision IEEE 754) + /// + /// to swap. + /// Byte order swapped value. + 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 - { - private readonly T[] buffer; - private Int32 nrp, nwp; - private readonly Int32 len; - private Int32 countValue; - private readonly Int32 add; - - - /// - /// Constructor creates N=len element - /// Circular Buffer that olds MemoryStream - /// - 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 + { + private readonly T[] buffer; + private Int32 nrp, nwp; + private readonly Int32 len; + private Int32 countValue; + private readonly Int32 add; + + + /// + /// Constructor creates N=len element + /// Circular Buffer that olds MemoryStream + /// + 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 -{ - - /// - /// Functions - /// - - 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 +{ + + /// + /// Functions + /// + + 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 -{ - - /// Logger - /// - /// - - 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 +{ + + /// Logger + /// + /// + + 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 -{ - /// - /// This class provides basic serial number comparisons as defined in - /// RFC 1982. - /// - 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 +{ + /// + /// This class provides basic serial number comparisons as defined in + /// RFC 1982. + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E4C46FBC-7560-406D-BFEF-CA010E584DF4} - WinExe - Properties - demo - Qpid Demo - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {E4C46FBC-7560-406D-BFEF-CA010E584DF4} + WinExe + Properties + demo + Qpid Demo + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + \ 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 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -namespace demo.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // 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() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [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; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace demo.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ 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 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -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; - } - } - } -} +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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 @@ - - - - - - - + + + + + + + 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} - Exe - Properties - example_direct_Listener - example-direct-Listener - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} + Exe + Properties + example_direct_Listener + example-direct-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {96FCB250-8142-40EE-9BDD-CA839EE21021} - Exe - Properties - example_direct_producer - example-direct-producer - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {96FCB250-8142-40EE-9BDD-CA839EE21021} + Exe + Properties + example_direct_producer + example-direct-producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} - Exe - Properties - example_fanout_Listener - example-fanout-Listener - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} + Exe + Properties + example_fanout_Listener + example-fanout-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {4513BF94-D54A-42FE-8506-FE2CD57B2C51} - Exe - Properties - example_fanout_Producer - example-fanout-Producer - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {4513BF94-D54A-42FE-8506-FE2CD57B2C51} + Exe + Properties + example_fanout_Producer + example-fanout-Producer + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} - Exe - Properties - example_pub_sub_Listener - example-pub-sub-Listener - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} + Exe + Properties + example_pub_sub_Listener + example-pub-sub-Listener + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {F8857634-A134-44E7-A953-F2B22688C599} - Exe - Properties - example_pub_sub_Publisher - example-pub-sub-Publisher - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {F8857634-A134-44E7-A953-F2B22688C599} + Exe + Properties + example_pub_sub_Publisher + example-pub-sub-Publisher + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1BC63815-4029-4039-9207-35E7E06ECC99} - Exe - Properties - example_request_response_Client - example-request-response-Client - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {1BC63815-4029-4039-9207-35E7E06ECC99} + Exe + Properties + example_request_response_Client + example-request-response-Client + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 -{ - /// - /// 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. - /// - /// - 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 +{ + /// + /// 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. + /// + /// + 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {922FBA9C-E483-4AEF-ABE8-AC87421E829B} - Exe - Properties - example_request_response_Server - example-request-response-Server - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {922FBA9C-E483-4AEF-ABE8-AC87421E829B} + Exe + Properties + example_request_response_Server + example-request-response-Server + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 -and wait for it to complete. The remaining process should run concurrently: -Run -Pubs times: Perftest.exe -Publish -Run -Subs times: Perftest.exe -Subscribe -Run once: Perftest.exe -Control -Note the 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 +and wait for it to complete. The remaining process should run concurrently: +Run -Pubs times: Perftest.exe -Publish +Run -Subs times: Perftest.exe -Subscribe +Run once: Perftest.exe -Control +Note the 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} - Exe - Properties - perftest - perftest - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\plossum\C5.dll - - - False - ..\lib\plossum\Plossum CommandLine.dll - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} + Exe + Properties + perftest + perftest + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\plossum\C5.dll + + + False + ..\lib\plossum\Plossum CommandLine.dll + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {95CB4C90-7C53-44A9-B11C-96235F158ACA} - Library - Properties - test - Qpid Test - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\lib\log4net\log4net.dll - - - False - ..\lib\nunit\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - {B911FFD7-754F-4735-A188-218D5065BE79} - Client - - - + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {95CB4C90-7C53-44A9-B11C-96235F158ACA} + Library + Properties + test + Qpid Test + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\lib\log4net\log4net.dll + + + False + ..\lib\nunit\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + --> \ 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 buff = new CircularBuffer(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 buff = new CircularBuffer(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 _properties = new Dictionary(); - 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 Properties - { - get { return _properties; } - } - - - public class SyncListener : IMessageListener - { - private static readonly Logger _log = Logger.get(typeof(SyncListener)); - private readonly CircularBuffer _buffer; - private readonly RangeSet _range = new RangeSet(); - private readonly ClientSession _session; - - public SyncListener(ClientSession session, CircularBuffer 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 _properties = new Dictionary(); + 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 Properties + { + get { return _properties; } + } + + + public class SyncListener : IMessageListener + { + private static readonly Logger _log = Logger.get(typeof(SyncListener)); + private readonly CircularBuffer _buffer; + private readonly RangeSet _range = new RangeSet(); + private readonly ClientSession _session; + + public SyncListener(ClientSession session, CircularBuffer 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 _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(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(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 _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(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(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 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 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 _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(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 _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(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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + \ 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ 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 @@ - - - - - - - + + + + + + + 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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {4086B3FE-F745-4DCC-952A-682CAE01F4C9} - WinExe - Properties - WindowsFormsBooking - Booking Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - Form - - - Form1.cs - - - - - Form1.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - {B34E21C4-A742-4886-8569-1A89490E093E} - wcfBookingServer - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4086B3FE-F745-4DCC-952A-682CAE01F4C9} + WinExe + Properties + WindowsFormsBooking + Booking Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + {B34E21C4-A742-4886-8569-1A89490E093E} + wcfBookingServer + + + + --> \ 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 _orders; - - public Booking() - { - _id = Guid.NewGuid(); - _orders = new List(); - } - - 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 _orders; + + public Booking() + { + _id = Guid.NewGuid(); + _orders = new List(); + } + + 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 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(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 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(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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {B34E21C4-A742-4886-8569-1A89490E093E} - Exe - Properties - wcfSession - Booking Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - - 3.0 - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {B34E21C4-A742-4886-8569-1A89490E093E} + Exe + Properties + wcfSession + Booking Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.0 + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + --> \ 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 - { - 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 + { + 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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A24E27DB-A38D-40C9-9879-8390B68C2F06} - Exe - Properties - wcfHelloClient - Qpid WCF Hello Client - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.0 - - - - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {A24E27DB-A38D-40C9-9879-8390B68C2F06} + Exe + Properties + wcfHelloClient + Qpid WCF Hello Client + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.0 + + + + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + --> \ 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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} - Exe - Properties - wcfHelloServer - Qpid WCF Hello Server - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.0 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {3EF848D7-5FAC-482C-922A-D4D45A4CCD2A} + Exe + Properties + wcfHelloServer + Qpid WCF Hello Server + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.0 + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + --> \ 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 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(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 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(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 -{ - - /// - /// This configuration element should be imported into the client - /// and server configuration files to provide declarative configuration - /// of a AMQP bound service. - /// - public sealed class QpidBindingConfigurationElement : StandardBindingElement - { - /// - /// Creates a new instance of the QpidBindingConfigurationElement - /// Class initialized with values from the specified configuration. - /// - /// - public QpidBindingConfigurationElement(string configurationName) - : base(configurationName) - { - } - - /// - /// Creates a new instance of the RabbitMQBindingConfigurationElement Class. - /// - 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; - } - - - /// - /// Specifies the host that the binding should connect to. - /// - [ConfigurationProperty("host", DefaultValue = "localhost")] - public string Host - { - get { return ((string) base["host"]); } - set { base["host"] = value; } - } - - /// - /// Specifies the broker port number that the binding should connect to. - /// - [ConfigurationProperty("port", DefaultValue = "5672")] - public int PortNumber - { - get { return (Convert.ToInt16(base["port"])); } - set { base["port"] = value; } - } - - - /// - /// Specifies whether or not the CompositeDuplex and ReliableSession - /// binding elements are added to the channel stack. - /// - [ConfigurationProperty("oneWay", DefaultValue = false)] - public bool OneWayOnly - { - get { return ((bool)base["oneWay"]); } - set { base["oneWay"] = value; } - } - - /// - /// Password to use when authenticating with the broker - /// - [ConfigurationProperty("password", DefaultValue = "guest")] - public string Password - { - get { return ((string)base["password"]); } - set { base["password"] = value; } - } - - /// - /// Specifies whether or not WS-AtomicTransactions are supported by the binding - /// - [ConfigurationProperty("transactionFlow", DefaultValue = false)] - public bool TransactionFlowEnabled - { - get { return ((bool)base["transactionFlow"]); } - set { base["transactionFlow"] = value; } - } - - /// - /// The username to use when authenticating with the broker - /// - [ConfigurationProperty("username", DefaultValue = "guest")] - public string UserName - { - get { return ((string)base["username"]); } - set { base["username"] = value; } - } - - - - - /// - /// The virtual host to access. - /// - [ConfigurationProperty("virtualHost", DefaultValue = "test")] - public string VirtualHost - { - get { return ((string)base["virtualHost"]); } - set { base["virtualHost"] = value; } - } - - ///The security realm to use when calling IModel.AccessRequest - [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 +{ + + /// + /// This configuration element should be imported into the client + /// and server configuration files to provide declarative configuration + /// of a AMQP bound service. + /// + public sealed class QpidBindingConfigurationElement : StandardBindingElement + { + /// + /// Creates a new instance of the QpidBindingConfigurationElement + /// Class initialized with values from the specified configuration. + /// + /// + public QpidBindingConfigurationElement(string configurationName) + : base(configurationName) + { + } + + /// + /// Creates a new instance of the RabbitMQBindingConfigurationElement Class. + /// + 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; + } + + + /// + /// Specifies the host that the binding should connect to. + /// + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// + /// Specifies the broker port number that the binding should connect to. + /// + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + + /// + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// + [ConfigurationProperty("oneWay", DefaultValue = false)] + public bool OneWayOnly + { + get { return ((bool)base["oneWay"]); } + set { base["oneWay"] = value; } + } + + /// + /// Password to use when authenticating with the broker + /// + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// + /// Specifies whether or not WS-AtomicTransactions are supported by the binding + /// + [ConfigurationProperty("transactionFlow", DefaultValue = false)] + public bool TransactionFlowEnabled + { + get { return ((bool)base["transactionFlow"]); } + set { base["transactionFlow"] = value; } + } + + /// + /// The username to use when authenticating with the broker + /// + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + + + /// + /// The virtual host to access. + /// + [ConfigurationProperty("virtualHost", DefaultValue = "test")] + public string VirtualHost + { + get { return ((string)base["virtualHost"]); } + set { base["virtualHost"] = value; } + } + + ///The security realm to use when calling IModel.AccessRequest + [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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C988F456-1025-486F-9BCD-49C0F83B91DB} - Exe - Properties - wcfRPC - Qpid WCF UpperCase - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - 3.5 - - - - 3.0 - - - - 3.5 - - - 3.5 - - - - - - - - - - - - - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - wcf - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {C988F456-1025-486F-9BCD-49C0F83B91DB} + Exe + Properties + wcfRPC + Qpid WCF UpperCase + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + 3.0 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + wcf + + + + --> \ 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(TimeSpan timeout); - internal delegate TResult CommunicationOperation(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(TimeSpan timeout); + internal delegate TResult CommunicationOperation(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; - } - - - - /// - /// Gets the scheme used by the binding, soap.amqp - /// - public override string Scheme - { - get { return "soap.amqp"; } - } - - /// - /// Specifies the broker host - /// - [ConfigurationProperty("host")] - public string Host - { - get { return _host; } - set { _host = value; } - } - - /// - /// Specifies the broker port - /// - public int PortNumber - { - get { return _port; } - set { _port = value; } - } - - /// - /// Specifies the username - /// - public string UserName - { - get { return _username; } - set { _username = value; } - } - - /// - /// Specifies the password - /// - public string Password - { - get { return _password; } - set { _password = value; } - } - - /// - /// Specifies the virtualhost - /// - public string VirtualHost - { - get { return _virtuaHost; } - set { _virtuaHost = value; } - } - - - /// - /// Gets the AMQP _transport binding element - /// - public QpidTransportBindingElement Transport - { - get { return _transport; } - } - - /// - /// Gets the reliable _session parameters for this binding instance - /// - public ReliableSession ReliableSession - { - get { return new ReliableSession(_session); } - } - - /// - /// Determines whether or not the TransactionFlowBindingElement will - /// be added to the channel stack - /// - public bool TransactionFlow - { - get { return _transactionsEnabled; } - set { _transactionsEnabled = value; } - } - - /// - /// Specifies whether or not the CompositeDuplex and ReliableSession - /// binding elements are added to the channel stack. - /// - 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; + } + + + + /// + /// Gets the scheme used by the binding, soap.amqp + /// + public override string Scheme + { + get { return "soap.amqp"; } + } + + /// + /// Specifies the broker host + /// + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// + /// Specifies the broker port + /// + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// + /// Specifies the username + /// + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// + /// Specifies the password + /// + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// + /// Specifies the virtualhost + /// + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + + /// + /// Gets the AMQP _transport binding element + /// + public QpidTransportBindingElement Transport + { + get { return _transport; } + } + + /// + /// Gets the reliable _session parameters for this binding instance + /// + public ReliableSession ReliableSession + { + get { return new ReliableSession(_session); } + } + + /// + /// Determines whether or not the TransactionFlowBindingElement will + /// be added to the channel stack + /// + public bool TransactionFlow + { + get { return _transactionsEnabled; } + set { _transactionsEnabled = value; } + } + + /// + /// Specifies whether or not the CompositeDuplex and ReliableSession + /// binding elements are added to the channel stack. + /// + 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() 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() 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 - { - 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(); - } - - 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 + { + 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(); + } + + 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 - { - - 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 + { + + 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 : ChannelListenerBase 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 _acceptChannelMethod; - private readonly CommunicationOperation _waitForChannelMethod; - - protected QpidChannelListenerBase(BindingContext context) - { - _context = context; - _bindingElement = context.Binding.Elements.Find(); - _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 : ChannelListenerBase 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 _acceptChannelMethod; + private readonly CommunicationOperation _waitForChannelMethod; + + protected QpidChannelListenerBase(BindingContext context) + { + _context = context; + _bindingElement = context.Binding.Elements.Find(); + _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(); - var encoderElem = context.BindingParameters.Find(); - 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 _queue = new Queue(); - - 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(); + var encoderElem = context.BindingParameters.Find(); + 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 _queue = new Queue(); + + 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 _receiveMethod; - private readonly CommunicationOperation _tryReceiveMethod; - private readonly CommunicationOperation _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 _receiveMethod; + private readonly CommunicationOperation _tryReceiveMethod; + private readonly CommunicationOperation _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(); - 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(); + 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; - - /// - /// Creates a new instance of the QpidTransportBindingElement Class - /// - 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 BuildChannelFactory(BindingContext context) - { - if (Host == null) - throw new InvalidOperationException("No broker was specified."); - return (IChannelFactory) new QpidChannelFactory(context); - } - - public override IChannelListener BuildChannelListener(BindingContext context) - { - if (Host == null) - throw new InvalidOperationException("No broker was specified."); - - return (IChannelListener) ((object) new QpidChannelListener(context)); - } - - public override bool CanBuildChannelFactory(BindingContext context) - { - return typeof (TChannel) == typeof (IOutputChannel); - } - - public override bool CanBuildChannelListener(BindingContext context) - { - return typeof (TChannel) == typeof (IInputChannel); - } - - public override BindingElement Clone() - { - return new QpidTransportBindingElement(this); - } - - public override T GetProperty(BindingContext context) - { - return context.GetInnerProperty(); - } - - /// - /// Gets the scheme used by the binding, this is 0.10 as default for now. - /// - public override string Scheme - { - get { return "soap.amqp"; } - } - - - /// - /// Specifies the broker host - /// - [ConfigurationProperty("host")] - public string Host - { - get { return _host; } - set { _host = value; } - } - - /// - /// Specifies the broker port - /// - public int PortNumber - { - get { return _port; } - set { _port = value; } - } - - /// - /// Specifies the username - /// - public string UserName - { - get { return _username; } - set { _username = value; } - } - - /// - /// Specifies the password - /// - public string Password - { - get { return _password; } - set { _password = value; } - } - - /// - /// Specifies the virtualhost - /// - public string VirtualHost - { - get { return _virtuaHost; } - set { _virtuaHost = value; } - } - - /// - /// Specifies the connection - /// - 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; + + /// + /// Creates a new instance of the QpidTransportBindingElement Class + /// + 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 BuildChannelFactory(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + return (IChannelFactory) new QpidChannelFactory(context); + } + + public override IChannelListener BuildChannelListener(BindingContext context) + { + if (Host == null) + throw new InvalidOperationException("No broker was specified."); + + return (IChannelListener) ((object) new QpidChannelListener(context)); + } + + public override bool CanBuildChannelFactory(BindingContext context) + { + return typeof (TChannel) == typeof (IOutputChannel); + } + + public override bool CanBuildChannelListener(BindingContext context) + { + return typeof (TChannel) == typeof (IInputChannel); + } + + public override BindingElement Clone() + { + return new QpidTransportBindingElement(this); + } + + public override T GetProperty(BindingContext context) + { + return context.GetInnerProperty(); + } + + /// + /// Gets the scheme used by the binding, this is 0.10 as default for now. + /// + public override string Scheme + { + get { return "soap.amqp"; } + } + + + /// + /// Specifies the broker host + /// + [ConfigurationProperty("host")] + public string Host + { + get { return _host; } + set { _host = value; } + } + + /// + /// Specifies the broker port + /// + public int PortNumber + { + get { return _port; } + set { _port = value; } + } + + /// + /// Specifies the username + /// + public string UserName + { + get { return _username; } + set { _username = value; } + } + + /// + /// Specifies the password + /// + public string Password + { + get { return _password; } + set { _password = value; } + } + + /// + /// Specifies the virtualhost + /// + public string VirtualHost + { + get { return _virtuaHost; } + set { _virtuaHost = value; } + } + + /// + /// Specifies the connection + /// + 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); } - } - - - - /// - /// Specifies the broker host name that the binding should connect to. - /// - [ConfigurationProperty("host", DefaultValue = "localhost")] - public string Host - { - get { return ((string) base["host"]); } - set { base["host"] = value; } - } - - /// - /// Specifies the broker port number that the binding should connect to. - /// - [ConfigurationProperty("port", DefaultValue = "5672")] - public int PortNumber - { - get { return (Convert.ToInt16(base["port"])); } - set { base["port"] = value; } - } - - /// - /// Password to use when authenticating with the broker - /// - [ConfigurationProperty("password", DefaultValue = "guest")] - public string Password - { - get { return ((string)base["password"]); } - set { base["password"] = value; } - } - - /// - /// The username to use when authenticating with the broker - /// - [ConfigurationProperty("username", DefaultValue = "guest")] - public string UserName - { - get { return ((string)base["username"]); } - set { base["username"] = value; } - } - - - /// - /// The virtual host to access. - /// - [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); } + } + + + + /// + /// Specifies the broker host name that the binding should connect to. + /// + [ConfigurationProperty("host", DefaultValue = "localhost")] + public string Host + { + get { return ((string) base["host"]); } + set { base["host"] = value; } + } + + /// + /// Specifies the broker port number that the binding should connect to. + /// + [ConfigurationProperty("port", DefaultValue = "5672")] + public int PortNumber + { + get { return (Convert.ToInt16(base["port"])); } + set { base["port"] = value; } + } + + /// + /// Password to use when authenticating with the broker + /// + [ConfigurationProperty("password", DefaultValue = "guest")] + public string Password + { + get { return ((string)base["password"]); } + set { base["password"] = value; } + } + + /// + /// The username to use when authenticating with the broker + /// + [ConfigurationProperty("username", DefaultValue = "guest")] + public string UserName + { + get { return ((string)base["username"]); } + set { base["username"] = value; } + } + + + /// + /// The virtual host to access. + /// + [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 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} - Library - Properties - WCF - qpidWCFModel - v3.5 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\client\bin\Debug\Qpid Client.dll - - - - - 3.0 - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {F1D80D9D-FE22-4213-A760-BFFDE7D131DD} + Library + Properties + WCF + qpidWCFModel + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\client\bin\Debug\Qpid Client.dll + + + + + 3.0 + + + + + + + + + + + \ 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 -- cgit v1.2.1 From e1c972fcabcdb5492f9a7eda1327d5584a101dc6 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 3 Dec 2009 22:12:06 +0000 Subject: QPID-1972: fix UUID generation. Patch from julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@886945 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/client/transport/util/UUID.cs | 34 +++++++++++++--------- .../client-010/test/transport/util/UUIDTest.cs | 10 ++++--- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/util/UUID.cs b/qpid/dotnet/client-010/client/transport/util/UUID.cs index 2cbbd460bc..07a3d267a5 100644 --- a/qpid/dotnet/client-010/client/transport/util/UUID.cs +++ b/qpid/dotnet/client-010/client/transport/util/UUID.cs @@ -26,9 +26,9 @@ namespace org.apache.qpid.transport.util public class UUID { private long _mostSigBits; - private long _leastSigBits; private static readonly Random _random = new Random(); + private static readonly object _randomLock = new object(); public UUID(long mostSigBits, long leastSigBits) @@ -49,7 +49,7 @@ namespace org.apache.qpid.transport.util set { _leastSigBits = value; } } - private UUID(byte[] r) + internal UUID(byte[] r) { MostSignificantBits = 0; LeastSignificantBits = 0; @@ -59,27 +59,33 @@ namespace org.apache.qpid.transport.util LeastSignificantBits = (LeastSignificantBits << 8) | (r[i] & 0xff); } - public static UUID randomUUID() + public static UUID RandomUuid() { byte[] randomBytes = new byte[16]; - _random.NextBytes(randomBytes); - randomBytes[6] &= 0x0f; - randomBytes[6] |= 0x40; - randomBytes[8] &= 0x3f; - randomBytes[8] |= 0x80; + lock (_randomLock) + { + _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)); + 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) + private static String Digits(long val, int digits) { long hi = 1L << (digits * 4); return Convert.ToString((hi | (val & (hi - 1))), 16); diff --git a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs index c1d460c59f..41104f8873 100644 --- a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs @@ -28,20 +28,22 @@ namespace test.transport.util public class UUIDTest { + + [Test] public void createUUID() { - UUID uuid = UUID.randomUUID(); + UUID uuid = UUID.RandomUuid(); String uuidStr = uuid.ToString(); Assert.IsNotNull(uuid); - UUID uuid2 = UUID.randomUUID(); + UUID uuid2 = UUID.RandomUuid(); Assert.AreNotSame(uuid, uuid2); } [Test] public void ToString_should_override_and_not_hide_base() { - UUID uuid = UUID.randomUUID(); + UUID uuid = UUID.RandomUuid(); string uuidStr = uuid.ToString(); string uuidConcat = "Test." + uuid; @@ -52,7 +54,7 @@ namespace test.transport.util [Test] public void two_uuid_with_same_value_should_have_same_hash_code() { - UUID uuid = UUID.randomUUID(); + UUID uuid = UUID.RandomUuid(); UUID uuid2 = new UUID(uuid.MostSignificantBits, uuid.LeastSignificantBits); Assert.AreEqual(uuid, uuid2); -- cgit v1.2.1 From 9bdc4125895b38815689e8920ea94687027caf7e Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 3 Dec 2009 22:13:22 +0000 Subject: QPID-1987: make code generation match .Net conventions. Patch from julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@886946 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/gentool/Composite.tpl | 61 +++++++++++------------ qpid/dotnet/client-010/gentool/Enum.tpl | 2 +- qpid/dotnet/client-010/gentool/Invoker.tpl | 14 +++--- qpid/dotnet/client-010/gentool/MethodDelegate.tpl | 2 +- qpid/dotnet/client-010/gentool/build.xml | 2 +- qpid/dotnet/client-010/gentool/codegen | 1 + qpid/dotnet/client-010/gentool/dotnetgenutil.py | 44 ++++++++-------- 7 files changed, 61 insertions(+), 65 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/gentool/Composite.tpl b/qpid/dotnet/client-010/gentool/Composite.tpl index 8f16d20189..c5a1099ef3 100644 --- a/qpid/dotnet/client-010/gentool/Composite.tpl +++ b/qpid/dotnet/client-010/gentool/Composite.tpl @@ -74,19 +74,19 @@ public sealed class $name : $base { public const int TYPE = $typecode; - public override int getStructType() { + public override int GetStructType() { return TYPE; } - public override int getSizeWidth() { + public override int GetSizeWidth() { return $size; } - public override int getPackWidth() { + public override int GetPackWidth() { return $pack; } - public $override bool hasPayload() { + public $override bool HasPayload() { return $payload; } @@ -131,8 +131,8 @@ if segments: if options or base == "Method": out(""" - for (int i=0; i < _options.Length; i++) { - switch (_options[i]) { + for (int i=0; i < options.Length; i++) { + switch (options[i]) { """) for f in options: @@ -143,26 +143,26 @@ if options or base == "Method": case Option.BATCH: Batch = true; break; """) out(""" case Option.NONE: break; - default: throw new Exception("invalid option: " + _options[i]); + default: throw new Exception("invalid option: " + options[i]); } } """) } } - public $override void dispatch(C context, MethodDelegate mdelegate) { - mdelegate.$(dromedary(name))(context, this); + public $override void Dispatch(C context, MethodDelegate mdelegate) { + mdelegate.$(name)(context, this); } ${ for f in fields: if pack > 0: out(""" - public bool $(f.has)() { + public bool $(f.has)() { return (packing_flags & $(f.flag_mask(pack))) != 0; } - public $name $(f.clear)() { + public $name $(f.clear)() { packing_flags = (byte) (packing_flags & ~$(f.flag_mask(pack))); ${ if (not f.empty and not (f.default == "null")): @@ -174,7 +174,7 @@ if (not f.empty and not (f.default == "null")): """) out(""" - public $(f.type) $(f.get)() { + public $(f.type) $(f.get)() { ${ if f.empty: out(" return $(f.has)();") @@ -183,7 +183,7 @@ else: } } - public $name $(f.set)($(f.type) value) { + public $name $(f.set)($(f.type) value) { ${ if not f.empty: out(" _$(f.name) = value;") @@ -196,9 +196,6 @@ if pack > 0: return this; } - public $name $(f.name)($(f.type) value) { - return $(f.set)(value); - } """) } @@ -209,18 +206,18 @@ if segments: set { _header = value;} } - public $name header(Header header) { + public $name SetHeader(Header header) { Header = header; return this; } - public override MemoryStream Body + public override MemoryStream Body { get{ return _body;} set{ _body = value;} } - public $name body(MemoryStream body) + public $name SetBody(MemoryStream body) { Body = body; return this; @@ -228,11 +225,11 @@ if segments: """) } - public override void write(Encoder enc) + public override void Write(IEncoder enc) { ${ if pack > 0: - out(" enc.writeUint%s(packing_flags);\n" % (pack*8)); + out(" enc.WriteUint%s(packing_flags);\n" % (pack*8)); for f in fields: if f.empty: @@ -246,15 +243,15 @@ for f in fields: elif f.type_node.name == "domain": post = "" pre = "(short)" - out(" enc.write$(f.coder)($(pre)_$(f.name)$(post));\n") + out(" enc.Write$(f.coder)($(pre)_$(f.name)$(post));\n") } } - public override void read(Decoder dec) + public override void Read(IDecoder dec) { ${ if pack > 0: - out(" packing_flags = ($(PACK_TYPES[pack])) dec.readUint%s();\n" % (pack*8)); + out(" packing_flags = ($(PACK_TYPES[pack])) dec.ReadUint%s();\n" % (pack*8)); for f in fields: if f.empty: @@ -268,25 +265,25 @@ for f in fields: pre = "(%s)" % cname(f.type_node) arg = "%s.TYPE" % cname(f.type_node) elif f.type_node.name == "domain": - pre = "%sGetter.get(" % cname(f.type_node) + pre = "%sGetter.Get(" % cname(f.type_node) post = ")" - out(" _$(f.name) = $(pre)dec.read$(f.coder)($(arg))$(post);\n") + out(" _$(f.name) = $(pre)dec.Read$(f.coder)($(arg))$(post);\n") } } public override Dictionary Fields { - get{ - Dictionary result = new Dictionary(); + get + { + Dictionary result = new Dictionary(); ${ for f in fields: if pack > 0: - out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") - out(' result.Add("_$(f.name)", $(f.get)());\n') + out(" if ((packing_flags & $(f.flag_mask(pack))) != 0)\n ") + out(' result.Add("_$(f.name)", $(f.get)());\n') } - - return result; + return result; } } diff --git a/qpid/dotnet/client-010/gentool/Enum.tpl b/qpid/dotnet/client-010/gentool/Enum.tpl index b3b6d93f8a..33af038cc6 100644 --- a/qpid/dotnet/client-010/gentool/Enum.tpl +++ b/qpid/dotnet/client-010/gentool/Enum.tpl @@ -21,7 +21,7 @@ out(" public struct $name") out("Getter") } { - public static $name get($vtype value) + public static $name Get($vtype value) { switch (value) { diff --git a/qpid/dotnet/client-010/gentool/Invoker.tpl b/qpid/dotnet/client-010/gentool/Invoker.tpl index ca9abacc24..2f69aee66d 100644 --- a/qpid/dotnet/client-010/gentool/Invoker.tpl +++ b/qpid/dotnet/client-010/gentool/Invoker.tpl @@ -27,10 +27,10 @@ using common.org.apache.qpid.transport.util; namespace org.apache.qpid.transport { -public abstract class Invoker { +public abstract class Invoker : IInvoker { - protected abstract void invoke(Method method); - public abstract Future invoke(Method method, Future resultClass); + protected abstract void Invoke(Method method); + public abstract IFuture Invoke(Method method, IFuture resultClass); ${ from dotnetgenutil import * @@ -46,18 +46,18 @@ for c in composites: rname = cname(result["struct"]) else: rname = cname(result, "@type") - jresult = "Future" + jresult = "IFuture" jreturn = "return " jclass = ", new ResultFuture()" - jinvoke = "invoke" + jinvoke = "Invoke" else: - jinvoke = "invoke" + jinvoke = "Invoke" jresult = "void" jreturn = "" jclass = "" out(""" - public $jresult $(dromedary(name))($(", ".join(params))) { + public $jresult $(name)($(", ".join(params))) { $(jreturn)$jinvoke(new $name($(", ".join(args)))$jclass); } """) diff --git a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl index 49891e2b08..788d2e29e6 100644 --- a/qpid/dotnet/client-010/gentool/MethodDelegate.tpl +++ b/qpid/dotnet/client-010/gentool/MethodDelegate.tpl @@ -29,7 +29,7 @@ from genutil import * for c in composites: name = cname(c) - out(" public virtual void $(dromedary(name))(C context, $name mystruct) {}\n") + out(" public virtual void $(name)(C context, $name mystruct) {}\n") } } } diff --git a/qpid/dotnet/client-010/gentool/build.xml b/qpid/dotnet/client-010/gentool/build.xml index 26fa65545c..76ddb1571d 100644 --- a/qpid/dotnet/client-010/gentool/build.xml +++ b/qpid/dotnet/client-010/gentool/build.xml @@ -43,7 +43,7 @@ - + diff --git a/qpid/dotnet/client-010/gentool/codegen b/qpid/dotnet/client-010/gentool/codegen index 8a3a6de7ee..baebf378fd 100644 --- a/qpid/dotnet/client-010/gentool/codegen +++ b/qpid/dotnet/client-010/gentool/codegen @@ -72,6 +72,7 @@ for c in composites: execute("MethodDelegate.cs", "MethodDelegate.tpl", composites = composites) execute("Option.cs", "Option.tpl", composites = composites) execute("Invoker.cs", "Invoker.tpl", composites = controls + commands) +execute("IInvoker.cs", "IInvoker.tpl", composites = controls + commands) execute("StructFactory.cs", "StructFactory.tpl", composites = composites) def is_enum(nd): diff --git a/qpid/dotnet/client-010/gentool/dotnetgenutil.py b/qpid/dotnet/client-010/gentool/dotnetgenutil.py index a071ad3bde..4d9c8a69d7 100644 --- a/qpid/dotnet/client-010/gentool/dotnetgenutil.py +++ b/qpid/dotnet/client-010/gentool/dotnetgenutil.py @@ -20,14 +20,12 @@ # -def camel(offset, *args): +def pascal(offset, *args): parts = [] for a in args: parts.extend(a.split("-")) - return "".join(parts[:offset] + [p[0].upper() + p[1:] for p in parts[offset:]]) + return "".join([p[0].upper() + p[1:] for p in parts[:offset]] + [p[0].upper() + p[1:] for p in parts[offset:]]) -def dromedary(s): - return s[0].lower() + s[1:] def scream(*args): return "_".join([a.replace("-", "_").upper() for a in args]) @@ -132,11 +130,11 @@ def cname(nd, field="@name"): if (nd.name in ("struct", "result") and cls["@name"] != "session" and nd[field] != "header"): - return camel(0, nd[field]) + return pascal(0, nd[field]) else: - return camel(0, cls["@name"], nd[field]) + return pascal(0, cls["@name"], nd[field]) else: - return camel(0, nd[field]) + return pascal(0, nd[field]) def jtype(nd): if nd.name == "struct" or nd["enum"]: @@ -178,7 +176,7 @@ class Field: def __init__(self, index, nd): self.index = index - self.name = camel(1, nd["@name"]) + self.name = pascal(1, nd["@name"]) self.type_node = resolve_type(nd) if self.type_node.name == "domain": self.prim_type = resolve_type(self.type_node) @@ -189,23 +187,23 @@ class Field: self.empty = self.variable_width == 0 and self.fixed_width == 0 and self.prim_type.name != "struct" tname = cname(self.type_node) if self.type_node.name == "struct": - self.read = "(%s) dec.readStruct(%s.TYPE)" % (tname, tname) - self.write = "enc.writeStruct(%s.TYPE, check(struct).%s)" % (tname, self.name) + self.read = "(%s) dec.ReadStruct(%s.TYPE)" % (tname, tname) + self.write = "enc.WriteStruct(%s.TYPE, check(struct).%s)" % (tname, self.name) self.coder = "Struct" elif self.type_node.name == "domain": - self.coder = camel(0, self.prim_type["@name"]) - self.read = "%s.get(dec.read%s())" % (tname, self.coder) - self.write = "enc.write%s(check(struct).%s.getValue())" % (self.coder, self.name) + self.coder = pascal(0, self.prim_type["@name"]) + self.read = "%s.Get(dec.Read%s())" % (tname, self.coder) + self.write = "enc.Write%s(check(struct).%s.GetValue())" % (self.coder, self.name) else: - self.coder = camel(0, self.type_node["@name"]) - self.read = "dec.read%s()" % self.coder - self.write = "enc.write%s(check(struct).%s)" % (self.coder, self.name) + self.coder = pascal(0, self.type_node["@name"]) + self.read = "dec.Read%s()" % self.coder + self.write = "enc.Write%s(check(struct).%s)" % (self.coder, self.name) self.type = jtype(self.type_node) self.default = DEFAULTS.get(self.type, "null") - self.has = camel(1, "has", self.name) - self.get = camel(1, "get", self.name) - self.set = camel(1, "set", self.name) - self.clear = camel(1, "clear", self.name) + self.has = pascal(1, "Has", self.name) + self.get = pascal(1, "Get", self.name) + self.set = pascal(1, "Set", self.name) + self.clear = pascal(1, "clear", self.name) if self.type == "bool": self.option = scream(nd["@name"]) else: @@ -236,7 +234,7 @@ def get_parameters(type, fields): params.append("Header header") params.append("MemoryStream body") if options or type.name in ("control", "command"): - params.append("Option ... _options") + params.append("Option ... options") return params def get_arguments(type, fields): @@ -251,7 +249,7 @@ def get_arguments(type, fields): args.append("header") args.append("body") if options or type.name in ("control", "command"): - args.append("_options") + args.append("options") return args def get_options(fields): @@ -269,5 +267,5 @@ def get_dotnetparameters(type, fields): params.append("Header header") params.append("MemoryStream body") if options or type.name in ("control", "command"): - params.append("params Option[] _options") + params.append("params Option[] options") return params -- cgit v1.2.1 From 7a899816354fb5d9187134478dd53071b6d525b9 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 3 Dec 2009 22:31:12 +0000 Subject: QPID-500: Fix public API to match .Net conventions QPID-1987: misc test fixes, - Fixes ToString() methods that don't override base classes - Fixes blocking TearingDown in unit tests - Use a .config file for tests/samples - Adds interface to Invoker, Session and ClientSession to allow easy mocking of the API - Make the console solution compiling under Visual Studio 2008 patch from julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@886962 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/README.txt | 14 +- .../client-010/addins/ExcelAddIn/ExcelAddIn.cs | 38 +-- .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 8 +- .../ExcelAddInMessageProcessor.csproj | 11 +- .../ExcelAddInProducer/ExcelAddInProducer.csproj | 12 +- .../addins/ExcelAddInProducer/Program.cs | 23 +- qpid/dotnet/client-010/client/Client.csproj | 173 +++++++++++- qpid/dotnet/client-010/client/client.sln | 5 + qpid/dotnet/client-010/client/client/Client.cs | 63 ++--- .../client/client/ClientConnectionDelegate.cs | 28 +- .../client-010/client/client/ClientSession.cs | 41 ++- .../client/client/ClientSessionDelegate.cs | 20 +- qpid/dotnet/client-010/client/client/ErrorCode.cs | 4 +- qpid/dotnet/client-010/client/client/IClient.cs | 75 ++++++ .../client-010/client/client/IClientSession.cs | 18 ++ .../client-010/client/client/IClosedListener.cs | 29 ++ qpid/dotnet/client-010/client/client/IMessage.cs | 4 +- .../client-010/client/client/IMessageListener.cs | 31 +++ qpid/dotnet/client-010/client/client/Message.cs | 12 +- .../client/client/MessageListenerInterface.cs | 31 --- qpid/dotnet/client-010/client/transport/Binary.cs | 10 +- qpid/dotnet/client-010/client/transport/Channel.cs | 52 ++-- .../client-010/client/transport/ChannelDelegate.cs | 14 +- .../client-010/client/transport/Connection.cs | 54 ++-- .../client/transport/ConnectionDelegate.cs | 42 +-- qpid/dotnet/client-010/client/transport/Field.cs | 15 +- qpid/dotnet/client-010/client/transport/Header.cs | 6 +- .../dotnet/client-010/client/transport/IBinding.cs | 34 +++ qpid/dotnet/client-010/client/transport/IFuture.cs | 38 +++ .../client/transport/IProtocolDelegate.cs | 37 +++ .../client-010/client/transport/IProtocolEvent.cs | 42 +++ .../client-010/client/transport/IReceiver.cs | 38 +++ qpid/dotnet/client-010/client/transport/ISender.cs | 32 +++ .../dotnet/client-010/client/transport/ISession.cs | 52 ++++ qpid/dotnet/client-010/client/transport/Method.cs | 20 +- .../client-010/client/transport/ProtocolError.cs | 17 +- .../client-010/client/transport/ProtocolHeader.cs | 17 +- qpid/dotnet/client-010/client/transport/Range.cs | 46 ++-- .../dotnet/client-010/client/transport/RangeSet.cs | 36 +-- qpid/dotnet/client-010/client/transport/Session.cs | 178 ++++++------ .../client-010/client/transport/SessionDelegate.cs | 60 ++--- qpid/dotnet/client-010/client/transport/Struct.cs | 43 ++- .../client/transport/codec/AbstractDecoder.cs | 236 ++++++++-------- .../client/transport/codec/AbstractEncoder.cs | 300 ++++++++++----------- .../client-010/client/transport/codec/IDecoder.cs | 72 +++++ .../client/transport/codec/IEncodable.cs | 37 +++ .../client-010/client/transport/codec/IEncoder.cs | 70 +++++ .../client-010/client/transport/codec/MSDecoder.cs | 60 ++--- .../client-010/client/transport/codec/MSEncoder.cs | 42 +-- .../transport/exception/ConnectionException.cs | 4 +- .../client/transport/exception/ExceptionArgs.cs | 8 +- .../exception/ProtocolVersionException.cs | 14 +- .../client/transport/network/Assembler.cs | 90 +++---- .../client/transport/network/Disassembler.cs | 86 +++--- .../client-010/client/transport/network/Frame.cs | 32 +-- .../client/transport/network/INetworkDelegate.cs | 40 +++ .../client/transport/network/INetworkEvent.cs | 32 +++ .../client/transport/network/InputHandler.cs | 28 +- .../client/transport/network/io/IIoSender.cs | 28 ++ .../client/transport/network/io/IIoTransport.cs | 2 +- .../client/transport/network/io/IoReceiver.cs | 22 +- .../client/transport/network/io/IoSSLTransport.cs | 26 +- .../client/transport/network/io/IoSender.cs | 24 +- .../client/transport/network/io/IoTransport.cs | 22 +- .../client/transport/util/ByteEncoder.cs | 30 +-- .../client/transport/util/CircularBuffer.cs | 14 +- .../client-010/client/transport/util/Functions.cs | 6 +- .../client-010/client/transport/util/Logger.cs | 22 +- .../client/transport/util/ResultFuture.cs | 18 +- .../client-010/client/transport/util/Serial.cs | 30 +-- qpid/dotnet/client-010/demo/Demo.csproj | 14 +- qpid/dotnet/client-010/demo/Program.cs | 43 +-- qpid/dotnet/client-010/demo/default.build | 3 +- .../direct/example-direct-Listener/Listener.cs | 33 ++- .../direct/example-direct-Listener/default.build | 1 + .../example-direct-Listener.csproj | 10 +- .../direct/example-direct-producer/Producer.cs | 31 ++- .../direct/example-direct-producer/default.build | 3 +- .../example-direct-producer.csproj | 10 +- .../fanout/example-fanout-Listener/Listener.cs | 33 ++- .../fanout/example-fanout-Listener/default.build | 1 + .../example-fanout-Listener.csproj | 10 +- .../fanout/example-fanout-Producer/Producer.cs | 29 +- .../fanout/example-fanout-Producer/default.build | 1 + .../example-fanout-Producer.csproj | 10 +- .../pub-sub/example-pub-sub-Listener/Listener.cs | 39 +-- .../pub-sub/example-pub-sub-Listener/default.build | 1 + .../example-pub-sub-Listener.csproj | 10 +- .../pub-sub/example-pub-sub-Publisher/Publisher.cs | 33 ++- .../example-pub-sub-Publisher/default.build | 1 + .../example-pub-sub-Publisher.csproj | 10 +- .../example-request-response-Client/Client.cs | 137 ---------- .../RequestResponseClient.cs | 142 ++++++++++ .../example-request-response-Client/default.build | 3 +- .../example-request-response-Client.csproj | 12 +- .../example-request-response-Server/Server.cs | 45 ++-- .../example-request-response-Server/default.build | 3 +- .../example-request-response-Server.csproj | 10 +- qpid/dotnet/client-010/gentool/IInvoker.tpl | 57 ++++ qpid/dotnet/client-010/management/console/Agent.cs | 4 +- .../dotnet/client-010/management/console/Broker.cs | 122 ++++----- .../client-010/management/console/BrokerURL.cs | 1 - .../client-010/management/console/ClassKey.cs | 28 +- .../client-010/management/console/ObjectID.cs | 12 +- .../client-010/management/console/QMFEvent.cs | 6 +- .../client-010/management/console/QMFObject.cs | 22 +- .../management/console/SchemaArgument.cs | 4 +- .../client-010/management/console/SchemaClass.cs | 12 +- .../client-010/management/console/SchemaMethod.cs | 4 +- .../management/console/SchemaProperty.cs | 4 +- .../management/console/SchemaStatistic.cs | 4 +- .../client-010/management/console/Session.cs | 224 +++++++-------- .../client-010/management/console/console.csproj | 87 +++--- .../client-010/management/console/console.sln | 24 +- qpid/dotnet/client-010/perftest/PerfTest.cs | 190 ++++++------- qpid/dotnet/client-010/perftest/perftest.csproj | 9 +- qpid/dotnet/client-010/test/Test.csproj | 9 +- qpid/dotnet/client-010/test/interop/Admin.cs | 56 ++-- .../client-010/test/interop/ApplicationHeaders.cs | 20 +- qpid/dotnet/client-010/test/interop/Message.cs | 97 +++---- qpid/dotnet/client-010/test/interop/TestCase.cs | 26 +- .../test/transport/util/ByteEncoderTest.cs | 18 +- .../test/transport/util/CircularBufferTest.cs | 8 +- .../test/transport/util/ResultFutureTest.cs | 20 +- .../client-010/test/transport/util/SerialTest.cs | 14 +- 125 files changed, 2876 insertions(+), 1802 deletions(-) create mode 100644 qpid/dotnet/client-010/client/client/IClient.cs create mode 100644 qpid/dotnet/client-010/client/client/IClientSession.cs create mode 100644 qpid/dotnet/client-010/client/client/IClosedListener.cs create mode 100644 qpid/dotnet/client-010/client/client/IMessageListener.cs delete mode 100644 qpid/dotnet/client-010/client/client/MessageListenerInterface.cs create mode 100644 qpid/dotnet/client-010/client/transport/IBinding.cs create mode 100644 qpid/dotnet/client-010/client/transport/IFuture.cs create mode 100644 qpid/dotnet/client-010/client/transport/IProtocolDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/IProtocolEvent.cs create mode 100644 qpid/dotnet/client-010/client/transport/IReceiver.cs create mode 100644 qpid/dotnet/client-010/client/transport/ISender.cs create mode 100644 qpid/dotnet/client-010/client/transport/ISession.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/IDecoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/IEncodable.cs create mode 100644 qpid/dotnet/client-010/client/transport/codec/IEncoder.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/INetworkDelegate.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/INetworkEvent.cs create mode 100644 qpid/dotnet/client-010/client/transport/network/io/IIoSender.cs delete mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs create mode 100644 qpid/dotnet/client-010/examples/request-response/example-request-response-Client/RequestResponseClient.cs create mode 100644 qpid/dotnet/client-010/gentool/IInvoker.tpl (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/README.txt b/qpid/dotnet/client-010/README.txt index 7f7ac2c6f3..74d54a9786 100644 --- a/qpid/dotnet/client-010/README.txt +++ b/qpid/dotnet/client-010/README.txt @@ -3,17 +3,19 @@ Info AMQP 0.10 Native .NET client supporting WCF and xcel -This client is self contained, all dependancies are in this -directory. +In order to build this client from the sources you'll need the following folders : +- /java/lib +- /python +- /specs 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 + Microsoft Visual Studio 2008 (VS2008). It's also possible to build with vs2005 by creating a new solution and adding Client.csproj + NAnt 0.85 - only required for builds outside VS2008 (.net 1.1, .net 2.0, mono 2.0) + Ant 1.6.5 (requires Java) Cygwin (or alternatively build via cmd but alter instructions below accordingly) Set up PATH to include Nant.exe: @@ -33,7 +35,7 @@ Generate code from /dotnet/client-010/gentool: $ cd /dotnet/client-010/gentool $ ant -You can build from Visual Studio 2005 normally. Alternatively, you +You can build from Visual Studio 2008 normally. Alternatively, you can build debug releases for any supported framework from the command line using Nant: diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs index 02091d771f..66c9b7a8f9 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs @@ -49,8 +49,8 @@ namespace ExcelAddIn private readonly Dictionary _topicMessages = new Dictionary(); private readonly Dictionary _queueListener = new Dictionary(); private readonly Dictionary _topicQueueName = new Dictionary(); - private Client _client; - private ClientSession _session; + private IClient _client; + private IClientSession _session; private ProcessMessage _messageProcessor; #region properties @@ -65,7 +65,7 @@ namespace ExcelAddIn get { return _topicMessages; } } - public ClientSession Session + public IClientSession Session { get { return _session; } } @@ -103,7 +103,7 @@ namespace ExcelAddIn { virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; } - if (ConfigurationManager.AppSettings["UserName"] != null) + if (ConfigurationManager.AppSettings["Username"] != null) { username = ConfigurationManager.AppSettings["UserName"]; } @@ -132,9 +132,9 @@ namespace ExcelAddIn try { _client = new Client(); - _client.connect(host, Convert.ToInt16(port), virtualhost, username, password); + _client.Connect(host, Convert.ToInt16(port), virtualhost, username, password); // create a session - _session = _client.createSession(0); + _session = _client.CreateSession(0); } catch (Exception e) { @@ -164,8 +164,8 @@ namespace ExcelAddIn queuename = (string) Strings.GetValue(0); } // Error message if the queue does not exist - QueueQueryResult result = (QueueQueryResult)_session.queueQuery(queuename).Result; - if( result.getQueue() == null ) + 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"; @@ -184,14 +184,14 @@ namespace ExcelAddIn listener = new QpidListener(this); listener.addTopic(TopicID); _queueListener.Add(queuename, listener); - _session.attachMessageListener(listener, destinationName); - _session.messageSubscribe(queuename, destinationName, MessageAcceptMode.EXPLICIT, + _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(); + _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) @@ -212,7 +212,7 @@ namespace ExcelAddIn string queueName = _topicQueueName[TopicID]; if (_topicQueueName.Remove(TopicID) && !_topicQueueName.ContainsValue(queueName)) { - _session.messageStop("ExcelAddIn-" + queueName); + _session.MessageStop("ExcelAddIn-" + queueName); _session.MessageListeners.Remove("ExcelAddIn-" + queueName); } } @@ -271,7 +271,7 @@ namespace ExcelAddIn _topics.Add(topic); } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { foreach (int i in _topics) { @@ -282,9 +282,9 @@ namespace ExcelAddIn } // ack this message RangeSet rs = new RangeSet(); - rs.add(m.Id); - _excel.Session.messageAccept(rs); + 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/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj index ea2d6b7198..34c8bda33b 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {85EFD719-39F6-4471-90FF-9E621430344B} Library @@ -45,7 +45,7 @@ - + @@ -54,7 +54,9 @@ - + + App.config + - \ 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 f860551868..e69f4cf35a 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {80F00C3B-EB38-4B3B-9F77-68977A30B155} Exe @@ -34,11 +34,12 @@ + - + @@ -46,6 +47,11 @@ Client + + + App.config + + - \ 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 0c97d6809b..a8bbdf2fbd 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs @@ -19,6 +19,7 @@ * */ using System; +using System.Configuration; using System.Text; using System.Threading; using org.apache.qpid.client; @@ -29,27 +30,33 @@ namespace ExcelAddInProducer { static void Main(string[] args) { + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client client = new Client(); Console.WriteLine("Client created"); - client.connect("192.168.1.14", 5672, "test", "guest", "guest"); + client.Connect(host, port, virtualhost, username, password); Console.WriteLine("Connection established"); - ClientSession ssn = client.createSession(50000); + IClientSession ssn = client.CreateSession(50000); Console.WriteLine("Session created"); - ssn.queueDeclare("queue1", null, null); - ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + 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.ClearData(); + message.AppendData( Encoding.UTF8.GetBytes("test: " + i)); message.ApplicationHeaders["price"] = i; - ssn.messageTransfer("amq.direct", "queue1", message); + ssn.MessageTransfer("amq.direct", "queue1", message); Thread.Sleep(1000); } - client.close(); + client.Close(); } } } diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 5d1a30c6aa..5b71ad0581 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {B911FFD7-754F-4735-A188-218D5065BE79} Library @@ -42,7 +42,174 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ 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 e201be9d6f..0d7a57d880 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -31,6 +31,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "perftest", "..\perftest\per EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInMessageProcessor", "..\addins\ExcelAddInMessageProcessor\ExcelAddInMessageProcessor.csproj", "{C2AE83A3-D5D1-469D-8611-A4738B9997CF}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3CE4FA2A-393F-4DED-ABDF-1BC2F253ACA8}" + ProjectSection(SolutionItems) = preProject + ..\App.config = ..\App.config + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 85332b4059..1b87a3d578 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -25,19 +25,20 @@ using org.apache.qpid.transport.util; namespace org.apache.qpid.client { - public class Client : ClientInterface + public class Client : IClient { private Connection _conn; - private static readonly Logger _log = Logger.get(typeof (Client)); + private static readonly Logger _log = Logger.Get(typeof (Client)); private const long timeout = 60000; - private bool _closed; + private bool _isClosed; private readonly Object _closeOK; - private ClosedListener _closedListner; + private IClosedListener _closedListner; - public bool Closed + + public bool IsClosed { - get { return _closed; } - set { _closed = value; } + get { return _isClosed; } + set { _isClosed = value; } } public Object CloseOk @@ -47,11 +48,11 @@ namespace org.apache.qpid.client public Client() { - _closed = false; + _isClosed = false; _closeOK = new object(); } - #region Interface ClientInterface + #region Interface IClient /// /// Establishes a connection with a broker using the provided user auths @@ -62,17 +63,17 @@ namespace org.apache.qpid.client /// virtual host name /// User Name /// Password - public void connect(String host, int port, String virtualHost, String username, String password) + 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, + _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 = IoTransport.Connect(host, port, connectionDelegate); - _conn.send(new ProtocolHeader(1, 0, 10)); + _conn.Send(new ProtocolHeader(1, 0, 10)); negotiationComplete.WaitOne(); } @@ -88,53 +89,53 @@ namespace org.apache.qpid.client /// Name of the SSL server /// Path to the X509 certificate to be used for client authentication /// If true connection will not be established if the broker is not trusted - public void connectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted) + 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, + _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)); + _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 = IoSSLTransport.Connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate); - _conn.send(new ProtocolHeader(1, 0, 10)); + _conn.Send(new ProtocolHeader(1, 0, 10)); negotiationComplete.WaitOne(); } - public void close() + public void Close() { - Channel ch = _conn.getChannel(0); - ch.connectionClose(ConnectionCloseCode.NORMAL, "client is closing"); + 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) + while (!IsClosed && elapsed < timeout) { Monitor.Wait(CloseOk, (int) (timeout - elapsed)); elapsed = DateTime.Now.Subtract(start).Milliseconds; } - if (!Closed) + if (!IsClosed) { throw new Exception("Timed out when closing connection"); } - _conn.close(); + _conn.Close(); } } - public ClientSession createSession(long expiryInSeconds) + public IClientSession 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); + 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 + public IClosedListener ClosedListener { set { _closedListner = value; } get { return _closedListner; } diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index fc1829e6bd..fff65673bc 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -29,7 +29,7 @@ namespace org.apache.qpid.client { internal class ClientConnectionDelegate : ClientDelegate { - private static readonly Logger log = Logger.get(typeof (ClientConnectionDelegate)); + private static readonly Logger log = Logger.Get(typeof (ClientConnectionDelegate)); private readonly Client _client; private string _username; private string _password; @@ -41,17 +41,17 @@ namespace org.apache.qpid.client _password = pasword; } - public override SessionDelegate getSessionDelegate() + public override SessionDelegate GetSessionDelegate() { return new ClientSessionDelegate(); } - public override void exception(Exception t) + public override void Exception(Exception t) { throw t; } - public override void connectionStart(Channel context, ConnectionStart mystruct) + public override void ConnectionStart(Channel context, ConnectionStart mystruct) { const string mechanism = "PLAIN"; MemoryStream stResponse = new MemoryStream(); @@ -62,17 +62,17 @@ namespace org.apache.qpid.client part = Encoding.UTF8.GetBytes(_password); stResponse.Write(part, 0, part.Length); Dictionary props = new Dictionary(); - context.connectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); + context.ConnectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); } - public override void closed() + public override void Closed() { - log.debug("Delegate closed"); + log.Debug("Delegate Closed"); lock (_client.CloseOk) { try { - _client.Closed = true; + _client.IsClosed = true; Monitor.PulseAll(_client.CloseOk); } catch (Exception e) @@ -82,16 +82,16 @@ namespace org.apache.qpid.client } } - public override void connectionClose(Channel context, ConnectionClose connectionClose) + public override void ConnectionClose(Channel context, ConnectionClose connectionClose) { - base.connectionClose(context, connectionClose); - ErrorCode errorCode = ErrorCode.getErrorCode((int) connectionClose.getReplyCode()); + 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()); + throw new Exception ("Server Closed the connection: Reason " + + connectionClose.GetReplyText()); } - _client.ClosedListener.onClosed(errorCode, connectionClose.getReplyText(), null); + _client.ClosedListener.OnClosed(errorCode, connectionClose.GetReplyText(), null); } } } diff --git a/qpid/dotnet/client-010/client/client/ClientSession.cs b/qpid/dotnet/client-010/client/client/ClientSession.cs index 2dbc27ecd9..190fd7c940 100644 --- a/qpid/dotnet/client-010/client/client/ClientSession.cs +++ b/qpid/dotnet/client-010/client/client/ClientSession.cs @@ -24,14 +24,13 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; using org.apache.qpid.transport; using org.apache.qpid.transport.util; namespace org.apache.qpid.client { /// Implements a Qpid Sesion. - public class ClientSession : Session + public class ClientSession : Session, IClientSession { public static short TRANSFER_ACQUIRE_MODE_NO_ACQUIRE = 1; public static short TRANSFER_ACQUIRE_MODE_PRE_ACQUIRE = 0; @@ -47,13 +46,13 @@ namespace org.apache.qpid.client public static short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0; public static short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1; - private Dictionary _listeners = new Dictionary(); + private readonly Dictionary _listeners = new Dictionary(); public ClientSession(byte[] name) : base(name) { } - public void attachMessageListener(IMessageListener listener, string Destination) + public void AttachMessageListener(IMessageListener listener, string Destination) { _listeners.Add(Destination, listener); } @@ -63,47 +62,47 @@ namespace org.apache.qpid.client get { return _listeners; } } - public void messageTransfer(String destination, string routingkey, IMessage message) + public void MessageTransfer(String destination, string routingkey, IMessage message) { - message.DeliveryProperties.setRoutingKey(routingkey); - messageTransfer(destination, message); + message.DeliveryProperties.SetRoutingKey(routingkey); + MessageTransfer(destination, message); } - public void messageTransfer(String destination, IMessage message) + public void MessageTransfer(String destination, IMessage message) { byte[] body = new byte[message.Body.Position]; message.Body.Seek(0, SeekOrigin.Begin); message.Body.Read(body, 0, body.Length); - message.MessageProperties.setMessageId(UUID.randomUUID()); - messageTransfer(destination, + message.MessageProperties.SetMessageId(UUID.RandomUuid()); + MessageTransfer(destination, MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, message.Header, body); } - public void queueDeclare(String queue) + public void QueueDeclare(String queue) { - queueDeclare(queue, null, null); + QueueDeclare(queue, null, null); } - public void queueDeclare(String queue, params Option[] options) + public void QueueDeclare(String queue, params Option[] options) { - queueDeclare(queue, null, null, options); + QueueDeclare(queue, null, null, options); } - public void exchangeBind(String queue, String exchange, String bindingKey) + public void ExchangeBind(String queue, String exchange, String bindingKey) { - exchangeBind(queue, exchange, bindingKey, null); + ExchangeBind(queue, exchange, bindingKey, null); } - public void messageSubscribe(String queue) + public void MessageSubscribe(String queue) { - messageSubscribe(queue, queue, MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); + MessageSubscribe(queue, queue, MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); // issue credits - messageSetFlowMode(queue, MessageFlowMode.WINDOW); - messageFlow(queue, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - messageFlow(queue, MessageCreditUnit.MESSAGE, 10000); + MessageSetFlowMode(queue, MessageFlowMode.WINDOW); + MessageFlow(queue, MessageCreditUnit.BYTE, MESSAGE_FLOW_MAX_BYTES); + MessageFlow(queue, MessageCreditUnit.MESSAGE, 10000); } } diff --git a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs index f81b14e9aa..7cc4042557 100644 --- a/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientSessionDelegate.cs @@ -23,33 +23,33 @@ namespace org.apache.qpid.client { public class ClientSessionDelegate : SessionDelegate { - private static readonly Logger _log = Logger.get(typeof (ClientSessionDelegate)); + private static readonly Logger _log = Logger.Get(typeof (ClientSessionDelegate)); // -------------------------------------------- // Message methods // -------------------------------------------- - public override void messageTransfer(Session session, MessageTransfer xfr) + public override void MessageTransfer(Session session, MessageTransfer xfr) { - if (((ClientSession) session).MessageListeners.ContainsKey(xfr.getDestination())) + if (((ClientSession) session).MessageListeners.ContainsKey(xfr.GetDestination())) { - IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.getDestination()]; - listener.messageTransfer( new Message(xfr)); + IMessageListener listener = ((ClientSession)session).MessageListeners[xfr.GetDestination()]; + listener.MessageTransfer( new Message(xfr)); } else { - _log.warn("No listener set for: {0}", xfr); + _log.Warn("No listener set for: {0}", xfr); } } - public override void messageReject(Session session, MessageReject mstruct) + public override void MessageReject(Session session, MessageReject mstruct) { - foreach (Range range in mstruct.getTransfers()) + foreach (Range range in mstruct.GetTransfers()) { for (long l = range.Lower; l <= range.Upper; l++) { - _log.warn("message rejected: " + session.getCommand((int) l)); + _log.Warn("message rejected: " + session.GetCommand((int) l)); } } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/client/ErrorCode.cs b/qpid/dotnet/client-010/client/client/ErrorCode.cs index 03ea0df911..74c3daba4b 100644 --- a/qpid/dotnet/client-010/client/client/ErrorCode.cs +++ b/qpid/dotnet/client-010/client/client/ErrorCode.cs @@ -74,7 +74,7 @@ namespace org.apache.qpid.client get { return _hardError; } } - public static ErrorCode getErrorCode(int code) + public static ErrorCode GetErrorCode(int code) { switch (code) { @@ -137,4 +137,4 @@ namespace org.apache.qpid.client } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/client/IClient.cs b/qpid/dotnet/client-010/client/client/IClient.cs new file mode 100644 index 0000000000..a9da74a840 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/IClient.cs @@ -0,0 +1,75 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System; + +namespace org.apache.qpid.client +{ + public interface IClient + { + /// + /// Establish a connection with the broker using the given parameters + /// + /// + /// host name + /// port number + /// virtualHost the virtual host name + /// username user name + /// password password + void Connect(String host, int port, String virtualHost, String username, String passwor); + + /// + /// Close this client + /// + void Close(); + + /// + /// Create a session for this connection. + /// The returned session is suspended + /// (i.e. this session is not attached to an underlying channel) + /// + /// Expiry time expressed in seconds, if the value is less than + /// or equal to 0 then the session does not expire. + /// A newly created (suspended) session. + IClientSession CreateSession(long expiryInSeconds); + + /// + /// If the communication layer detects a serious problem with a connection, it + // informs the client's ClosedListener + /// + /// + IClosedListener ClosedListener { set; } + + bool IsClosed { get; set; } + + /// + /// Establishes a connection with a broker using SSL + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// virtual host name + /// User Name + /// Password + /// Name of the SSL server + /// Path to the X509 certificate to be used for client authentication + /// If true connection will not be established if the broker is not trusted + void ConnectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted); + } +} diff --git a/qpid/dotnet/client-010/client/client/IClientSession.cs b/qpid/dotnet/client-010/client/client/IClientSession.cs new file mode 100644 index 0000000000..b8bc7e4db8 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/IClientSession.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using org.apache.qpid.transport; + +namespace org.apache.qpid.client +{ + public interface IClientSession : ISession + { + void AttachMessageListener(IMessageListener listener, string Destination); + Dictionary MessageListeners { get; } + void MessageTransfer(String destination, string routingkey, IMessage message); + void MessageTransfer(String destination, IMessage message); + void QueueDeclare(String queue); + void QueueDeclare(String queue, params Option[] options); + void ExchangeBind(String queue, String exchange, String bindingKey); + void MessageSubscribe(String queue); + } +} diff --git a/qpid/dotnet/client-010/client/client/IClosedListener.cs b/qpid/dotnet/client-010/client/client/IClosedListener.cs new file mode 100644 index 0000000000..0e2472bba6 --- /dev/null +++ b/qpid/dotnet/client-010/client/client/IClosedListener.cs @@ -0,0 +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 IClosedListener + { + + void OnClosed(ErrorCode errorCode, String reason, Exception t); + } +} diff --git a/qpid/dotnet/client-010/client/client/IMessage.cs b/qpid/dotnet/client-010/client/client/IMessage.cs index f1037b70a8..6eae826a4c 100644 --- a/qpid/dotnet/client-010/client/client/IMessage.cs +++ b/qpid/dotnet/client-010/client/client/IMessage.cs @@ -37,12 +37,12 @@ namespace org.apache.qpid.client Dictionary ApplicationHeaders { get; set; } - void appendData(byte[] bytes); + void AppendData(byte[] bytes); MemoryStream Body { get; } string Destination { get; } - void clearData(); + void ClearData(); } } diff --git a/qpid/dotnet/client-010/client/client/IMessageListener.cs b/qpid/dotnet/client-010/client/client/IMessageListener.cs new file mode 100644 index 0000000000..44ceb3721e --- /dev/null +++ b/qpid/dotnet/client-010/client/client/IMessageListener.cs @@ -0,0 +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 + { + /// + /// Inform the listener of the message transfer + /// + /// The message transfer object + void MessageTransfer(IMessage xfr); + } +} diff --git a/qpid/dotnet/client-010/client/client/Message.cs b/qpid/dotnet/client-010/client/client/Message.cs index 0cb6030c82..6ab62070d2 100644 --- a/qpid/dotnet/client-010/client/client/Message.cs +++ b/qpid/dotnet/client-010/client/client/Message.cs @@ -37,7 +37,7 @@ namespace org.apache.qpid.client { _message = new MessageTransfer(); _message.Header = new Header( new MessageProperties(), new DeliveryProperties()); - ((MessageProperties) _message.Header.Structs[0]).setApplicationHeaders(new Dictionary()); + ((MessageProperties) _message.Header.Structs[0]).SetApplicationHeaders(new Dictionary()); } public MessageProperties MessageProperties @@ -84,24 +84,24 @@ namespace org.apache.qpid.client get { if (Header != null) - return ((MessageProperties) Header.Structs[0]).getApplicationHeaders(); + return ((MessageProperties) Header.Structs[0]).GetApplicationHeaders(); return null; } set { if (Header != null) { - ((MessageProperties) Header.Structs[0]).setApplicationHeaders(value); + ((MessageProperties) Header.Structs[0]).SetApplicationHeaders(value); } } } - public void appendData(byte[] bytes) + public void AppendData(byte[] bytes) { Body.Write(bytes, 0, bytes.Length); } - public void clearData() + public void ClearData() { Body.Seek(0, SeekOrigin.Begin); } @@ -125,7 +125,7 @@ namespace org.apache.qpid.client public string Destination { - get{ return _message.getDestination();} + get{ return _message.GetDestination();} } } } diff --git a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs b/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs deleted file mode 100644 index f365077d71..0000000000 --- a/qpid/dotnet/client-010/client/client/MessageListenerInterface.cs +++ /dev/null @@ -1,31 +0,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. -*/ - - -namespace org.apache.qpid.client -{ - public interface IMessageListener - { - /// - /// Inform the listener of the message transfer - /// - /// The message transfer object - 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 1ed6498a8b..f9bd3612dc 100644 --- a/qpid/dotnet/client-010/client/transport/Binary.cs +++ b/qpid/dotnet/client-010/client/transport/Binary.cs @@ -51,22 +51,22 @@ namespace org.apache.qpid.transport { } - public byte[] array() + public byte[] Array() { return bytes; } - public int offset() + public int Offset() { return offset_Renamed_Field; } - public int size() + public int Size() { return size_Renamed_Field; } - public Binary slice(int low, int high) + public Binary Slice(int low, int high) { int sz; @@ -126,4 +126,4 @@ namespace org.apache.qpid.transport return true; } } -} \ 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 1ea8ecf5ec..1742c05a3d 100644 --- a/qpid/dotnet/client-010/client/transport/Channel.cs +++ b/qpid/dotnet/client-010/client/transport/Channel.cs @@ -27,9 +27,9 @@ namespace org.apache.qpid.transport /// /// Channel /// - public class Channel : Invoker, ProtocolDelegate + public class Channel : Invoker, IProtocolDelegate { - private static readonly Logger log = Logger.get(typeof (Channel)); + private static readonly Logger log = Logger.Get(typeof (Channel)); private readonly Connection _connection; private readonly int _channel; @@ -52,7 +52,7 @@ namespace org.apache.qpid.transport } // Invoked when a network event is received - public void On_ReceivedEvent(object sender, ReceivedPayload payload) + public void On_ReceivedEvent(object sender, ReceivedPayload payload) { if (payload.Payload.Channel == _channel) { @@ -72,10 +72,10 @@ namespace org.apache.qpid.transport switch (method.EncodedTrack) { case Frame.L1: - method.dispatch(this, _connection.ConnectionDelegate); + method.Dispatch(this, _connection.ConnectionDelegate); break; case Frame.L2: - method.dispatch(this, _methoddelegate); + method.Dispatch(this, _methoddelegate); break; case Frame.L3: method.ProcessProtocolEvent(_session, _sessionDelegate); @@ -97,28 +97,28 @@ namespace org.apache.qpid.transport #endregion - public void exception(Exception t) + public void Exception(Exception t) { - _session.exception(t); + _session.Exception(t); } - public void closedFromConnection() + public void ClosedFromConnection() { - log.debug("channel closed: ", this); + log.Debug("channel Closed: ", this); if (_session != null) { - _session.closed(); + _session.Closed(); } } - public void closed() + public void Closed() { - log.debug("channel closed: ", this); + log.Debug("channel Closed: ", this); if (_session != null) { - _session.closed(); + _session.Closed(); } - _connection.removeChannel(_channel); + _connection.RemoveChannel(_channel); } public int EncodedChannel @@ -132,43 +132,43 @@ namespace org.apache.qpid.transport set { _session = value; } } - public void closeCode(ConnectionClose close) + public void CloseCode(ConnectionClose close) { if (_session != null) { - _session.closeCode(close); + _session.CloseCode(close); } } - private void emit(ProtocolEvent pevent) + private void Emit(IProtocolEvent pevent) { pevent.Channel = _channel; - _connection.send(pevent); + _connection.Send(pevent); } - public void method(Method m) + public void Method(Method m) { - emit(m); + Emit(m); if (!m.Batch) { - _connection.flush(); + _connection.Flush(); } } - protected override void invoke(Method m) + protected override void Invoke(Method m) { - method(m); + Method(m); } - public override Future invoke(Method m, Future future) + public override IFuture Invoke(Method m, IFuture future) { throw new Exception("UnsupportedOperation"); } - public String toString() + public override 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 1515ba22ed..3a43d6d231 100644 --- a/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ChannelDelegate.cs @@ -26,16 +26,16 @@ namespace org.apache.qpid.transport /// internal class ChannelDelegate : MethodDelegate { - public override void sessionDetached(Channel channel, SessionDetached closed) + public override void SessionDetached(Channel channel, SessionDetached closed) { - channel.closed(); + channel.Closed(); } - public override void sessionDetach(Channel channel, SessionDetach dtc) + public override void SessionDetach(Channel channel, SessionDetach dtc) { - channel.Session.closed(); - channel.sessionDetached(dtc.getName(), SessionDetachCode.NORMAL); - channel.closed(); + 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/Connection.cs b/qpid/dotnet/client-010/client/transport/Connection.cs index 0c49fee653..74e3892b22 100644 --- a/qpid/dotnet/client-010/client/transport/Connection.cs +++ b/qpid/dotnet/client-010/client/transport/Connection.cs @@ -29,17 +29,17 @@ namespace org.apache.qpid.transport /// public class Connection { - private static readonly Logger log = Logger.get(typeof (Connection)); + private static readonly Logger log = Logger.Get(typeof (Connection)); - private readonly Sender _sender; + private readonly ISender _sender; private readonly ConnectionDelegate _connDdelegate; private int _channelMax = 1; private int _connectionId; - private readonly Receiver> _receiver; + private readonly IReceiver> _receiver; private readonly Dictionary _channels = new Dictionary(); - public Connection(Receiver> receiver, Sender sender, ConnectionDelegate connDdelegate) + public Connection(IReceiver> receiver, ISender sender, ConnectionDelegate connDdelegate) { _receiver = receiver; _sender = sender; @@ -63,20 +63,20 @@ namespace org.apache.qpid.transport set { _channelMax = value; } } - public void send(ProtocolEvent pevent) + public void Send(IProtocolEvent pevent) { - log.debug("SEND: [{0}] {1}", this, pevent); - _sender.send(pevent); + log.Debug("SEND: [{0}] {1}", this, pevent); + _sender.Send(pevent); } - public void flush() + public void Flush() { - log.debug("FLUSH: [{0}]", this); - _sender.flush(); + log.Debug("FLUSH: [{0}]", this); + _sender.Flush(); } - public Channel getChannel() + public Channel GetChannel() { lock (_channels) { @@ -84,14 +84,14 @@ namespace org.apache.qpid.transport { if (!_channels.ContainsKey(i)) { - return getChannel(i); + return GetChannel(i); } } throw new Exception("no more _channels available"); } } - public Channel getChannel(int number) + public Channel GetChannel(int number) { lock (_channels) { @@ -103,7 +103,7 @@ namespace org.apache.qpid.transport } if (channel == null) { - channel = new Channel(this, number, _connDdelegate.getSessionDelegate()); + channel = new Channel(this, number, _connDdelegate.GetSessionDelegate()); _receiver.Received += channel.On_ReceivedEvent; _channels.Add(number, channel); } @@ -111,7 +111,7 @@ namespace org.apache.qpid.transport } } - public void removeChannel(int number) + public void RemoveChannel(int number) { lock (_channels) { @@ -120,51 +120,51 @@ namespace org.apache.qpid.transport } } - public void On_ReceivedEvent(object sender, ReceivedPayload payload) + public void On_ReceivedEvent(object sender, ReceivedPayload payload) { - log.debug("RECV: [{0}] {1}", this, payload.Payload); + log.Debug("RECV: [{0}] {1}", this, payload.Payload); if (_channels.ContainsKey(payload.Payload.Channel)) return; - Channel channel = getChannel(payload.Payload.Channel); + Channel channel = GetChannel(payload.Payload.Channel); channel.On_ReceivedEvent(sender, payload); } public void On_ReceivedException(Object sender, ExceptionArgs arg) { - _connDdelegate.exception(arg.Exception); + _connDdelegate.Exception(arg.Exception); } public void On_ReceivedClosed(Object sender, EventArgs arg) { - log.debug("Connection closed: {0}", this); + log.Debug("Connection Closed: {0}", this); lock (_channels) { foreach (Channel ch in _channels.Values) { - ch.closedFromConnection(); + ch.ClosedFromConnection(); } } _channels.Clear(); - _connDdelegate.closed(); + _connDdelegate.Closed(); } - public void closeCode(ConnectionClose close) + public void CloseCode(ConnectionClose close) { lock (_channels) { foreach (Channel ch in _channels.Values) { - ch.closeCode(close); + ch.CloseCode(close); } } } - public void close() + public void Close() { - _sender.close(); + _sender.Close(); } - public String toString() + public override 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 d23195a131..825909645d 100644 --- a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -32,16 +32,16 @@ namespace org.apache.qpid.transport /// public abstract class ConnectionDelegate : MethodDelegate { - private static readonly Logger log = Logger.get(typeof(ConnectionDelegate)); + private static readonly Logger log = Logger.Get(typeof(ConnectionDelegate)); private String _virtualHost; private ManualResetEvent _negotiationComplete; - public abstract SessionDelegate getSessionDelegate(); + public abstract SessionDelegate GetSessionDelegate(); - public abstract void exception(Exception t); + public abstract void Exception(Exception t); - public abstract void closed(); + public abstract void Closed(); public void setCondition(ManualResetEvent negotiationComplete) { @@ -50,12 +50,12 @@ namespace org.apache.qpid.transport public virtual void init(Channel ch, ProtocolHeader hdr) { - ch.Connection.send(new ProtocolHeader((byte)1, hdr.Major, hdr.Minor)); + ch.Connection.Send(new ProtocolHeader((byte)1, hdr.Major, hdr.Minor)); List plain = new List(); plain.Add("PLAIN"); List utf8 = new List(); utf8.Add("utf8"); - ch.connectionStart(null, plain, utf8); + ch.ConnectionStart(null, plain, utf8); } public String VirtualHost @@ -67,42 +67,42 @@ namespace org.apache.qpid.transport // ---------------------------------------------- // Client side //----------------------------------------------- - public override void connectionStart(Channel context, ConnectionStart mstruct) + public override void ConnectionStart(Channel context, ConnectionStart mstruct) { Dictionary props = new Dictionary(); - context.connectionStartOk(props, null, null, "utf8"); + context.ConnectionStartOk(props, null, null, "utf8"); } - public override void connectionSecure(Channel context, ConnectionSecure mstruct) + public override void ConnectionSecure(Channel context, ConnectionSecure mstruct) { // todo SASL - context.connectionSecureOk(new byte[0]); + context.ConnectionSecureOk(new byte[0]); } - public override void connectionTune(Channel context, ConnectionTune mstruct) + 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); + 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) + public override void ConnectionOpenOk(Channel context, ConnectionOpenOk mstruct) { - List knownHosts = mstruct.getKnownHosts(); + List knownHosts = mstruct.GetKnownHosts(); if (_negotiationComplete != null) { _negotiationComplete.Set(); } } - public override void connectionRedirect(Channel context, ConnectionRedirect mstruct) + public override void ConnectionRedirect(Channel context, ConnectionRedirect mstruct) { // not going to bother at the moment } - public override void connectionClose(Channel ch, ConnectionClose close) + public override void ConnectionClose(Channel ch, ConnectionClose close) { - ch.Connection.closeCode(close); - ch.connectionCloseOk(); + 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 c6d8cb3022..9af8c4a476 100644 --- a/qpid/dotnet/client-010/client/transport/Field.cs +++ b/qpid/dotnet/client-010/client/transport/Field.cs @@ -19,8 +19,7 @@ * */ using System; -using Decoder = org.apache.qpid.transport.codec.Decoder; -using Encoder = org.apache.qpid.transport.codec.Encoder; +using org.apache.qpid.transport.codec; namespace org.apache.qpid.transport { @@ -62,14 +61,14 @@ namespace org.apache.qpid.transport get { return index; } } - public abstract bool has(Object mystruct); + public abstract bool Has(Object mystruct); - public abstract void has(Object mystruct, bool value); + public abstract void Has(Object mystruct, bool value); - public abstract T get(Object mystruct); + public abstract T Get(Object mystruct); - public abstract void read(Decoder dec, Object mystruct); + public abstract void Read(IDecoder dec, Object mystruct); - public abstract void write(Encoder enc, Object mystruct); + public abstract void Write(IEncoder enc, Object mystruct); } -} \ 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 d2db299586..742531cfd8 100644 --- a/qpid/dotnet/client-010/client/transport/Header.cs +++ b/qpid/dotnet/client-010/client/transport/Header.cs @@ -47,7 +47,7 @@ namespace org.apache.qpid.transport } - public Struct get(Struct klass) + public Struct Get(Struct klass) { foreach (Struct st in _mystructs) { @@ -59,7 +59,7 @@ namespace org.apache.qpid.transport return null; } - public String toString() + public override String ToString() { StringBuilder str = new StringBuilder(); str.Append(" Header("); @@ -80,4 +80,4 @@ namespace org.apache.qpid.transport return str.ToString(); } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/IBinding.cs b/qpid/dotnet/client-010/client/transport/IBinding.cs new file mode 100644 index 0000000000..607212f1fe --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/IBinding.cs @@ -0,0 +1,34 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +using System; + +namespace org.apache.qpid.transport +{ + /// + /// Binding + /// + internal interface IBinding + { + E Endpoint(ISender sender); + + IReceiver Receiver(E endpoint) where R : EventArgs; + } +} diff --git a/qpid/dotnet/client-010/client/transport/IFuture.cs b/qpid/dotnet/client-010/client/transport/IFuture.cs new file mode 100644 index 0000000000..054b828d13 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/IFuture.cs @@ -0,0 +1,38 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +namespace org.apache.qpid.transport +{ + /// + /// Future + /// + public interface IFuture + { + Struct Result + { + get; set; + } + + Session Session + { set; + } + } +} diff --git a/qpid/dotnet/client-010/client/transport/IProtocolDelegate.cs b/qpid/dotnet/client-010/client/transport/IProtocolDelegate.cs new file mode 100644 index 0000000000..a9875fd290 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/IProtocolDelegate.cs @@ -0,0 +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 +{ + /// + /// ProtocolDelegate + /// + public interface IProtocolDelegate + { + void Init(T context, ProtocolHeader header); + + void Control(T context, Method control); + + void Command(T context, Method command); + + void Error(T context, ProtocolError error); + } +} diff --git a/qpid/dotnet/client-010/client/transport/IProtocolEvent.cs b/qpid/dotnet/client-010/client/transport/IProtocolEvent.cs new file mode 100644 index 0000000000..8f915b204a --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/IProtocolEvent.cs @@ -0,0 +1,42 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport +{ + /// + /// IProtocolEvent + /// + public interface IProtocolEvent + { + int Channel + { + get; + set; + } + + byte EncodedTrack + { + set; + get; + } + + void ProcessProtocolEvent(C context, IProtocolDelegate protocoldelegate); + } +} diff --git a/qpid/dotnet/client-010/client/transport/IReceiver.cs b/qpid/dotnet/client-010/client/transport/IReceiver.cs new file mode 100644 index 0000000000..4c4c9572b9 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/IReceiver.cs @@ -0,0 +1,38 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; + +namespace org.apache.qpid.transport +{ + /// + /// a receiver will raise an event when: + /// - data is received + /// - an exception is thrown + /// - it is Closed + /// + public interface IReceiver where T : EventArgs + { + event EventHandler Received; + event EventHandler Exception; + event EventHandler Closed; + } +} diff --git a/qpid/dotnet/client-010/client/transport/ISender.cs b/qpid/dotnet/client-010/client/transport/ISender.cs new file mode 100644 index 0000000000..d7d1781aec --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ISender.cs @@ -0,0 +1,32 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport +{ + /// + /// Sender + /// + public interface ISender + { + void Send(T msg); + void Flush(); + void Close(); + } +} diff --git a/qpid/dotnet/client-010/client/transport/ISession.cs b/qpid/dotnet/client-010/client/transport/ISession.cs new file mode 100644 index 0000000000..257b42b455 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/ISession.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; + +namespace org.apache.qpid.transport +{ + public interface ISession : IInvoker + { + bool IsClosed { get; set; } + string Name { get; } + int CommandsIn { get; set; } + byte[] GetName(); + void SetAutoSync(bool value); + Dictionary GetOutstandingCommands(); + int GetCommandsOut(); + int NextCommandId(); + void Identify(Method cmd); + void Processed(Method command); + void Processed(int command); + void Processed(int lower, int upper); + void Processed(Range range); + void FlushProcessed(params Option[] options); + void KnownComplete(RangeSet kc); + void SyncPoint(); + void Attach(Channel channel); + Method GetCommand(int id); + bool Complete(int lower, int upper); + void Sync(); + void Sync(long timeout); + void Result(int command, Struct result); + void AddException(ExecutionException exc); + void CloseCode(ConnectionClose close); + List GetExceptions(); + + void MessageTransfer(String destination, + MessageAcceptMode acceptMode, + MessageAcquireMode acquireMode, + Header header, + byte[] body, + params Option[] options); + + void MessageTransfer(String destination, + MessageAcceptMode acceptMode, + MessageAcquireMode acquireMode, + Header header, + String body, + params Option[] options); + + void Close(); + void Exception(Exception t); + void Closed(); + } +} diff --git a/qpid/dotnet/client-010/client/transport/Method.cs b/qpid/dotnet/client-010/client/transport/Method.cs index a21a3bcb72..8540698822 100644 --- a/qpid/dotnet/client-010/client/transport/Method.cs +++ b/qpid/dotnet/client-010/client/transport/Method.cs @@ -28,9 +28,9 @@ namespace org.apache.qpid.transport /// /// Method /// - public abstract class Method : Struct, ProtocolEvent + public abstract class Method : Struct, IProtocolEvent { - public new static Method create(int type) + public new static Method Create(int type) { return (Method) StructFactory.createInstruction(type); } @@ -65,7 +65,7 @@ namespace org.apache.qpid.transport set { batch = value; } } - public abstract bool hasPayload(); + public abstract bool HasPayload(); public virtual Header Header { @@ -80,9 +80,9 @@ namespace org.apache.qpid.transport } - public abstract void dispatch(C context, MethodDelegate mdelegate ); + public abstract void Dispatch(C context, MethodDelegate mdelegate ); - #region ProtocolEvent + #region IProtocolEvent public int Channel { @@ -92,7 +92,7 @@ namespace org.apache.qpid.transport public abstract byte EncodedTrack { get; set; } - public void ProcessProtocolEvent(C context, ProtocolDelegate protocoldelegate) + public void ProcessProtocolEvent(C context, IProtocolDelegate protocoldelegate) { if (EncodedTrack == Frame.L4) { @@ -106,7 +106,7 @@ namespace org.apache.qpid.transport #endregion - public new String toString() + public override String ToString() { StringBuilder str = new StringBuilder(); @@ -134,10 +134,10 @@ namespace org.apache.qpid.transport str.Append("]"); } str.Append(" "); - str.Append(base.toString()); + str.Append(base.ToString()); if (Header != null) { - str.Append(Header.toString()); + str.Append(Header.ToString()); } if (Body != null) { @@ -147,4 +147,4 @@ namespace org.apache.qpid.transport return str.ToString(); } } -} \ 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 6e95563cc2..2a5bf39565 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolError.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolError.cs @@ -19,15 +19,14 @@ * */ using System; -using NetworkDelegate = org.apache.qpid.transport.network.NetworkDelegate; -using NetworkEvent = org.apache.qpid.transport.network.NetworkEvent; +using org.apache.qpid.transport.network; namespace org.apache.qpid.transport { /// /// ProtocolError /// - public sealed class ProtocolError : NetworkEvent, ProtocolEvent + public sealed class ProtocolError : INetworkEvent, IProtocolEvent { private int channel; private byte track; @@ -41,16 +40,16 @@ namespace org.apache.qpid.transport this.args = args; } - #region NetworkEvent Methods + #region INetworkEvent Methods - public void ProcessNetworkEvent(NetworkDelegate ndelegate) + public void ProcessNetworkEvent(INetworkDelegate ndelegate) { ndelegate.Error(this); } #endregion - #region ProtocolEvent Methods + #region IProtocolEvent Methods public int Channel { @@ -64,7 +63,7 @@ namespace org.apache.qpid.transport set { throw new NotImplementedException(); } } - public void ProcessProtocolEvent(C context, ProtocolDelegate protocoldelegate) + public void ProcessProtocolEvent(C context, IProtocolDelegate protocoldelegate) { protocoldelegate.Error(context, this); } @@ -77,10 +76,10 @@ namespace org.apache.qpid.transport } - public String toString() + public override String ToString() { return String.Format("protocol error: {0}", Message); } } -} \ 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 d20f296ac0..4adfee25df 100644 --- a/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs +++ b/qpid/dotnet/client-010/client/transport/ProtocolHeader.cs @@ -21,8 +21,7 @@ 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 org.apache.qpid.transport.network; using Frame = org.apache.qpid.transport.network.Frame; namespace org.apache.qpid.transport @@ -30,7 +29,7 @@ namespace org.apache.qpid.transport /// ProtocolHeader /// /// - public sealed class ProtocolHeader : NetworkEvent, ProtocolEvent + public sealed class ProtocolHeader : INetworkEvent, IProtocolEvent { private readonly char[] AMQP = new char[] {'A', 'M', 'Q', 'P'}; private const byte CLASS = 1; @@ -51,16 +50,16 @@ namespace org.apache.qpid.transport { } - #region NetworkEvent Methods + #region INetworkEvent Methods - public void ProcessNetworkEvent(NetworkDelegate ndelegate) + public void ProcessNetworkEvent(INetworkDelegate ndelegate) { ndelegate.Init(this); } #endregion - #region ProtocolEvent Methods + #region IProtocolEvent Methods public int Channel { @@ -83,7 +82,7 @@ namespace org.apache.qpid.transport set { throw new NotImplementedException(); } } - public void ProcessProtocolEvent(C context, ProtocolDelegate protocoldelegate) + public void ProcessProtocolEvent(C context, IProtocolDelegate protocoldelegate) { protocoldelegate.Init(context, this); } @@ -117,9 +116,9 @@ namespace org.apache.qpid.transport return buf; } - public String toString() + public override 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 64b5e58c52..904b1c1229 100644 --- a/qpid/dotnet/client-010/client/transport/Range.cs +++ b/qpid/dotnet/client-010/client/transport/Range.cs @@ -52,49 +52,49 @@ namespace org.apache.qpid.transport set { _upper = value; } } - public bool includes(int value) + public bool Includes(int value) { - return Serial.le(_lower, value) && Serial.le(value, _upper); + return Serial.Le(_lower, value) && Serial.Le(value, _upper); } - public bool includes(Range range) + public bool Includes(Range range) { - return includes(range._lower) && includes(range._upper); + return Includes(range._lower) && Includes(range._upper); } - public bool intersects(Range range) + public bool Intersects(Range range) { - return (includes(range._lower) || includes(range._upper) || - range.includes(_lower) || range.includes(_upper)); + return (Includes(range._lower) || Includes(range._upper) || + range.Includes(_lower) || range.Includes(_upper)); } - public bool touches(Range range) + public bool Touches(Range range) { - return (intersects(range) || - includes(range._upper + 1) || includes(range._lower - 1) || - range.includes(_upper + 1) || range.includes(_lower - 1)); + return (Intersects(range) || + Includes(range._upper + 1) || Includes(range._lower - 1) || + range.Includes(_upper + 1) || range.Includes(_lower - 1)); } - public Range span(Range range) + public Range Span(Range range) { - return new Range(Serial.min(_lower, range._lower), Serial.max(_upper, range._upper)); + return new Range(Serial.Min(_lower, range._lower), Serial.Max(_upper, range._upper)); } - public List subtract(Range range) + public List Subtract(Range range) { List result = new List(); - if (includes(range._lower) && Serial.le(_lower, range._lower - 1)) + 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)) + 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)) + if (result.Count == 0 && !range.Includes(this)) { result.Add(this); } @@ -102,16 +102,16 @@ namespace org.apache.qpid.transport return result; } - public Range intersect(Range range) + 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); + 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() + public override 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 16792d98de..0a856ee979 100644 --- a/qpid/dotnet/client-010/client/transport/RangeSet.cs +++ b/qpid/dotnet/client-010/client/transport/RangeSet.cs @@ -45,22 +45,22 @@ namespace org.apache.qpid.transport } - public int size() + public int Size() { return _ranges.Count; } - public Range getFirst() + public Range GetFirst() { return _ranges[0]; } - public bool includes(Range range) + public bool Includes(Range range) { foreach (Range r in this) { - if (r.includes(range)) + if (r.Includes(range)) { return true; } @@ -69,11 +69,11 @@ namespace org.apache.qpid.transport return false; } - public bool includes(int n) + public bool Includes(int n) { foreach (Range r in this) { - if (r.includes(n)) + if (r.Includes(n)) { return true; } @@ -82,17 +82,17 @@ namespace org.apache.qpid.transport return false; } - public void add(Range range) + public void Add(Range range) { for (int i = 0; i < _ranges.Count; i++) { Range r = _ranges[i]; - if (range.touches(r)) + if (range.Touches(r)) { _ranges.Remove(r); - range = range.span(r); + range = range.Span(r); } - else if (Serial.lt(range.Upper, r.Lower)) + else if (Serial.Lt(range.Upper, r.Lower)) { _ranges.Insert(i - 1 , range); return; @@ -101,22 +101,22 @@ namespace org.apache.qpid.transport _ranges.Add(range); } - public void add(int lower, int upper) + public void Add(int lower, int upper) { - add(new Range(lower, upper)); + Add(new Range(lower, upper)); } - public void add(int value) + public void Add(int value) { - add(value, value); + Add(value, value); } - public void clear() + public void Clear() { _ranges.Clear(); } - public RangeSet copy() + public RangeSet Copy() { RangeSet copy = new RangeSet(); foreach (Range r in _ranges) @@ -126,7 +126,7 @@ namespace org.apache.qpid.transport return copy; } - public String toString() + public override String ToString() { StringBuilder str = new StringBuilder(); str.Append("{"); @@ -147,4 +147,4 @@ namespace org.apache.qpid.transport return str.ToString(); } } -} \ 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 7feb397036..7b4aff9811 100644 --- a/qpid/dotnet/client-010/client/transport/Session.cs +++ b/qpid/dotnet/client-010/client/transport/Session.cs @@ -34,9 +34,9 @@ namespace org.apache.qpid.transport /// Session /// /// - public class Session : Invoker + public class Session : Invoker, ISession { - private static readonly Logger log = Logger.get(typeof (Session)); + private static readonly Logger log = Logger.Get(typeof (Session)); private static readonly bool ENABLE_REPLAY; static Session() @@ -77,11 +77,11 @@ namespace org.apache.qpid.transport private int _maxComplete = - 1; private bool _needSync = false; private bool _closed; - private readonly Dictionary _results = new Dictionary(); + private readonly Dictionary _results = new Dictionary(); private readonly List _exceptions = new List(); - public bool Closed + public bool IsClosed { get { @@ -113,12 +113,12 @@ namespace org.apache.qpid.transport _name = name; } - public byte[] getName() + public byte[] GetName() { return _name; } - public void setAutoSync(bool value) + public void SetAutoSync(bool value) { lock (_commands) { @@ -126,12 +126,12 @@ namespace org.apache.qpid.transport } } - public Dictionary getOutstandingCommands() + public Dictionary GetOutstandingCommands() { return _commands; } - public int getCommandsOut() + public int GetCommandsOut() { return _commandsOut; } @@ -142,79 +142,79 @@ namespace org.apache.qpid.transport set { _commandsIn = value; } } - public int nextCommandId() + public int NextCommandId() { return _commandsIn++; } - public void identify(Method cmd) + public void Identify(Method cmd) { - int id = nextCommandId(); + int id = NextCommandId(); cmd.Id = id; - if (log.isDebugEnabled()) + if (log.IsDebugEnabled()) { - log.debug("ID: [{0}] %{1}", _channel, id); + log.Debug("ID: [{0}] %{1}", _channel, id); } //if ((id % 65536) == 0) if ((id & 0xff) == 0) { - flushProcessed(Option.TIMELY_REPLY); + FlushProcessed(Option.TIMELY_REPLY); } } - public void processed(Method command) + public void Processed(Method command) { - processed(command.Id); + Processed(command.Id); } - public void processed(int command) + public void Processed(int command) { - processed(new Range(command, command)); + Processed(new Range(command, command)); } - public void processed(int lower, int upper) + public void Processed(int lower, int upper) { - processed(new Range(lower, upper)); + Processed(new Range(lower, upper)); } - public void processed(Range range) + public void Processed(Range range) { - log.debug("{0} processed({1})", this, range); + log.Debug("{0} processed({1})", this, range); bool flush; lock (_processedLock) { - _processed.add(range); - Range first = _processed.getFirst(); + _processed.Add(range); + Range first = _processed.GetFirst(); int lower = first.Lower; int upper = first.Upper; int old = _maxProcessed; - if (Serial.le(lower, _maxProcessed + 1)) + if (Serial.Le(lower, _maxProcessed + 1)) { - _maxProcessed = Serial.max(_maxProcessed, upper); + _maxProcessed = Serial.Max(_maxProcessed, upper); } - flush = Serial.lt(old, _syncPoint) && Serial.ge(_maxProcessed, _syncPoint); + flush = Serial.Lt(old, _syncPoint) && Serial.Ge(_maxProcessed, _syncPoint); _syncPoint = _maxProcessed; } if (flush) { - flushProcessed(); + FlushProcessed(); } } - public void flushProcessed(params Option[] options) + public void FlushProcessed(params Option[] options) { RangeSet copy; lock (_processedLock) { - copy = _processed.copy(); + copy = _processed.Copy(); } - sessionCompleted(copy, options); + SessionCompleted(copy, options); } - public void knownComplete(RangeSet kc) + public void KnownComplete(RangeSet kc) { lock (_processedLock) { @@ -223,9 +223,9 @@ namespace org.apache.qpid.transport { foreach (Range kr in kc) { - foreach (Range r in pr.subtract(kr)) + foreach (Range r in pr.Subtract(kr)) { - newProcessed.add(r); + newProcessed.Add(r); } } } @@ -233,29 +233,29 @@ namespace org.apache.qpid.transport } } - public void syncPoint() + public void SyncPoint() { int id = CommandsIn - 1; - log.debug("{0} synced to {1}", this, id); + log.Debug("{0} synced to {1}", this, id); bool flush; lock (_processedLock) { _syncPoint = id; - flush = Serial.ge(_maxProcessed, _syncPoint); + flush = Serial.Ge(_maxProcessed, _syncPoint); } if (flush) { - flushProcessed(); + FlushProcessed(); } } - public void attach(Channel channel) + public void Attach(Channel channel) { _channel = channel; _channel.Session = this; } - public Method getCommand(int id) + public Method GetCommand(int id) { lock (_commands) { @@ -263,35 +263,35 @@ namespace org.apache.qpid.transport } } - public bool complete(int lower, int upper) + public bool Complete(int lower, int upper) { //avoid autoboxing - if (log.isDebugEnabled()) + if (log.IsDebugEnabled()) { - log.debug("{0} complete({1}, {2})", this, lower, upper); + 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++) + for (int id = Serial.Max(_maxComplete, lower); Serial.Le(id, upper); id++) { _commands.Remove(id); } - if (Serial.le(lower, _maxComplete + 1)) + if (Serial.Le(lower, _maxComplete + 1)) { - _maxComplete = Serial.max(_maxComplete, upper); + _maxComplete = Serial.Max(_maxComplete, upper); } - log.debug("{0} commands remaining: {1}", this, _commands); + log.Debug("{0} commands remaining: {1}", this, _commands); Monitor.PulseAll(_commands); - return Serial.gt(_maxComplete, old); + return Serial.Gt(_maxComplete, old); } } - protected override void invoke(Method m) + protected override void Invoke(Method m) { - if (Closed) + if (IsClosed) { - List exc = getExceptions(); + List exc = GetExceptions(); if (exc.Count > 0) { throw new SessionException(exc); @@ -314,7 +314,7 @@ namespace org.apache.qpid.transport m.Id = next; if (next == 0) { - sessionCommandPoint(0, 0); + SessionCommandPoint(0, 0); } if (ENABLE_REPLAY) { @@ -325,59 +325,59 @@ namespace org.apache.qpid.transport m.Sync = true; } _needSync = ! m.Sync; - _channel.method(m); + _channel.Method(m); if (_autoSync) { - sync(); + Sync(); } // flush every 64K commands to avoid ambiguity on // wraparound if ((next%65536) == 0) { - sessionFlush(Option.COMPLETED); + SessionFlush(Option.COMPLETED); } } } else { - _channel.method(m); + _channel.Method(m); } } - public void sync() + public void Sync() { - sync(_timeout); + Sync(_timeout); } - public void sync(long timeout) + public void Sync(long timeout) { - log.debug("{0} sync()", this); + log.Debug("{0} sync()", this); lock (_commands) { int point = _commandsOut - 1; - if (_needSync && Serial.lt(_maxComplete, point)) + if (_needSync && Serial.Lt(_maxComplete, point)) { - executionSync(Option.SYNC); + ExecutionSync(Option.SYNC); } DateTime start = DateTime.Now; long elapsed = 0; - while (! Closed && elapsed < timeout && Serial.lt(_maxComplete, point)) + while (!IsClosed && elapsed < timeout && Serial.Lt(_maxComplete, point)) { - log.debug("{0} waiting for[{1}]: {2}, {3}", this, 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 (Serial.Lt(_maxComplete, point)) { - if (Closed) + if (IsClosed) { - throw new SessionException(getExceptions()); + throw new SessionException(GetExceptions()); } else { @@ -390,9 +390,9 @@ namespace org.apache.qpid.transport } - public void result(int command, Struct result) + public void Result(int command, Struct result) { - Future future; + IFuture future; lock (_results) { if (_results.ContainsKey(command)) @@ -408,7 +408,7 @@ namespace org.apache.qpid.transport future.Result = result; } - public void addException(ExecutionException exc) + public void AddException(ExecutionException exc) { lock (_exceptions) { @@ -418,12 +418,12 @@ namespace org.apache.qpid.transport private ConnectionClose _close = null; - public void closeCode(ConnectionClose close) + public void CloseCode(ConnectionClose close) { _close = close; } - public List getExceptions() + public List GetExceptions() { lock (_exceptions) { @@ -431,7 +431,7 @@ namespace org.apache.qpid.transport } } - public override Future invoke(Method m, Future future) + public override IFuture Invoke(Method m, IFuture future) { lock (_commands) { @@ -441,13 +441,13 @@ namespace org.apache.qpid.transport { _results.Add(command, future); } - invoke(m); + Invoke(m); } return future; } - public void messageTransfer(String destination, + public void MessageTransfer(String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, Header header, @@ -456,31 +456,31 @@ namespace org.apache.qpid.transport { MemoryStream mbody = new MemoryStream(); mbody.Write(body,0, body.Length); - messageTransfer(destination, acceptMode, acquireMode, header, + MessageTransfer(destination, acceptMode, acquireMode, header, mbody, options); } - public void messageTransfer(String destination, + public void MessageTransfer(String destination, MessageAcceptMode acceptMode, MessageAcquireMode acquireMode, Header header, String body, params Option[] options) { - messageTransfer(destination, acceptMode, acquireMode, header, + MessageTransfer(destination, acceptMode, acquireMode, header, new MemoryStream(Convert.ToByte(body)), options); } - public void close() + public void Close() { - sessionRequestTimeout(0); - sessionDetach(_name); + SessionRequestTimeout(0); + SessionDetach(_name); lock (_commands) { DateTime start = DateTime.Now; long elapsed = 0; - while (! Closed && elapsed < _timeout) + while (!IsClosed && elapsed < _timeout) { Monitor.Wait(_commands, (int) (_timeout - elapsed)); elapsed = DateTime.Now.Subtract(start).Milliseconds; @@ -488,21 +488,21 @@ namespace org.apache.qpid.transport } } - public void exception(Exception t) + public void Exception(Exception t) { - log.error(t, "Caught exception"); + log.Error(t, "Caught exception"); } - public void closed() + public void Closed() { - Closed = true; + IsClosed = true; lock (_commands) { Monitor.PulseAll(_commands); } lock (_results) { - foreach (Future result in _results.Values) + foreach (IFuture result in _results.Values) { lock (result) { @@ -514,9 +514,9 @@ namespace org.apache.qpid.transport _channel = null; } - public String toString() + public override 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 52699b072a..973e22df16 100644 --- a/qpid/dotnet/client-010/client/transport/SessionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/SessionDelegate.cs @@ -25,7 +25,7 @@ namespace org.apache.qpid.transport /// SessionDelegate /// /// - public abstract class SessionDelegate : MethodDelegate, ProtocolDelegate + public abstract class SessionDelegate : MethodDelegate, IProtocolDelegate { public void Init(Session ssn, ProtocolHeader hdr) { @@ -33,16 +33,16 @@ namespace org.apache.qpid.transport public void Control(Session ssn, Method method) { - method.dispatch(ssn, this); + method.Dispatch(ssn, this); } public void Command(Session ssn, Method method) { - ssn.identify(method); - method.dispatch(ssn, this); - if (!method.hasPayload()) + ssn.Identify(method); + method.Dispatch(ssn, this); + if (!method.HasPayload()) { - ssn.processed(method); + ssn.Processed(method); } } @@ -50,21 +50,21 @@ namespace org.apache.qpid.transport { } - public override void executionResult(Session ssn, ExecutionResult result) + public override void ExecutionResult(Session ssn, ExecutionResult result) { - ssn.result(result.getCommandId(), result.getValue()); + ssn.Result(result.GetCommandId(), result.GetValue()); } - public override void executionException(Session ssn, ExecutionException exc) + public override void ExecutionException(Session ssn, ExecutionException exc) { - ssn.addException(exc); + ssn.AddException(exc); } - public override void sessionCompleted(Session ssn, SessionCompleted cmp) + public override void SessionCompleted(Session ssn, SessionCompleted cmp) { - RangeSet ranges = cmp.getCommands(); + RangeSet ranges = cmp.GetCommands(); RangeSet known = null; - if (cmp.getTimelyReply()) + if (cmp.GetTimelyReply()) { known = new RangeSet(); } @@ -73,54 +73,54 @@ namespace org.apache.qpid.transport { foreach (Range range in ranges) { - bool advanced = ssn.complete(range.Lower, range.Upper); + bool advanced = ssn.Complete(range.Lower, range.Upper); if (advanced && known != null) { - known.add(range); + known.Add(range); } } } if (known != null) { - ssn.sessionKnownCompleted(known); + ssn.SessionKnownCompleted(known); } } - public override void sessionKnownCompleted(Session ssn, SessionKnownCompleted kcmp) + public override void SessionKnownCompleted(Session ssn, SessionKnownCompleted kcmp) { - RangeSet kc = kcmp.getCommands(); + RangeSet kc = kcmp.GetCommands(); if (kc != null) { - ssn.knownComplete(kc); + ssn.KnownComplete(kc); } } - public override void sessionFlush(Session ssn, SessionFlush flush) + public override void SessionFlush(Session ssn, SessionFlush flush) { - if (flush.getCompleted()) + if (flush.GetCompleted()) { - ssn.flushProcessed(); + ssn.FlushProcessed(); } - if (flush.getConfirmed()) + if (flush.GetConfirmed()) { - ssn.flushProcessed(); + ssn.FlushProcessed(); } - if (flush.getExpected()) + if (flush.GetExpected()) { // to be done //throw new Exception("not implemented"); } } - public override void sessionCommandPoint(Session ssn, SessionCommandPoint scp) + public override void SessionCommandPoint(Session ssn, SessionCommandPoint scp) { - ssn.CommandsIn = scp.getCommandId(); + ssn.CommandsIn = scp.GetCommandId(); } - public override void executionSync(Session ssn, ExecutionSync sync) + public override void ExecutionSync(Session ssn, ExecutionSync sync) { - ssn.syncPoint(); + 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 6b62c82974..ff8d80fcb1 100644 --- a/qpid/dotnet/client-010/client/transport/Struct.cs +++ b/qpid/dotnet/client-010/client/transport/Struct.cs @@ -21,18 +21,17 @@ 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; +using org.apache.qpid.transport.codec; + namespace org.apache.qpid.transport { /// /// Struct /// - public abstract class Struct : Encodable + public abstract class Struct : IEncodable { - public static Struct create(int type) + public static Struct Create(int type) { return StructFactory.create(type); } @@ -45,15 +44,15 @@ namespace org.apache.qpid.transport set { dirty = value; } } - public abstract int getStructType(); + public abstract int GetStructType(); - public abstract int getSizeWidth(); + public abstract int GetSizeWidth(); - public abstract int getPackWidth(); + public abstract int GetPackWidth(); - public int getEncodedType() + public int GetEncodedType() { - int type = getStructType(); + int type = GetStructType(); if (type < 0) { throw new Exception(); @@ -61,41 +60,41 @@ namespace org.apache.qpid.transport return type; } - private bool isBit(Field f) + private bool IsBit(Field f) { return Equals(f.Type, typeof(Boolean)); } - private bool packed() + private bool Packed() { - return getPackWidth() > 0; + return GetPackWidth() > 0; } - private bool encoded(Field f) + private bool Encoded(Field f) { - return !packed() || !isBit(f) && f.has(this); + return !Packed() || !IsBit(f) && f.Has(this); } - private int getFlagWidth() + private int GetFlagWidth() { return (Fields.Count + 7) / 8; } - private int getFlagCount() + private int GetFlagCount() { - return 8 * getPackWidth(); + return 8 * GetPackWidth(); } - public abstract void read(Decoder dec); + public abstract void Read(IDecoder dec); - public abstract void write(Encoder enc); + public abstract void Write(IEncoder enc); public abstract Dictionary Fields { get; } - public String toString() + public override String ToString() { StringBuilder str = new StringBuilder(); str.Append(GetType()); @@ -119,4 +118,4 @@ namespace org.apache.qpid.transport 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 0111c7a87e..2e9e587407 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractDecoder.cs @@ -29,133 +29,133 @@ namespace org.apache.qpid.transport.codec /// /// AbstractDecoder /// - public abstract class AbstractDecoder : Decoder + public abstract class AbstractDecoder : IDecoder { private readonly Dictionary str8cache = new Dictionary(); - protected abstract byte doGet(); + protected abstract byte DoGet(); - protected abstract void doGet(byte[] bytes); - public abstract bool hasRemaining(); + protected abstract void DoGet(byte[] bytes); + public abstract bool HasRemaining(); - protected byte get() + protected byte Get() { - return doGet(); + return DoGet(); } - protected void get(byte[] bytes) + protected void Get(byte[] bytes) { - doGet(bytes); + DoGet(bytes); } - protected Binary get(int size) + protected Binary Get(int size) { byte[] bytes = new byte[size]; - get(bytes); + Get(bytes); return new Binary(bytes); } - protected short uget() + protected short Uget() { - return (short) (0xFF & get()); + return (short) (0xFF & Get()); } - public virtual short readUint8() + public virtual short ReadUint8() { - return uget(); + return Uget(); } - public abstract int readUint16(); + public abstract int ReadUint16(); - public abstract long readUint32(); + public abstract long ReadUint32(); - public int readSequenceNo() + public int ReadSequenceNo() { - return (int) readUint32(); + return (int) ReadUint32(); } - public virtual long readUint64() + public virtual long ReadUint64() { long l = 0; for (int i = 0; i < 8; i++) { - l |= ((long) (0xFF & get())) << (56 - i*8); + 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 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() + public long ReadDatetime() { - return readUint64(); + return ReadUint64(); } - private static String decode(byte[] bytes, int offset, int length, Encoding encoding) + 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) + private static String Decode(byte[] bytes, Encoding encoding) { - return decode(bytes, 0, bytes.Length, encoding); + return Decode(bytes, 0, bytes.Length, encoding); } - public String readStr8() + public String ReadStr8() { - short size = readUint8(); - Binary bin = get(size); + 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); + str = Decode(bin.Array(), bin.Offset(), bin.Size(), Encoding.UTF8); str8cache.Add(bin, str); } return str; } - public String readStr16() + public String ReadStr16() { - int size = readUint16(); + int size = ReadUint16(); byte[] bytes = new byte[size]; - get(bytes); - return decode(bytes, Encoding.UTF8); + Get(bytes); + return Decode(bytes, Encoding.UTF8); } - public byte[] readVbin8() + public byte[] ReadVbin8() { - int size = readUint8(); + int size = ReadUint8(); byte[] bytes = new byte[size]; - get(bytes); + Get(bytes); return bytes; } - public byte[] readVbin16() + public byte[] ReadVbin16() { - int size = readUint16(); + int size = ReadUint16(); byte[] bytes = new byte[size]; - get(bytes); + Get(bytes); return bytes; } - public byte[] readVbin32() + public byte[] ReadVbin32() { - int size = (int) readUint32(); + int size = (int) ReadUint32(); byte[] bytes = new byte[size]; - get(bytes); + Get(bytes); return bytes; } - public RangeSet readSequenceSet() + public RangeSet ReadSequenceSet() { - int count = readUint16()/8; + int count = ReadUint16()/8; if (count == 0) { return null; @@ -163,35 +163,35 @@ namespace org.apache.qpid.transport.codec RangeSet ranges = new RangeSet(); for (int i = 0; i < count; i++) { - ranges.add(readSequenceNo(), readSequenceNo()); + ranges.Add(ReadSequenceNo(), ReadSequenceNo()); } return ranges; } - public RangeSet readByteRanges() + public RangeSet ReadByteRanges() { throw new Exception("not implemented"); } - public UUID readUuid() + public UUID ReadUuid() { - long msb = readUint64(); - long lsb = readUint64(); + long msb = ReadUint64(); + long lsb = ReadUint64(); return new UUID(msb, lsb); } - public String readContent() + public String ReadContent() { throw new Exception("Deprecated"); } - public Struct readStruct(int type) + public Struct ReadStruct(int type) { - Struct st = Struct.create(type); - int width = st.getSizeWidth(); + Struct st = Struct.Create(type); + int width = st.GetSizeWidth(); if (width > 0) { - long size = readSize(width); + long size = ReadSize(width); if (size == 0) { return null; @@ -199,200 +199,200 @@ namespace org.apache.qpid.transport.codec } if (type > 0) { - int code = readUint16(); + int code = ReadUint16(); Debug.Assert(code == type); } - st.read(this); + st.Read(this); return st; } - public Struct readStruct32() + public Struct ReadStruct32() { - long size = readUint32(); + long size = ReadUint32(); if (size == 0) { return null; } - int type = readUint16(); - Struct result = Struct.create(type); - result.read(this); + int type = ReadUint16(); + Struct result = Struct.Create(type); + result.Read(this); return result; } - public Dictionary readMap() + public Dictionary ReadMap() { - long size = readUint32(); + long size = ReadUint32(); if (size == 0) { return null; } - long count = readUint32(); + long count = ReadUint32(); Dictionary result = new Dictionary(); for (int i = 0; i < count; i++) { - String key = readStr8(); - byte code = get(); - QpidType t = getType(code); - Object value = read(t); + String key = ReadStr8(); + byte code = Get(); + QpidType t = GetType(code); + Object value = Read(t); result.Add(key, value); } return result; } - public List readList() + public List ReadList() { - long size = readUint32(); + long size = ReadUint32(); if (size == 0) { return null; } - long count = readUint32(); + long count = ReadUint32(); List result = new List(); for (int i = 0; i < count; i++) { - byte code = get(); - QpidType t = getType(code); - Object value = read(t); + byte code = Get(); + QpidType t = GetType(code); + Object value = Read(t); result.Add(value); } return result; } - public List readArray() + public List ReadArray() { - long size = readUint32(); + long size = ReadUint32(); if (size == 0) { return null; } - byte code = get(); - QpidType t = getType(code); - long count = readUint32(); + byte code = Get(); + QpidType t = GetType(code); + long count = ReadUint32(); List result = new List(); for (int i = 0; i < count; i++) { - Object value = read(t); + Object value = Read(t); result.Add(value); } return result; } - private QpidType getType(byte code) + private QpidType GetType(byte code) { return QpidType.get(code); } - private long readSize(QpidType t) + private long ReadSize(QpidType t) { - return t.Fixed ? t.Width : readSize(t.Width); + return t.Fixed ? t.Width : ReadSize(t.Width); } - private long readSize(int width) + private long ReadSize(int width) { switch (width) { case 1: - return readUint8(); + return ReadUint8(); case 2: - return readUint16(); + return ReadUint16(); case 4: - return readUint32(); + return ReadUint32(); default: throw new Exception("illegal width: " + width); } } - private byte[] readBytes(QpidType t) + private byte[] ReadBytes(QpidType t) { - long size = readSize(t); + long size = ReadSize(t); byte[] result = new byte[(int) size]; - get(result); + Get(result); return result; } - private Object read(QpidType t) + private Object Read(QpidType t) { switch (t.Code) { case Code.BIN8: case Code.UINT8: - return readUint8(); + return ReadUint8(); case Code.INT8: - return get(); + return Get(); case Code.CHAR: - return (char) get(); + return (char) Get(); case Code.BOOLEAN: - return get() > 0; + return Get() > 0; case Code.BIN16: case Code.UINT16: - return readUint16(); + return ReadUint16(); case Code.INT16: - return (short) readUint16(); + return (short) ReadUint16(); case Code.BIN32: case Code.UINT32: - return readUint32(); + return ReadUint32(); case Code.CHAR_UTF32: case Code.INT32: - return (int) readUint32(); + return (int) ReadUint32(); case Code.FLOAT: - return (float)BitConverter.Int64BitsToDouble(readUint32() << 32); + return (float)BitConverter.Int64BitsToDouble(ReadUint32() << 32); case Code.BIN64: case Code.UINT64: case Code.INT64: case Code.DATETIME: - return readUint64(); + return ReadUint64(); case Code.DOUBLE: - return BitConverter.Int64BitsToDouble(readUint64()); + return BitConverter.Int64BitsToDouble(ReadUint64()); case Code.UUID: - return readUuid(); + return ReadUuid(); case Code.STR8: - return readStr8(); + return ReadStr8(); case Code.STR16: - return readStr16(); + 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)); + return Encoding.UTF8.GetString(ReadBytes(t)); case Code.MAP: - return readMap(); + return ReadMap(); case Code.LIST: - return readList(); + return ReadList(); case Code.ARRAY: - return readArray(); + return ReadArray(); case Code.STRUCT32: - return readStruct32(); + 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); + return ReadBytes(t); case Code.VOID: return null; default: - return readBytes(t); + 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 dcb6c09925..014fb82ef7 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -30,7 +30,7 @@ namespace org.apache.qpid.transport.codec /// /// AbstractEncoder /// - public abstract class AbstractEncoder : Encoder + public abstract class AbstractEncoder : IEncoder { private static readonly Dictionary ENCODINGS = new Dictionary(); private readonly Dictionary str8cache = new Dictionary(); @@ -51,88 +51,88 @@ namespace org.apache.qpid.transport.codec ENCODINGS.Add(typeof (byte[]), Code.VBIN32); } - protected abstract void doPut(byte b); + protected abstract void DoPut(byte b); - protected abstract void doPut(MemoryStream src); + protected abstract void DoPut(MemoryStream src); - protected void put(byte b) + protected void Put(byte b) { - doPut(b); + DoPut(b); } - protected void put(MemoryStream src) + protected void Put(MemoryStream src) { - doPut(src); + DoPut(src); } - protected virtual void put(byte[] bytes) + protected virtual void Put(byte[] bytes) { - put(new MemoryStream(bytes)); + Put(new MemoryStream(bytes)); } - protected abstract int beginSize8(); - protected abstract void endSize8(int pos); + protected abstract int BeginSize8(); + protected abstract void EndSize8(int pos); - protected abstract int beginSize16(); - protected abstract void endSize16(int pos); + protected abstract int BeginSize16(); + protected abstract void EndSize16(int pos); - protected abstract int beginSize32(); - protected abstract void endSize32(int pos); + protected abstract int BeginSize32(); + protected abstract void EndSize32(int pos); - public virtual void writeUint8(short b) + public virtual void WriteUint8(short b) { Debug.Assert(b < 0x100); - put((byte) b); + Put((byte) b); } - public virtual void writeUint16(int s) + public virtual void WriteUint16(int s) { Debug.Assert(s < 0x10000); - put((byte) Functions.lsb(s >> 8)); - put((byte) Functions.lsb(s)); + Put((byte) Functions.Lsb(s >> 8)); + Put((byte) Functions.Lsb(s)); } - public virtual void writeUint32(long i) + 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)); + 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) + public void WriteSequenceNo(int i) { - writeUint32(i); + WriteUint32(i); } - public virtual void writeUint64(long l) + public virtual void WriteUint64(long l) { for (int i = 0; i < 8; i++) { - put((byte) Functions.lsb(l >> (56 - i*8))); + 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 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) + public void WriteDatetime(long l) { - writeUint64(l); + WriteUint64(l); } - private static byte[] encode(String s, Encoding encoding) + private static byte[] Encode(String s, Encoding encoding) { return encoding.GetBytes(s); } - public void writeStr8(String s) + public void WriteStr8(String s) { if (s == null) { @@ -142,30 +142,30 @@ namespace org.apache.qpid.transport.codec byte[] bytes; if (! str8cache.ContainsKey(s)) { - bytes = encode(s, Encoding.UTF8); + bytes = Encode(s, System.Text.Encoding.UTF8); str8cache.Add(s, bytes); } else { bytes = str8cache[s]; } - writeUint8((short) bytes.Length); - put(bytes); + WriteUint8((short) bytes.Length); + Put(bytes); } - public void writeStr16(String s) + public void WriteStr16(String s) { if (s == null) { s = ""; } - byte[] bytes = encode(s, Encoding.UTF8); - writeUint16(bytes.Length); - put(bytes); + byte[] bytes = Encode(s, System.Text.Encoding.UTF8); + WriteUint16(bytes.Length); + Put(bytes); } - public void writeVbin8(byte[] bytes) + public void WriteVbin8(byte[] bytes) { if (bytes == null) { @@ -175,53 +175,53 @@ namespace org.apache.qpid.transport.codec { throw new Exception("array too long: " + bytes.Length); } - writeUint8((short) bytes.Length); - put(bytes); + WriteUint8((short) bytes.Length); + Put(bytes); } - public void writeVbin16(byte[] bytes) + public void WriteVbin16(byte[] bytes) { if (bytes == null) { bytes = new byte[0]; } - writeUint16(bytes.Length); - put(bytes); + WriteUint16(bytes.Length); + Put(bytes); } - public void writeVbin32(byte[] bytes) + public void WriteVbin32(byte[] bytes) { if (bytes == null) { bytes = new byte[0]; } - writeUint32(bytes.Length); - put(bytes); + WriteUint32(bytes.Length); + Put(bytes); } - public void writeSequenceSet(RangeSet ranges) + public void WriteSequenceSet(RangeSet ranges) { if (ranges == null) { - writeUint16(0); + WriteUint16(0); } else { - writeUint16(ranges.size()*8); + WriteUint16(ranges.Size()*8); foreach (Range range in ranges) { - writeSequenceNo(range.Lower); - writeSequenceNo(range.Upper); + WriteSequenceNo(range.Lower); + WriteSequenceNo(range.Upper); } } } - public void writeByteRanges(RangeSet ranges) + public void WriteByteRanges(RangeSet ranges) { throw new Exception("not implemented"); } - public void writeUuid(UUID uuid) + public void WriteUuid(UUID uuid) { long msb = 0; long lsb = 0; @@ -230,53 +230,53 @@ namespace org.apache.qpid.transport.codec msb = uuid.MostSignificantBits; lsb = uuid.LeastSignificantBits; } - writeUint64(msb); - writeUint64(lsb); + WriteUint64(msb); + WriteUint64(lsb); } - public void writeStruct(int type, Struct s) + public void WriteStruct(int type, Struct s) { if (s == null) { - s = Struct.create(type); + s = Struct.Create(type); } - int width = s.getSizeWidth(); + int width = s.GetSizeWidth(); int pos = -1; if (width > 0) { - pos = beginSize(width); + pos = BeginSize(width); } if (type > 0) { - writeUint16(type); + WriteUint16(type); } - s.write(this); + s.Write(this); if (width > 0) { - endSize(width, pos); + EndSize(width, pos); } } - public void writeStruct32(Struct s) + public void WriteStruct32(Struct s) { if (s == null) { - writeUint32(0); + WriteUint32(0); } else { - int pos = beginSize32(); - writeUint16(s.getEncodedType()); - s.write(this); - endSize32(pos); + int pos = BeginSize32(); + WriteUint16(s.GetEncodedType()); + s.Write(this); + EndSize32(pos); } } - private Code encoding(Object value) + private Code Encoding(Object value) { if (value == null) { @@ -284,7 +284,7 @@ namespace org.apache.qpid.transport.codec } Type klass = value.GetType(); - Code type = resolve(klass); + Code type = Resolve(klass); if (type == Code.VOID) { @@ -297,7 +297,7 @@ namespace org.apache.qpid.transport.codec } } - private static Code resolve(Type klass) + private static Code Resolve(Type klass) { Code type; if(ENCODINGS.ContainsKey(klass)) @@ -308,7 +308,7 @@ namespace org.apache.qpid.transport.codec Type sup = klass.BaseType; if (sup != null) { - type = resolve(sup); + type = Resolve(sup); if (type != Code.VOID) { @@ -317,7 +317,7 @@ namespace org.apache.qpid.transport.codec } foreach (Type iface in klass.GetInterfaces()) { - type = resolve(iface); + type = Resolve(iface); if (type != Code.VOID) { return type; @@ -326,62 +326,62 @@ namespace org.apache.qpid.transport.codec return Code.VOID; } - public void writeMap(Dictionary map) + public void WriteMap(Dictionary map) { - int pos = beginSize32(); + int pos = BeginSize32(); if (map != null) { - writeUint32(map.Count); - writeMapEntries(map); + WriteUint32(map.Count); + WriteMapEntries(map); } - endSize32(pos); + EndSize32(pos); } - protected void writeMapEntries(Dictionary map) + protected void WriteMapEntries(Dictionary map) { foreach (KeyValuePair entry in map) { String key = entry.Key; Object value = entry.Value; - Code type = encoding(value); - writeStr8(key); - put((byte) type); - write(type, value); + Code type = Encoding(value); + WriteStr8(key); + Put((byte) type); + Write(type, value); } } - public void writeList(List list) + public void WriteList(List list) { - int pos = beginSize32(); + int pos = BeginSize32(); if (list != null) { - writeUint32(list.Count); - writeListEntries(list); + WriteUint32(list.Count); + WriteListEntries(list); } - endSize32(pos); + EndSize32(pos); } - protected void writeListEntries(List list) + protected void WriteListEntries(List list) { foreach (Object value in list) { - Code type = encoding(value); - put((byte) type); - write(type, value); + Code type = Encoding(value); + Put((byte) type); + Write(type, value); } } - public void writeArray(List array) + public void WriteArray(List array) { - int pos = beginSize32(); + int pos = BeginSize32(); if (array != null) { - writeArrayEntries(array); + WriteArrayEntries(array); } - endSize32(pos); + EndSize32(pos); } - protected void writeArrayEntries(List array) + protected void WriteArrayEntries(List array) { Code type; @@ -391,18 +391,18 @@ namespace org.apache.qpid.transport.codec } else { - type = encoding(array[0]); + type = Encoding(array[0]); } - put((byte) type); - writeUint32(array.Count); + Put((byte) type); + WriteUint32(array.Count); foreach (Object value in array) { - write(type, value); + Write(type, value); } } - private void writeSize(QpidType t, int size) + private void WriteSize(QpidType t, int size) { if (t.Fixed) { @@ -413,139 +413,139 @@ namespace org.apache.qpid.transport.codec } else { - writeSize(t.width, size); + WriteSize(t.width, size); } } - private void writeSize(int width, int size) + private void WriteSize(int width, int size) { // XXX: should check lengths switch (width) { case 1: - writeUint8((short) size); + WriteUint8((short) size); break; case 2: - writeUint16(size); + WriteUint16(size); break; case 4: - writeUint32(size); + WriteUint32(size); break; default: throw new Exception("illegal width: " + width); } } - private int beginSize(int width) + private int BeginSize(int width) { switch (width) { case 1: - return beginSize8(); + return BeginSize8(); case 2: - return beginSize16(); + return BeginSize16(); case 4: - return beginSize32(); + return BeginSize32(); default: throw new Exception("illegal width: " + width); } } - private void endSize(int width, int pos) + private void EndSize(int width, int pos) { switch (width) { case 1: - endSize8(pos); + EndSize8(pos); break; case 2: - endSize16(pos); + EndSize16(pos); break; case 4: - endSize32(pos); + EndSize32(pos); break; default: throw new Exception("illegal width: " + width); } } - private void writeBytes(QpidType t, byte[] bytes) + private void WriteBytes(QpidType t, byte[] bytes) { - writeSize(t, bytes.Length); - put(bytes); + WriteSize(t, bytes.Length); + Put(bytes); } - private void write(Code t, Object value) + private void Write(Code t, Object value) { switch (t) { case Code.BIN8: case Code.UINT8: - writeUint8((short) value); + WriteUint8((short) value); break; case Code.INT8: - put((Byte) value); + Put((Byte) value); break; case Code.CHAR: byte[] b = BitConverter.GetBytes((char) value); - put(b[0]); + Put(b[0]); break; case Code.BOOLEAN: if ((bool) value) { - put(1); + Put(1); } else { - put(0); + Put(0); } break; case Code.BIN16: case Code.UINT16: - writeUint16((int) value); + WriteUint16((int) value); break; case Code.INT16: - writeUint16((short) value); + WriteUint16((short) value); break; case Code.BIN32: case Code.UINT32: - writeUint32((long) value); + WriteUint32((long) value); break; case Code.CHAR_UTF32: case Code.INT32: - writeUint32((int) value); + WriteUint32((int) value); break; case Code.FLOAT: - writeUint32(BitConverter.DoubleToInt64Bits((float) value) >> 32); + WriteUint32(BitConverter.DoubleToInt64Bits((float) value) >> 32); break; case Code.BIN64: case Code.UINT64: case Code.INT64: case Code.DATETIME: - writeUint64((long) value); + WriteUint64((long) value); break; case Code.DOUBLE: - writeUint64( BitConverter.DoubleToInt64Bits((double) value)); + WriteUint64( BitConverter.DoubleToInt64Bits((double) value)); break; case Code.UUID: - writeUuid((UUID) value); + WriteUuid((UUID) value); break; case Code.STR8: - writeStr8((string) value); + WriteStr8((string) value); break; case Code.STR16: - writeStr16((string) value); + WriteStr16((string) value); break; case Code.STR8_LATIN: @@ -553,20 +553,20 @@ namespace org.apache.qpid.transport.codec case Code.STR16_LATIN: case Code.STR16_UTF16: // XXX: need to do character conversion - writeBytes(QpidType.get((byte) t), encode((string) value, Encoding.Unicode)); + WriteBytes(QpidType.get((byte) t), Encode((string) value, System.Text.Encoding.Unicode)); break; case Code.MAP: - writeMap((Dictionary) value); + WriteMap((Dictionary) value); break; case Code.LIST: - writeList((List) value); + WriteList((List) value); break; case Code.ARRAY: - writeList((List) value); + WriteList((List) value); break; case Code.STRUCT32: - writeStruct32((Struct) value); + WriteStruct32((Struct) value); break; case Code.BIN40: @@ -574,14 +574,14 @@ namespace org.apache.qpid.transport.codec case Code.BIN72: case Code.DEC64: // XXX: what types are we supposed to use here? - writeBytes(QpidType.get((byte) t), (byte[]) value); + WriteBytes(QpidType.get((byte) t), (byte[]) value); break; case Code.VOID: break; default: - writeBytes(QpidType.get((byte) t), (byte[]) value); + WriteBytes(QpidType.get((byte) t), (byte[]) value); break; } } diff --git a/qpid/dotnet/client-010/client/transport/codec/IDecoder.cs b/qpid/dotnet/client-010/client/transport/codec/IDecoder.cs new file mode 100644 index 0000000000..7de2e93fe7 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/IDecoder.cs @@ -0,0 +1,72 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +using System; +using System.Collections.Generic; +using org.apache.qpid.transport.util; + +namespace org.apache.qpid.transport.codec +{ + /// + /// Decoder + /// + + public interface IDecoder + { + + 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 ReadMap(); + List ReadList(); + List ReadArray(); + + Struct ReadStruct(int type); + } + +} diff --git a/qpid/dotnet/client-010/client/transport/codec/IEncodable.cs b/qpid/dotnet/client-010/client/transport/codec/IEncodable.cs new file mode 100644 index 0000000000..5c63e17fdd --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/IEncodable.cs @@ -0,0 +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 +{ + + + /// + /// Encodable + /// + + public interface IEncodable + { + + void Write(IEncoder enc); + + void Read(IDecoder dec); + } +} diff --git a/qpid/dotnet/client-010/client/transport/codec/IEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/IEncoder.cs new file mode 100644 index 0000000000..4ffc852052 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/codec/IEncoder.cs @@ -0,0 +1,70 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ + +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 +{ + /// + /// Encoder + /// + + public interface IEncoder + { + + 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 map); + void WriteList(List list); + void WriteArray(List 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 75f982bdb1..59731b739a 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSDecoder.cs @@ -34,77 +34,77 @@ namespace org.apache.qpid.transport.codec /// - public sealed class MSDecoder:AbstractDecoder + public sealed class MSDecoder : AbstractDecoder { - private BinaryReader reader; + private BinaryReader _reader; - public void init(MemoryStream st) + public void Init(MemoryStream st) { - reader = new BinaryReader(st, Encoding.BigEndianUnicode); + _reader = new BinaryReader(st, Encoding.BigEndianUnicode); } - protected override byte doGet() + protected override byte DoGet() { - return reader.ReadByte(); + return _reader.ReadByte(); } - protected override void doGet(byte[] bytes) + protected override void DoGet(byte[] bytes) { - reader.Read(bytes, 0, bytes.Length); + _reader.Read(bytes, 0, bytes.Length); } - public override bool hasRemaining() + public override bool HasRemaining() { - return (reader.BaseStream.Position < reader.BaseStream.Length); + return (_reader.BaseStream.Position < _reader.BaseStream.Length); } - public override short readUint8() + public override short ReadUint8() { - return (short) (0xFF & reader.ReadByte()); + return (short) (0xFF & _reader.ReadByte()); } - public override int readUint16() + public override int ReadUint16() { - return ByteEncoder.GetBigEndian((UInt16) reader.ReadInt16()); + return ByteEncoder.GetBigEndian((UInt16) _reader.ReadInt16()); } - public override long readUint32() + public override long ReadUint32() { - return ByteEncoder.GetBigEndian((UInt32) reader.ReadInt32()); + return ByteEncoder.GetBigEndian((UInt32) _reader.ReadInt32()); } - public override long readUint64() + public override long ReadUint64() { - return (long) ByteEncoder.GetBigEndian(reader.ReadInt64()); + return (long) ByteEncoder.GetBigEndian(_reader.ReadInt64()); } - public override short readInt8() + public override short ReadInt8() { - return (short) (0xFF & reader.ReadByte()); + return (short) (0xFF & _reader.ReadByte()); } - public override int readInt16() + public override int ReadInt16() { - return ByteEncoder.GetBigEndian((Int16) reader.ReadInt16()); + return ByteEncoder.GetBigEndian((Int16) _reader.ReadInt16()); } - public override long readInt32() + public override long ReadInt32() { - return ByteEncoder.GetBigEndian((Int32) reader.ReadInt32()); + return ByteEncoder.GetBigEndian((Int32) _reader.ReadInt32()); } - public override long readInt64() + public override long ReadInt64() { - return (long) ByteEncoder.GetBigEndian(reader.ReadInt64()); + return (long) ByteEncoder.GetBigEndian(_reader.ReadInt64()); } - public override double readDouble() { - return (double) ByteEncoder.GetBigEndian(reader.ReadDouble()) ; + public override double ReadDouble() { + return (double) ByteEncoder.GetBigEndian(_reader.ReadDouble()) ; } - public override float readFloat() { - return (float) reader.ReadSingle() ; + 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 5660ffb53c..d863c57dee 100644 --- a/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/MSEncoder.cs @@ -40,12 +40,12 @@ namespace org.apache.qpid.transport.codec _writer = new BinaryWriter(_out); } - public void init() + public void Init() { _out.Seek(0, SeekOrigin.Begin); } - public MemoryStream segment() + public MemoryStream Segment() { int length = (int) _out.Position; MemoryStream result = new MemoryStream(_out.ToArray(), 0, length); @@ -55,83 +55,83 @@ namespace org.apache.qpid.transport.codec } - protected override void doPut(byte b) + protected override void DoPut(byte b) { _writer.Write(b); } - protected override void doPut(MemoryStream src) + protected override void DoPut(MemoryStream src) { _writer.Write(src.ToArray()); } - protected override void put(byte[] bytes) + protected override void Put(byte[] bytes) { _writer.Write(bytes); } - public override void writeUint8(short b) + public override void WriteUint8(short b) { Debug.Assert(b < 0x100); _writer.Write((byte) b); } - public override void writeUint16(int s) + public override void WriteUint16(int s) { Debug.Assert(s < 0x10000); _writer.Write(ByteEncoder.GetBigEndian((UInt16) s)); } - public override void writeUint32(long i) + public override void WriteUint32(long i) { Debug.Assert(i < 0x100000000L); _writer.Write(ByteEncoder.GetBigEndian((UInt32) i)); } - public override void writeUint64(long l) + public override void WriteUint64(long l) { _writer.Write(ByteEncoder.GetBigEndian(l)); } - public override void writeInt8(short b) + public override void WriteInt8(short b) { Debug.Assert(b < 0x100); _writer.Write((byte) b); } - public override void writeInt16(int s) + public override void WriteInt16(int s) { Debug.Assert(s < 0x10000); _writer.Write(ByteEncoder.GetBigEndian((Int16) s)); } - public override void writeInt32(long i) + public override void WriteInt32(long i) { Debug.Assert(i < 0x100000000L); _writer.Write(ByteEncoder.GetBigEndian((Int32) i)); } - public override void writeInt64(long l) + public override void WriteInt64(long l) { _writer.Write(ByteEncoder.GetBigEndian(l)); } - public override void writeFloat(float f) { + public override void WriteFloat(float f) { _writer.Write(f) ; } - public override void writeDouble(double d) { + public override void WriteDouble(double d) { _writer.Write(ByteEncoder.GetBigEndian(d)) ; } - protected override int beginSize8() + protected override int BeginSize8() { int pos = (int) _out.Position; _writer.Write((byte) 0); return pos; } - protected override void endSize8(int pos) + protected override void EndSize8(int pos) { int cur = (int) _out.Position; _out.Seek(pos, SeekOrigin.Begin); @@ -139,14 +139,14 @@ namespace org.apache.qpid.transport.codec _out.Seek(cur, SeekOrigin.Begin); } - protected override int beginSize16() + protected override int BeginSize16() { int pos = (int) _out.Position; _writer.Write((short) 0); return pos; } - protected override void endSize16(int pos) + protected override void EndSize16(int pos) { int cur = (int) _out.Position; _out.Seek(pos, SeekOrigin.Begin); @@ -154,14 +154,14 @@ namespace org.apache.qpid.transport.codec _out.Seek(cur, SeekOrigin.Begin); } - protected override int beginSize32() + protected override int BeginSize32() { int pos = (int) _out.Position; _writer.Write(0); return pos; } - protected override void endSize32(int pos) + protected override void EndSize32(int pos) { int cur = (int) _out.Position; _out.Seek(pos, 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 59289fe811..cbf5e39e52 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ConnectionException.cs @@ -41,9 +41,9 @@ namespace org.apache.qpid.transport private ConnectionClose _close; - public ConnectionException(ConnectionClose close):base(close.getReplyText()) + 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 1d2578fb88..01793a6ad0 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ExceptionArgs.cs @@ -27,14 +27,14 @@ namespace org.apache.qpid.transport { public ExceptionArgs(Exception e) { - m_exception = e; + _exception = e; } - private Exception m_exception; + private Exception _exception; public Exception Exception { - get { return m_exception; } - set { m_exception = value; } + get { return _exception; } + set { _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 4a0bd8e9ce..f18fc1173f 100644 --- a/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs +++ b/qpid/dotnet/client-010/client/transport/exception/ProtocolVersionException.cs @@ -34,7 +34,7 @@ namespace org.apache.qpid.transport { get { - return this.major; + return _major; } } @@ -42,18 +42,18 @@ namespace org.apache.qpid.transport { get { - return this.minor; + return _minor; } } - private sbyte major; - private sbyte 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; + this._major = major; + this._minor = minor; } } -} \ 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 eb280df877..ac8f48567f 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -30,22 +30,22 @@ namespace org.apache.qpid.transport.network /// /// Assembler /// - public delegate void Processor(NetworkDelegate ndelegate); + public delegate void Processor(INetworkDelegate ndelegate); - public class Assembler : NetworkDelegate, Receiver> + public class Assembler : INetworkDelegate, IReceiver> { - private static readonly Logger log = Logger.get(typeof (Assembler)); + private static readonly Logger log = Logger.Get(typeof (Assembler)); private readonly Dictionary> 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> ReceivedEvent; + public event EventHandler> ReceivedEvent; public event EventHandler ExceptionProcessing; public event EventHandler HandlerClosed; - event EventHandler> Receiver>.Received + event EventHandler> IReceiver>.Received { add { @@ -63,7 +63,7 @@ namespace org.apache.qpid.transport.network } } - event EventHandler Receiver>.Exception + event EventHandler IReceiver>.Exception { add { @@ -81,7 +81,7 @@ namespace org.apache.qpid.transport.network } } - event EventHandler Receiver>.Closed + event EventHandler IReceiver>.Closed { add { @@ -106,12 +106,12 @@ namespace org.apache.qpid.transport.network } // Invoked when a network event is received - public void On_ReceivedEvent(object sender, ReceivedPayload payload) + public void On_ReceivedEvent(object sender, ReceivedPayload payload) { payload.Payload.ProcessNetworkEvent(this); } - #region Interface NetworkDelegate + #region Interface INetworkDelegate public void Init(ProtocolHeader header) { @@ -126,41 +126,41 @@ namespace org.apache.qpid.transport.network public void Frame(Frame frame) { MemoryStream segment; - if (frame.isFirstFrame() && frame.isLastFrame()) + 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)); + Assemble(frame, new MemoryStream(tmp)); } else { List frames; - if (frame.isFirstFrame()) + if (frame.IsFirstFrame()) { frames = new List(); - setSegment(frame, frames); + SetSegment(frame, frames); } else { - frames = getSegment(frame); + frames = GetSegment(frame); } byte[] tmp = new byte[frame.BodySize]; frame.Body.Read(tmp, 0, tmp.Length); frames.Add(tmp); - if (frame.isLastFrame()) + if (frame.IsLastFrame()) { - clearSegment(frame); + ClearSegment(frame); segment = new MemoryStream(); BinaryWriter w = new BinaryWriter(segment); foreach (byte[] f in frames) { w.Write(f); } - assemble(frame, segment); + Assemble(frame, segment); } } } @@ -170,7 +170,7 @@ namespace org.apache.qpid.transport.network #region Private Support Functions - private MSDecoder getDecoder() + private MSDecoder GetDecoder() { if( _decoder == null ) { @@ -179,27 +179,27 @@ namespace org.apache.qpid.transport.network return _decoder; } - private void assemble(Frame frame, MemoryStream segment) + private void Assemble(Frame frame, MemoryStream segment) { - MSDecoder decoder = getDecoder(); - decoder.init(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); + int controlType = decoder.ReadUint16(); + Method control = Method.Create(controlType); + control.Read(decoder); Emit(channel, control); break; case SegmentType.COMMAND: - int commandType = decoder.readUint16(); + 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()) + decoder.ReadUint16(); + command = Method.Create(commandType); + command.Read(decoder); + if (command.HasPayload()) { incomplete[channel] = command; } @@ -211,12 +211,12 @@ namespace org.apache.qpid.transport.network case SegmentType.HEADER: command = incomplete[channel]; List structs = new List(); - while (decoder.hasRemaining()) + while (decoder.HasRemaining()) { - structs.Add(decoder.readStruct32()); + structs.Add(decoder.ReadStruct32()); } command.Header = new Header(structs); - if (frame.isLastSegment()) + if (frame.IsLastSegment()) { incomplete[channel] = null; Emit(channel, command); @@ -234,38 +234,38 @@ namespace org.apache.qpid.transport.network } } - private int segmentKey(Frame frame) + private int SegmentKey(Frame frame) { return (frame.Track + 1)*frame.Channel; } - private List getSegment(Frame frame) + private List GetSegment(Frame frame) { - return segments[segmentKey(frame)]; + return segments[SegmentKey(frame)]; } - private void setSegment(Frame frame, List segment) + private void SetSegment(Frame frame, List segment) { - int key = segmentKey(frame); + int key = SegmentKey(frame); if (segments.ContainsKey(key)) { Error(new ProtocolError(network.Frame.L2, "segment in progress: %s", frame)); } - segments.Add(segmentKey(frame), segment); + segments.Add(SegmentKey(frame), segment); } - private void clearSegment(Frame frame) + private void ClearSegment(Frame frame) { - segments.Remove(segmentKey(frame)); + segments.Remove(SegmentKey(frame)); } // Emit a protocol event - private void Emit(int channel, ProtocolEvent protevent) + private void Emit(int channel, IProtocolEvent protevent) { protevent.Channel = channel; - log.debug("Assembler: protocol event:", protevent); - ReceivedPayload payload = new ReceivedPayload(); + log.Debug("Assembler: protocol event:", protevent); + ReceivedPayload payload = new ReceivedPayload(); payload.Payload = protevent; if (ReceivedEvent != null) { @@ -273,10 +273,10 @@ namespace org.apache.qpid.transport.network } else { - log.debug("No listener for event: {0}", protevent); + 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 2d01656942..3f0a6a8974 100644 --- a/qpid/dotnet/client-010/client/transport/network/Disassembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Disassembler.cs @@ -28,9 +28,9 @@ namespace org.apache.qpid.transport.network /// /// Disassembler /// - public sealed class Disassembler : Sender, ProtocolDelegate + public sealed class Disassembler : ISender, IProtocolDelegate { - private readonly IIOSender _sender; + private readonly IIoSender _sender; private readonly int _maxPayload; private readonly MemoryStream _header; private readonly BinaryWriter _writer; @@ -38,38 +38,38 @@ namespace org.apache.qpid.transport.network [ThreadStatic] static MSEncoder _encoder; - public Disassembler(IIOSender sender, int maxFrame) + public Disassembler(IIoSender sender, int maxFrame) { - if (maxFrame <= Frame.HEADER_SIZE || maxFrame >= 64*1024) + if (maxFrame <= network.Frame.HEADER_SIZE || maxFrame >= 64*1024) { - throw new Exception(String.Format("maxFrame must be > {0} and < 64K: ", Frame.HEADER_SIZE) + maxFrame); + throw new Exception(String.Format("maxFrame must be > {0} and < 64K: ", network.Frame.HEADER_SIZE) + maxFrame); } _sender = sender; - _maxPayload = maxFrame - Frame.HEADER_SIZE; - _header = new MemoryStream(Frame.HEADER_SIZE); + _maxPayload = maxFrame - network.Frame.HEADER_SIZE; + _header = new MemoryStream(network.Frame.HEADER_SIZE); _writer = new BinaryWriter(_header); } #region Sender Interface - public void send(ProtocolEvent pevent) + public void Send(IProtocolEvent pevent) { pevent.ProcessProtocolEvent(null, this); } - public void flush() + public void Flush() { lock (_sendlock) { - _sender.flush(); + _sender.Flush(); } } - public void close() + public void Close() { lock (_sendlock) { - _sender.close(); + _sender.Close(); } } @@ -81,19 +81,19 @@ namespace org.apache.qpid.transport.network { lock (_sendlock) { - _sender.send(header.ToMemoryStream()); - _sender.flush(); + _sender.Send(header.ToMemoryStream()); + _sender.Flush(); } } public void Control(Object v, Method method) { - invokeMethod(method, SegmentType.CONTROL); + InvokeMethod(method, SegmentType.CONTROL); } public void Command(Object v, Method method) { - invokeMethod(method, SegmentType.COMMAND); + InvokeMethod(method, SegmentType.COMMAND); } public void Error(Object v, ProtocolError error) @@ -105,13 +105,13 @@ namespace org.apache.qpid.transport.network #region private - private void frame(byte flags, byte type, byte track, int channel, int size, MemoryStream buf) + 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(ByteEncoder.GetBigEndian((UInt16)(size + network.Frame.HEADER_SIZE))); _writer.Write((byte)0); _writer.Write(track); _writer.Write(ByteEncoder.GetBigEndian((UInt16)( channel))); @@ -119,16 +119,16 @@ namespace org.apache.qpid.transport.network _writer.Write((byte)0); _writer.Write((byte)0); _writer.Write((byte)0); - _sender.send(_header); + _sender.Send(_header); _header.Seek(0, SeekOrigin.Begin); - _sender.send(buf, size); + _sender.Send(buf, size); } } - private void fragment(byte flags, SegmentType type, ProtocolEvent mevent, MemoryStream buf) + private void Fragment(byte flags, SegmentType type, IProtocolEvent mevent, MemoryStream buf) { byte typeb = (byte) type; - byte track = mevent.EncodedTrack == Frame.L4 ? (byte) 1 : (byte) 0; + byte track = mevent.EncodedTrack == network.Frame.L4 ? (byte) 1 : (byte) 0; int remaining = (int) buf.Length; buf.Seek(0, SeekOrigin.Begin); bool first = true; @@ -140,15 +140,15 @@ namespace org.apache.qpid.transport.network byte newflags = flags; if (first) { - newflags |= Frame.FIRST_FRAME; + newflags |= network.Frame.FIRST_FRAME; first = false; } if (remaining == 0) { - newflags |= Frame.LAST_FRAME; + newflags |= network.Frame.LAST_FRAME; } - frame(newflags, typeb, track, mevent.Channel, size, buf); + Frame(newflags, typeb, track, mevent.Channel, size, buf); if (remaining == 0) { @@ -157,7 +157,7 @@ namespace org.apache.qpid.transport.network } } - private MSEncoder getEncoder() + private MSEncoder GetEncoder() { if( _encoder == null) { @@ -166,31 +166,31 @@ namespace org.apache.qpid.transport.network return _encoder; } - private void invokeMethod(Method method, SegmentType type) + private void InvokeMethod(Method method, SegmentType type) { - MSEncoder encoder = getEncoder(); - encoder.init(); - encoder.writeUint16(method.getEncodedType()); + MSEncoder encoder = GetEncoder(); + encoder.Init(); + encoder.WriteUint16(method.GetEncodedType()); if (type == SegmentType.COMMAND) { if (method.Sync) { - encoder.writeUint16(0x0101); + encoder.WriteUint16(0x0101); } else { - encoder.writeUint16(0x0100); + encoder.WriteUint16(0x0100); } } - method.write(_encoder); - MemoryStream methodSeg = encoder.segment(); + method.Write(_encoder); + MemoryStream methodSeg = encoder.Segment(); - byte flags = Frame.FIRST_SEG; + byte flags = network.Frame.FIRST_SEG; - bool payload = method.hasPayload(); + bool payload = method.HasPayload(); if (!payload) { - flags |= Frame.LAST_SEG; + flags |= network.Frame.LAST_SEG; } MemoryStream headerSeg = null; @@ -201,22 +201,22 @@ namespace org.apache.qpid.transport.network foreach (Struct st in structs) { - encoder.writeStruct32(st); + encoder.WriteStruct32(st); } - headerSeg = encoder.segment(); + headerSeg = encoder.Segment(); } lock (_sendlock) { - fragment(flags, type, method, methodSeg); + Fragment(flags, type, method, methodSeg); if (payload) { - fragment( 0x0, SegmentType.HEADER, method, headerSeg); - fragment(Frame.LAST_SEG, SegmentType.BODY, method, method.Body); + Fragment( 0x0, SegmentType.HEADER, method, headerSeg); + Fragment(network.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 ba7ee475a0..b8ec36d8b6 100644 --- a/qpid/dotnet/client-010/client/transport/network/Frame.cs +++ b/qpid/dotnet/client-010/client/transport/network/Frame.cs @@ -23,7 +23,7 @@ using System.IO; namespace org.apache.qpid.transport.network { - public sealed class Frame : NetworkEvent + public sealed class Frame : INetworkEvent { internal static int HEADER_SIZE = 12; @@ -96,48 +96,48 @@ namespace org.apache.qpid.transport.network get { return track; } } - private bool flag(byte mask) + private bool Flag(byte mask) { return (flags & mask) != 0; } - public bool isFirstSegment() + public bool IsFirstSegment() { - return flag(FIRST_SEG); + return Flag(FIRST_SEG); } - public bool isLastSegment() + public bool IsLastSegment() { - return flag(LAST_SEG); + return Flag(LAST_SEG); } - public bool isFirstFrame() + public bool IsFirstFrame() { - return flag(FIRST_FRAME); + return Flag(FIRST_FRAME); } - public bool isLastFrame() + public bool IsLastFrame() { - return flag(LAST_FRAME); + return Flag(LAST_FRAME); } - #region NetworkEvent Methods + #region INetworkEvent Methods - public void ProcessNetworkEvent(NetworkDelegate ndelegate) + public void ProcessNetworkEvent(INetworkDelegate ndelegate) { ndelegate.Frame(this); } #endregion - public String toString() + public override 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); + 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/INetworkDelegate.cs b/qpid/dotnet/client-010/client/transport/network/INetworkDelegate.cs new file mode 100644 index 0000000000..9226adc2b7 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/INetworkDelegate.cs @@ -0,0 +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 +{ + + + /// + /// NetworkDelegate + /// + + public interface INetworkDelegate + { + + void Init(ProtocolHeader header); + + void Frame(Frame frame); + + void Error(ProtocolError error); + } +} diff --git a/qpid/dotnet/client-010/client/transport/network/INetworkEvent.cs b/qpid/dotnet/client-010/client/transport/network/INetworkEvent.cs new file mode 100644 index 0000000000..e6f0d6fc8a --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/INetworkEvent.cs @@ -0,0 +1,32 @@ +/* +* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +namespace org.apache.qpid.transport.network +{ + + /// + /// INetworkEvent + /// + + public interface INetworkEvent + { + void ProcessNetworkEvent(INetworkDelegate networkDelegate); + } +} diff --git a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs index 8bd13c74a9..1872b9a111 100644 --- a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs +++ b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs @@ -28,7 +28,7 @@ namespace org.apache.qpid.transport.network /// /// InputHandler /// - public sealed class InputHandler : Receiver> + public sealed class InputHandler : IReceiver> { public enum State { @@ -38,15 +38,15 @@ namespace org.apache.qpid.transport.network ERROR } - private static readonly Logger log = Logger.get(typeof(InputHandler)); + 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> ReceivedEvent; + public event EventHandler> ReceivedEvent; public event EventHandler ExceptionProcessing; public event EventHandler HandlerClosed; - event EventHandler> Receiver>.Received + event EventHandler> IReceiver>.Received { add { @@ -64,7 +64,7 @@ namespace org.apache.qpid.transport.network } } - event EventHandler Receiver>.Exception + event EventHandler IReceiver>.Exception { add { @@ -82,7 +82,7 @@ namespace org.apache.qpid.transport.network } } - event EventHandler Receiver>.Closed + event EventHandler IReceiver>.Closed { add { @@ -148,7 +148,7 @@ namespace org.apache.qpid.transport.network } int startPos = (int)buf.Position; int consumed = needed; - state = next(buf); + state = Next(buf); if ((buf.Position - startPos) < consumed) { buf.Seek(consumed - (buf.Position - startPos), SeekOrigin.Current); @@ -187,7 +187,7 @@ namespace org.apache.qpid.transport.network #region Private Support Functions - private State next(MemoryStream buf) + private State Next(MemoryStream buf) { BinaryReader reader = new BinaryReader(buf); @@ -216,7 +216,7 @@ namespace org.apache.qpid.transport.network case State.FRAME_HDR: reader = new BinaryReader(buf, Encoding.BigEndianUnicode); flags = reader.ReadByte(); - type = SegmentTypeGetter.get(reader.ReadByte()); // generated code + type = SegmentTypeGetter.Get(reader.ReadByte()); // generated code int size = reader.ReadUInt16(); size = ByteEncoder.GetBigEndian((UInt16)size); size -= Frame.HEADER_SIZE; @@ -262,10 +262,10 @@ namespace org.apache.qpid.transport.network Fire_NetworkEvent(new ProtocolError(Frame.L1, fmt, args)); } - private void Fire_NetworkEvent(NetworkEvent netevent) + private void Fire_NetworkEvent(INetworkEvent netevent) { - log.debug("InputHandler: network event:", netevent); - ReceivedPayload payload = new ReceivedPayload(); + log.Debug("InputHandler: network event:", netevent); + ReceivedPayload payload = new ReceivedPayload(); payload.Payload = netevent; if (ReceivedEvent != null) { @@ -273,10 +273,10 @@ namespace org.apache.qpid.transport.network } else { - log.debug("Nobody listening for event: {0}"); + log.Debug("Nobody listening for event: {0}"); } } #endregion } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/network/io/IIoSender.cs b/qpid/dotnet/client-010/client/transport/network/io/IIoSender.cs new file mode 100644 index 0000000000..acc7724a06 --- /dev/null +++ b/qpid/dotnet/client-010/client/transport/network/io/IIoSender.cs @@ -0,0 +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:ISender + { + void Send(T body, int siz); + } +} 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 a409b6de4c..41a09e7079 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IIoTransport.cs @@ -29,7 +29,7 @@ namespace org.apache.qpid.transport.network.io set; } - Receiver> Receiver + IReceiver> Receiver { 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 1cfba9e928..97f8a7d3cd 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -29,9 +29,9 @@ namespace org.apache.qpid.transport.network.io /// /// IoReceiver /// - public sealed class IoReceiver : Receiver> + public sealed class IoReceiver : IReceiver> { - private static readonly Logger log = Logger.get(typeof(IoReceiver)); + private static readonly Logger log = Logger.Get(typeof(IoReceiver)); private readonly int m_bufferSize; private readonly Stream m_bufStream; private readonly int m_timeout; @@ -44,7 +44,7 @@ namespace org.apache.qpid.transport.network.io event EventHandler ExceptionReading; event EventHandler ReceiverClosed; - event EventHandler> Receiver>.Received + event EventHandler> IReceiver>.Received { add { @@ -62,7 +62,7 @@ namespace org.apache.qpid.transport.network.io } } - event EventHandler Receiver>.Exception + event EventHandler IReceiver>.Exception { add { @@ -80,7 +80,7 @@ namespace org.apache.qpid.transport.network.io } } - event EventHandler Receiver>.Closed + event EventHandler IReceiver>.Closed { add { @@ -109,7 +109,7 @@ namespace org.apache.qpid.transport.network.io m_thread.Start(); } - public void close() + public void Close() { Mutex mut = new Mutex(); mut.WaitOne(); @@ -118,7 +118,7 @@ namespace org.apache.qpid.transport.network.io m_closed = true; try { - log.debug("Receiver closing"); + log.Debug("Receiver closing"); m_bufStream.Close(); m_thread.Join(m_timeout); if (m_thread.IsAlive) @@ -164,11 +164,11 @@ namespace org.apache.qpid.transport.network.io buffer = new byte[m_bufferSize]; } } - log.debug("Receiver thread terminating"); + log.Debug("Receiver thread terminating"); } - catch (IOException e) + catch (IOException) { - // IOException is thrown when the socket is closed according to the docs + // IOException is thrown when the socket is Closed according to the docs } catch (Exception t) { @@ -186,4 +186,4 @@ namespace org.apache.qpid.transport.network.io } } } -} \ 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 ad12e24ac6..82b42f2bfe 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs @@ -33,15 +33,15 @@ namespace org.apache.qpid.transport.network.io private const int TIMEOUT = 60000; private const int QUEUE_SIZE = 1000; // props - private static readonly Logger log = Logger.get(typeof (IoSSLTransport)); + private static readonly Logger log = Logger.Get(typeof (IoSSLTransport)); private Stream m_stream; private IoSender m_sender; - private Receiver> m_receiver; + private IReceiver> 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) + 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; @@ -50,7 +50,7 @@ namespace org.apache.qpid.transport.network.io public IoSSLTransport(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel) { _rejectUntrusted = rejectUntrusted; - createSocket(host, port, serverName, certPath); + CreateSocket(host, port, serverName, certPath); Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT); Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize*2, TIMEOUT); Assembler assembler = new Assembler(); @@ -76,7 +76,7 @@ namespace org.apache.qpid.transport.network.io set { m_con = value; } } - public Receiver> Receiver + public IReceiver> Receiver { get { return m_receiver; } set { m_receiver = value; } @@ -103,7 +103,7 @@ namespace org.apache.qpid.transport.network.io #region Private Support Functions - private void createSocket(String host, int port, string serverName, string certPath) + private void CreateSocket(String host, int port, string serverName, string certPath) { TcpClient socket; try @@ -120,10 +120,10 @@ namespace org.apache.qpid.transport.network.io ? 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); + 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; @@ -151,10 +151,10 @@ namespace org.apache.qpid.transport.network.io } catch (AuthenticationException e) { - log.warn("Exception: {0}", e.Message); + log.Warn("Exception: {0}", e.Message); if (e.InnerException != null) { - log.warn("Inner exception: {0}", e.InnerException.Message); + log.Warn("Inner exception: {0}", e.InnerException.Message); } socket.Close(); throw new TransportException("Authentication failed - closing the connection."); @@ -171,7 +171,7 @@ namespace org.apache.qpid.transport.network.io bool result = true; if (sslPolicyErrors != SslPolicyErrors.None && _rejectUntrusted ) { - log.warn("Certificate error: {0}", sslPolicyErrors); + log.Warn("Certificate error: {0}", sslPolicyErrors); // Do not allow this client to communicate with unauthenticated servers. result = false; } 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 4ae74bf787..4491d2e98b 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -24,9 +24,9 @@ using org.apache.qpid.transport.util; namespace org.apache.qpid.transport.network.io { - public sealed class IoSender : IIOSender + public sealed class IoSender : IIoSender { - private static readonly Logger log = Logger.get(typeof (IoReceiver)); + private static readonly Logger log = Logger.Get(typeof (IoReceiver)); private readonly Stream bufStream; private bool closed; private readonly Mutex mutClosed = new Mutex(); @@ -40,25 +40,25 @@ namespace org.apache.qpid.transport.network.io bufStream = transport.Stream; queue = new CircularBuffer(queueSize); thread = new Thread(Go); - log.debug("Creating IoSender thread"); + log.Debug("Creating IoSender thread"); thread.Name = String.Format("IoSender - {0}", transport.Socket) ; thread.IsBackground = true; thread.Start(); } - public void send(MemoryStream str) + public void Send(MemoryStream str) { int pos = (int) str.Position; str.Seek(0, SeekOrigin.Begin); - send(str, pos); + Send(str, pos); } - public void send(MemoryStream str, int size) + public void Send(MemoryStream str, int size) { mutClosed.WaitOne(); if (closed) { - throw new TransportException("sender is closed"); + throw new TransportException("sender is Closed"); } mutClosed.ReleaseMutex(); byte[] buf = new byte[size]; @@ -66,7 +66,7 @@ namespace org.apache.qpid.transport.network.io _tobeSent.Write(buf, 0, size); } - public void flush() + public void Flush() { int length = (int)_tobeSent.Position; byte[] buf = new byte[length]; @@ -80,16 +80,16 @@ namespace org.apache.qpid.transport.network.io _tobeSent.Seek(0, SeekOrigin.Begin); } - public void close() + public void Close() { - log.debug("Closing Sender"); + log.Debug("Closing Sender"); mutClosed.WaitOne(); if (!closed) { try { closed = true; - queue.close(); + queue.Close(); thread.Join(timeout); if (thread.IsAlive) { @@ -131,4 +131,4 @@ namespace org.apache.qpid.transport.network.io } } } -} \ 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 8e48ea33fd..af754ea57f 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs @@ -38,14 +38,14 @@ namespace org.apache.qpid.transport.network.io private const int TIMEOUT = 60000; private const int QUEUE_SIZE = 1000; // props - private static readonly Logger log = Logger.get(typeof (IoTransport)); + private static readonly Logger log = Logger.Get(typeof (IoTransport)); private Stream m_stream; private IoSender m_sender; - private Receiver> m_receiver; + private IReceiver> m_receiver; private TcpClient m_socket; private Connection m_con; - public static Connection connect(String host, int port, ConnectionDelegate conndel) + public static Connection Connect(String host, int port, ConnectionDelegate conndel) { IoTransport transport = new IoTransport(host, port, conndel); return transport.Connection; @@ -53,7 +53,7 @@ namespace org.apache.qpid.transport.network.io public IoTransport(String host, int port, ConnectionDelegate conndel) { - createSocket(host, port); + CreateSocket(host, port); Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT); Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize * 2, TIMEOUT); Assembler assembler = new Assembler(); @@ -79,7 +79,7 @@ namespace org.apache.qpid.transport.network.io set { m_con = value; } } - public Receiver> Receiver + public IReceiver> Receiver { get { return m_receiver; } set { m_receiver = value; } @@ -106,7 +106,7 @@ namespace org.apache.qpid.transport.network.io #region Private Support Functions - private void createSocket(String host, int port) + private void CreateSocket(String host, int port) { try { @@ -118,10 +118,10 @@ namespace org.apache.qpid.transport.network.io 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); + 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; @@ -140,4 +140,4 @@ namespace org.apache.qpid.transport.network.io #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 66d40d554a..873ca75688 100644 --- a/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/util/ByteEncoder.cs @@ -34,7 +34,7 @@ namespace org.apache.qpid.transport.util { if (BitConverter.IsLittleEndian) { - return swapByteOrder(value); + return SwapByteOrder(value); } return value; } @@ -48,7 +48,7 @@ namespace org.apache.qpid.transport.util { if (BitConverter.IsLittleEndian) { - return swapByteOrder(value); + return SwapByteOrder(value); } return value; } @@ -62,7 +62,7 @@ namespace org.apache.qpid.transport.util { if (BitConverter.IsLittleEndian) { - return swapByteOrder(value); + return SwapByteOrder(value); } return value; } @@ -76,7 +76,7 @@ namespace org.apache.qpid.transport.util { if (BitConverter.IsLittleEndian) { - return swapByteOrder(value); + return SwapByteOrder(value); } return value; } @@ -85,7 +85,7 @@ namespace org.apache.qpid.transport.util { if (BitConverter.IsLittleEndian) { - return swapByteOrder(value); + return SwapByteOrder(value); } return value; } @@ -101,7 +101,7 @@ namespace org.apache.qpid.transport.util { return value; } - return swapByteOrder(value); + return SwapByteOrder(value); } /// @@ -115,7 +115,7 @@ namespace org.apache.qpid.transport.util { return value; } - return swapByteOrder(value); + return SwapByteOrder(value); } /// @@ -129,7 +129,7 @@ namespace org.apache.qpid.transport.util { return value; } - return swapByteOrder(value); + return SwapByteOrder(value); } /// @@ -143,7 +143,7 @@ namespace org.apache.qpid.transport.util { return value; } - return swapByteOrder(value); + return SwapByteOrder(value); } public static double GetLittleEndian(double value) @@ -152,7 +152,7 @@ namespace org.apache.qpid.transport.util { return value; } - return swapByteOrder(value); + return SwapByteOrder(value); } /// @@ -160,7 +160,7 @@ namespace org.apache.qpid.transport.util /// /// to swap the bytes of. /// Byte order swapped . - private static Int32 swapByteOrder(Int32 value) + private static Int32 SwapByteOrder(Int32 value) { Int32 swapped = (Int32)((0x000000FF) & (value >> 24) | (0x0000FF00) & (value >> 8) @@ -174,7 +174,7 @@ namespace org.apache.qpid.transport.util /// /// to swap the bytes of. /// Byte order swapped . - private static UInt16 swapByteOrder(UInt16 value) + private static UInt16 SwapByteOrder(UInt16 value) { return (UInt16)((0x00FF & (value >> 8)) | (0xFF00 & (value << 8))); @@ -185,7 +185,7 @@ namespace org.apache.qpid.transport.util /// /// to swap the bytes of. /// Byte order swapped . - private static UInt32 swapByteOrder(UInt32 value) + private static UInt32 SwapByteOrder(UInt32 value) { UInt32 swapped = ((0x000000FF) & (value >> 24) | (0x0000FF00) & (value >> 8) @@ -199,14 +199,14 @@ namespace org.apache.qpid.transport.util /// /// to swap. /// Byte order swapped value. - private static long swapByteOrder(long value) + 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) + private static double SwapByteOrder(double value) { Byte[] buffer = BitConverter.GetBytes(value); Array.Reverse(buffer, 0, buffer.Length); diff --git a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs index ef31a6ead2..00d7b20d4c 100644 --- a/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs +++ b/qpid/dotnet/client-010/client/transport/util/CircularBuffer.cs @@ -58,7 +58,7 @@ namespace common.org.apache.qpid.transport.util Monitor.Wait(this); } bool notifyDequeue = countValue <= 0; - load(t); + Load(t); if (notifyDequeue) //notifyDequeue) { Monitor.PulseAll(this); @@ -76,7 +76,7 @@ namespace common.org.apache.qpid.transport.util Monitor.Wait(this); } bool notifyEnqueue = countValue >= (len - 1); - T temp = get(); + T temp = Get(); if (notifyEnqueue) //notifyEnqueue) { Monitor.PulseAll(this); @@ -85,7 +85,7 @@ namespace common.org.apache.qpid.transport.util } } - public void close() + public void Close() { nrp = 0; nwp = 0; @@ -99,24 +99,24 @@ namespace common.org.apache.qpid.transport.util #region Private Support Functions - private void load(T t) + private void Load(T t) { Int32 i = nwp; buffer[i] = t; i += add; if (i < 0) i += len; nwp = i; - updateCount(); + UpdateCount(); } - private void updateCount() + private void UpdateCount() { countValue = nwp - nrp; if (countValue <= 0 ) countValue += len; // modulo buffer size } - private T get() + private T Get() { Int32 i = nrp; T temp = buffer[i]; diff --git a/qpid/dotnet/client-010/client/transport/util/Functions.cs b/qpid/dotnet/client-010/client/transport/util/Functions.cs index 63ef9ddcaf..eee3848386 100644 --- a/qpid/dotnet/client-010/client/transport/util/Functions.cs +++ b/qpid/dotnet/client-010/client/transport/util/Functions.cs @@ -28,14 +28,14 @@ namespace org.apache.qpid.transport.util public class Functions { - public static sbyte lsb(int i) + public static sbyte Lsb(int i) { return (sbyte) (0xFF & i); } - public static sbyte lsb(long l) + 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 b87f97dd53..f889fe2aab 100644 --- a/qpid/dotnet/client-010/client/transport/util/Logger.cs +++ b/qpid/dotnet/client-010/client/transport/util/Logger.cs @@ -32,7 +32,7 @@ namespace org.apache.qpid.transport.util { private readonly ILog log; - public static Logger get(Type type) + public static Logger Get(Type type) { return new Logger(LogManager.GetLogger(type)); } @@ -42,12 +42,12 @@ namespace org.apache.qpid.transport.util this.log = log; } - public bool isDebugEnabled() + public bool IsDebugEnabled() { return log.IsDebugEnabled; } - public void debug(String message, params Object[] args) + public void Debug(String message, params Object[] args) { if (log.IsDebugEnabled) { @@ -55,7 +55,7 @@ namespace org.apache.qpid.transport.util } } - public void debug(Exception t, String message, params Object[] args) + public void Debug(Exception t, String message, params Object[] args) { if (log.IsDebugEnabled) { @@ -63,7 +63,7 @@ namespace org.apache.qpid.transport.util } } - public void error(String message, params Object[] args) + public void Error(String message, params Object[] args) { if (log.IsErrorEnabled) { @@ -71,7 +71,7 @@ namespace org.apache.qpid.transport.util } } - public void error(Exception t, String message, params Object[] args) + public void Error(Exception t, String message, params Object[] args) { if (log.IsErrorEnabled) { @@ -79,7 +79,7 @@ namespace org.apache.qpid.transport.util } } - public void warn(String message, params Object[] args) + public void Warn(String message, params Object[] args) { if (log.IsWarnEnabled) { @@ -87,7 +87,7 @@ namespace org.apache.qpid.transport.util } } - public void warn(Exception t, String message, params Object[] args) + public void Warn(Exception t, String message, params Object[] args) { if (log.IsWarnEnabled) { @@ -95,7 +95,7 @@ namespace org.apache.qpid.transport.util } } - public void info(String message, params Object[] args) + public void Info(String message, params Object[] args) { if (log.IsInfoEnabled) { @@ -103,7 +103,7 @@ namespace org.apache.qpid.transport.util } } - public void info(Exception t, String message, params Object[] args) + public void Info(Exception t, String message, params Object[] args) { if (log.IsInfoEnabled) { @@ -111,4 +111,4 @@ namespace org.apache.qpid.transport.util } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs index 5b31c9d71a..0de2b27656 100644 --- a/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs +++ b/qpid/dotnet/client-010/client/transport/util/ResultFuture.cs @@ -26,36 +26,36 @@ using org.apache.qpid.transport.util; namespace common.org.apache.qpid.transport.util { - public class ResultFuture : Future + public class ResultFuture : IFuture { const long _timeout = 60000; private Struct _result; private Session _session; - private static readonly Logger log = Logger.get(typeof(ResultFuture)); + private static readonly Logger log = Logger.Get(typeof(ResultFuture)); - public Struct get(long timeout) + public Struct Get(long timeout) { lock (this) { DateTime start = DateTime.Now; long elapsed = 0; - while (! _session.Closed && timeout - elapsed > 0 && _result == null) + while (! _session.IsClosed && timeout - elapsed > 0 && _result == null) { - log.debug("{0} waiting for result: {1}", _session, this ); + log.Debug("{0} waiting for result: {1}", _session, this ); Monitor.Wait(this, (int) (timeout - elapsed)); elapsed = (long) (DateTime.Now.Subtract(start)).TotalMilliseconds; } } - if( _session.Closed ) + if( _session.IsClosed ) { - throw new SessionException(_session.getExceptions()); + throw new SessionException(_session.GetExceptions()); } return _result; } public Struct Result { - get { return get(_timeout); } + get { return Get(_timeout); } set { lock (this) @@ -71,7 +71,7 @@ namespace common.org.apache.qpid.transport.util set { _session = value; } } - public String toString() + public override String ToString() { return String.Format("Future({0})", _result); } diff --git a/qpid/dotnet/client-010/client/transport/util/Serial.cs b/qpid/dotnet/client-010/client/transport/util/Serial.cs index 5dee37e686..874097084a 100644 --- a/qpid/dotnet/client-010/client/transport/util/Serial.cs +++ b/qpid/dotnet/client-010/client/transport/util/Serial.cs @@ -37,39 +37,39 @@ namespace org.apache.qpid.transport.util /// first argument is less than, equal to, or greater than the /// second /// - public static int compare(int s1, int s2) + public static int Compare(int s1, int s2) { return s1 - s2; } - public static bool lt(int s1, int s2) + public static bool Lt(int s1, int s2) { - return compare(s1, s2) < 0; + return Compare(s1, s2) < 0; } - public static bool le(int s1, int s2) + public static bool Le(int s1, int s2) { - return compare(s1, s2) <= 0; + return Compare(s1, s2) <= 0; } - public static bool gt(int s1, int s2) + public static bool Gt(int s1, int s2) { - return compare(s1, s2) > 0; + return Compare(s1, s2) > 0; } - public static bool ge(int s1, int s2) + public static bool Ge(int s1, int s2) { - return compare(s1, s2) >= 0; + return Compare(s1, s2) >= 0; } - public static bool eq(int s1, int s2) + public static bool Eq(int s1, int s2) { return s1 == s2; } - public static int min(int s1, int s2) + public static int Min(int s1, int s2) { - if (lt(s1, s2)) + if (Lt(s1, s2)) { return s1; } @@ -79,9 +79,9 @@ namespace org.apache.qpid.transport.util } } - public static int max(int s1, int s2) + public static int Max(int s1, int s2) { - if (gt(s1, s2)) + if (Gt(s1, s2)) { return s1; } @@ -91,4 +91,4 @@ namespace org.apache.qpid.transport.util } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index c621d4dad8..6b1c36c633 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -3,10 +3,10 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {E4C46FBC-7560-406D-BFEF-CA010E584DF4} - WinExe + Exe Properties demo Qpid Demo @@ -15,6 +15,8 @@ 2.0 + + true @@ -39,6 +41,7 @@ ..\lib\log4net\log4net.dll + @@ -46,7 +49,7 @@ - + ResXFileCodeGenerator Resources.Designer.cs @@ -57,6 +60,9 @@ Resources.resx True + + App.config + SettingsSingleFileGenerator Settings.Designer.cs @@ -81,4 +87,4 @@ --> - \ No newline at end of file + diff --git a/qpid/dotnet/client-010/demo/Program.cs b/qpid/dotnet/client-010/demo/Program.cs index 6ed0f5c393..aa748544a0 100644 --- a/qpid/dotnet/client-010/demo/Program.cs +++ b/qpid/dotnet/client-010/demo/Program.cs @@ -20,6 +20,7 @@ */ using System; +using System.Configuration; using System.IO; using System.Text; using System.Threading; @@ -36,35 +37,43 @@ namespace WindowsClient { XmlConfigurator.Configure(new FileInfo("..\\..\\log.xml")); // DOMConfigurator.Configure() + + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client client = new Client(); Console.WriteLine("Client created"); - client.connect("192.168.1.14", 5673, "test", "guest", "guest"); + client.Connect(host, port, virtualhost, username, password); Console.WriteLine("Connection established"); - ClientSession ssn = client.createSession(50000); + IClientSession ssn = client.CreateSession(50000); Console.WriteLine("Session created"); - ssn.queueDeclare("queue1", null, null); - ssn.exchangeBind("queue1", "amq.direct", "queue1", null); + ssn.QueueDeclare("queue1", null, null); + ssn.ExchangeBind("queue1", "amq.direct", "queue1", null); Object wl = new Object(); - ssn.attachMessageListener(new MyListener(ssn, wl), "myDest"); + ssn.AttachMessageListener(new MyListener(ssn, wl), "myDest"); - ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, + ssn.MessageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); DateTime start = DateTime.Now; // 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(); + 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 < 10000; i ++) { - ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, - new Header(new DeliveryProperties().setRoutingKey("queue1"), - new MessageProperties().setMessageId(UUID.randomUUID())), + 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)); } @@ -80,24 +89,24 @@ namespace WindowsClient { Monitor.Wait(wl, 30000); } - client.close(); + client.Close(); } } class MyListener : IMessageListener { private readonly Object _wl; - private ClientSession _session; + private IClientSession _session; private int _count; - public MyListener(ClientSession session, object wl) + public MyListener(IClientSession session, object wl) { _wl = wl; _session = session; _count = 0; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; diff --git a/qpid/dotnet/client-010/demo/default.build b/qpid/dotnet/client-010/demo/default.build index 8c64f8c045..f582e392f8 100644 --- a/qpid/dotnet/client-010/demo/default.build +++ b/qpid/dotnet/client-010/demo/default.build @@ -39,7 +39,8 @@ - + + 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 12002ce771..f20090526d 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.IO; using System.Text; using System.Threading; @@ -43,34 +44,38 @@ namespace org.apache.qpid.example.direct { private static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession 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"); + 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"); + session.AttachMessageListener(listener, "message_queue"); + session.MessageSubscribe("message_queue"); // Receive messages until all messages are received Monitor.Wait(session); } //--------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { @@ -81,14 +86,14 @@ namespace org.apache.qpid.example.direct public class MessageListener : IMessageListener { - private readonly ClientSession _session; + private readonly IClientSession _session; private readonly RangeSet _range = new RangeSet(); - public MessageListener(ClientSession session) + public MessageListener(IClientSession session) { _session = session; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; @@ -97,11 +102,11 @@ namespace org.apache.qpid.example.direct string message = enc.GetString(body); Console.WriteLine("Message: " + message); // Add this message to the list of message to be acknowledged - _range.add(m.Id); + _range.Add(m.Id); if( message.Equals("That's all, folks!") ) { // Acknowledge all the received messages - _session.messageAccept(_range); + _session.MessageAccept(_range); lock(_session) { Monitor.Pulse(_session); diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build index f611fee6f6..f5db519af7 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build +++ b/qpid/dotnet/client-010/examples/direct/example-direct-Listener/default.build @@ -40,6 +40,7 @@ + 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 2c345d997d..dea7666e49 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {AE65B1B9-8779-4CB1-91AF-E7F6C7A736D7} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 ede90411d4..f62667bf98 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.Text; using org.apache.qpid.client; @@ -40,13 +41,17 @@ namespace org.apache.qpid.example.direct { static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession session = connection.CreateSession(50000); //--------- Main body of program -------------------------------------------- @@ -57,26 +62,26 @@ namespace org.apache.qpid.example.direct // just once. (In most simple cases, there is no need to set // other message properties.) - message.DeliveryProperties.setRoutingKey("routing_key"); + 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); + 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(); + message.ClearData(); + message.AppendData(Encoding.UTF8.GetBytes("That's all, folks!")); + session.MessageTransfer("amq.direct", "routing_key", message); + session.Sync(); //----------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { diff --git a/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build index 3382349ae6..c4e78444c7 100644 --- a/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build +++ b/qpid/dotnet/client-010/examples/direct/example-direct-producer/default.build @@ -39,7 +39,8 @@ - + + 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 151c9214ee..6a4c9ceb92 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {96FCB250-8142-40EE-9BDD-CA839EE21021} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 5315808465..b1967b59be 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.IO; using System.Text; using System.Threading; @@ -43,13 +44,17 @@ namespace org.apache.qpid.example.fanout { private static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession session = connection.CreateSession(50000); //--------- Main body of program -------------------------------------------- // Each client creates its own private queue, using the @@ -63,23 +68,23 @@ namespace org.apache.qpid.example.fanout // messages and routing in logs. string myQueue = session.Name; - session.queueDeclare(myQueue, Option.EXCLUSIVE, Option.AUTO_DELETE); - session.exchangeBind(myQueue, "amq.fanout", "my-key"); + 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); + session.AttachMessageListener(listener, myQueue); + session.MessageSubscribe(myQueue); // Receive messages until all messages are received Monitor.Wait(session); } //--------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { @@ -90,14 +95,14 @@ namespace org.apache.qpid.example.fanout public class MessageListener : IMessageListener { - private readonly ClientSession _session; + private readonly IClientSession _session; private readonly RangeSet _range = new RangeSet(); - public MessageListener(ClientSession session) + public MessageListener(IClientSession session) { _session = session; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; @@ -106,11 +111,11 @@ namespace org.apache.qpid.example.fanout string message = enc.GetString(body); Console.WriteLine("Message: " + message); // Add this message to the list of message to be acknowledged - _range.add(m.Id); + _range.Add(m.Id); if (message.Equals("That's all, folks!")) { // Acknowledge all the received messages - _session.messageAccept(_range); + _session.MessageAccept(_range); lock (_session) { Monitor.Pulse(_session); diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build index bdf5cc80c5..dde36daf17 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Listener/default.build @@ -40,6 +40,7 @@ + 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 91a6ec4786..771e6a6891 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {18A0792B-DC3A-4EC5-93D6-DB8A111D8F15} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 047d3097a4..a781358a7e 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.Text; using org.apache.qpid.client; @@ -42,13 +43,17 @@ namespace org.apache.qpid.example.fanout { static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession session = connection.CreateSession(50000); //--------- Main body of program -------------------------------------------- @@ -60,20 +65,20 @@ namespace org.apache.qpid.example.fanout // 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); + 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(); + message.ClearData(); + message.AppendData(Encoding.UTF8.GetBytes("That's all, folks!")); + session.MessageTransfer("amq.fanout", message); + session.Sync(); //----------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { diff --git a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build index 874854a51b..c4d39e41da 100644 --- a/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build +++ b/qpid/dotnet/client-010/examples/fanout/example-fanout-Producer/default.build @@ -40,6 +40,7 @@ + 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 59d194badb..6c164924a3 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {4513BF94-D54A-42FE-8506-FE2CD57B2C51} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 f08e1a70f8..aeaf3f043b 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.IO; using System.Text; using System.Threading; @@ -45,13 +46,17 @@ namespace org.apache.qpid.example.pubsub private static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession session = connection.CreateSession(50000); //--------- Main body of program -------------------------------------------- @@ -71,7 +76,7 @@ namespace org.apache.qpid.example.pubsub //--------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { @@ -79,12 +84,12 @@ namespace org.apache.qpid.example.pubsub } } - private static void prepareQueue(string queue, string routing_key, ClientSession session) + private static void prepareQueue(string queue, string routing_key, IClientSession 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); + 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 @@ -92,27 +97,27 @@ namespace org.apache.qpid.example.pubsub // 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"); + 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); + session.AttachMessageListener(listener, queue); + session.MessageSubscribe(queue); } } public class MessageListener : IMessageListener { - private readonly ClientSession _session; + private readonly IClientSession _session; private readonly RangeSet _range = new RangeSet(); - public MessageListener(ClientSession session) + public MessageListener(IClientSession session) { _session = session; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; @@ -121,13 +126,13 @@ namespace org.apache.qpid.example.pubsub 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); + _range.Add(m.Id); if (message.Equals("That's all, folks!")) { - Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.getRoutingKey()); + Console.WriteLine("Shutting down listener for " + m.DeliveryProperties.GetRoutingKey()); Listener._count--; // Acknowledge all the received messages - _session.messageAccept(_range); + _session.MessageAccept(_range); lock (_session) { Monitor.Pulse(_session); diff --git a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build index ddd3168d08..fe2d9bf4ba 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Listener/default.build @@ -40,6 +40,7 @@ + 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 2a15b4f224..f7222fc865 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {2BCDC2CC-5BDA-4CC7-944D-2899AD8A53C7} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 a876f0f170..c87985d288 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.Text; using org.apache.qpid.client; @@ -40,13 +41,17 @@ namespace org.apache.qpid.example.pubsub { private static void Main(string[] args) { - string host = args.Length > 0 ? args[0] : "localhost"; - int port = args.Length > 1 ? Convert.ToInt32(args[1]) : 5672; + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession session = connection.CreateSession(50000); //--------- Main body of program -------------------------------------------- @@ -59,7 +64,7 @@ namespace org.apache.qpid.example.pubsub //----------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { @@ -67,27 +72,27 @@ namespace org.apache.qpid.example.pubsub } } - private static void publishMessages(ClientSession session, string routing_key) + private static void publishMessages(IClientSession 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); + message.ClearData(); + message.AppendData(Encoding.UTF8.GetBytes("Message " + i)); + session.MessageTransfer("amq.topic", routing_key, message); } } - private static void noMoreMessages(ClientSession session) + private static void noMoreMessages(IClientSession 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(); + 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/default.build b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build index 0a9c574d6e..3f270afe9e 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build +++ b/qpid/dotnet/client-010/examples/pub-sub/example-pub-sub-Publisher/default.build @@ -40,6 +40,7 @@ + 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 b7425a535e..3793b73625 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {F8857634-A134-44E7-A953-F2B22688C599} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 deleted file mode 100644 index 1e15109b11..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/Client.cs +++ /dev/null @@ -1,137 +0,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; -using System.Text; -using System.Threading; -using org.apache.qpid.client; -using org.apache.qpid.transport; - -namespace org.apache.qpid.example.requestresponse -{ - /// - /// 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. - /// - /// - 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/RequestResponseClient.cs b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/RequestResponseClient.cs new file mode 100644 index 0000000000..170008c840 --- /dev/null +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/RequestResponseClient.cs @@ -0,0 +1,142 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT 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.IO; +using System.Text; +using System.Threading; +using org.apache.qpid.client; +using org.apache.qpid.transport; + +namespace org.apache.qpid.example.requestresponse +{ + /// + /// 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. + /// + /// + internal class RequestResponseClient + { + private static void Main(string[] args) + { + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + + Client connection = new Client(); + try + { + connection.Connect(host, port, virtualhost, username, password); + IClientSession 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 IClientSession _session; + private readonly RangeSet _range = new RangeSet(); + private int _counter; + public ClientMessageListener(IClientSession 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/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build index 60713af386..c3d9af9baf 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Client/default.build @@ -39,7 +39,8 @@ - + + 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 d86e013538..858f4eaf13 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {1BC63815-4029-4039-9207-35E7E06ECC99} Exe @@ -35,11 +35,12 @@ + - + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ 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 aa14be0e55..ea87627dbf 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 @@ -18,6 +18,7 @@ */ using System; +using System.Configuration; using System.IO; using System.Text; using System.Threading; @@ -42,28 +43,32 @@ namespace org.apache.qpid.example.requestresponse { 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(); + string host = ConfigurationManager.AppSettings["Host"]; + int port = int.Parse(ConfigurationManager.AppSettings["Port"]); + string virtualhost = ConfigurationManager.AppSettings["VirtualHost"]; + string username = ConfigurationManager.AppSettings["Username"]; + string password = ConfigurationManager.AppSettings["Password"]; + + Client connection = new Client(); try { - connection.connect(host, port, "test", "guest", "guest"); - ClientSession session = connection.createSession(50000); + connection.Connect(host, port, virtualhost, username, password); + IClientSession 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); + 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); + session.AttachMessageListener(listener, request_queue); + session.MessageSubscribe(request_queue); // Receive messages until all messages are received Console.WriteLine("Waiting for requests"); Monitor.Wait(session); @@ -71,7 +76,7 @@ namespace org.apache.qpid.example.requestresponse //--------------------------------------------------------------------------- - connection.close(); + connection.Close(); } catch (Exception e) { @@ -82,22 +87,22 @@ namespace org.apache.qpid.example.requestresponse public class MessageListener : IMessageListener { - private readonly ClientSession _session; + private readonly IClientSession _session; private readonly RangeSet _range = new RangeSet(); - public MessageListener(ClientSession session) + public MessageListener(IClientSession session) { _session = session; } - public void messageTransfer(IMessage request) + 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() ) + if( request.MessageProperties.HasReplyTo() ) { - routingKey = request.MessageProperties.getReplyTo().getRoutingKey(); + routingKey = request.MessageProperties.GetReplyTo().GetRoutingKey(); } else { @@ -116,16 +121,16 @@ namespace org.apache.qpid.example.requestresponse string responseBody = message.ToUpper(); // Send it back to the user - response.clearData(); - response.appendData(Encoding.UTF8.GetBytes(responseBody)); - _session.messageTransfer("amq.direct", routingKey, response); + 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); + _range.Add(request.Id); if (message.Equals("That's all, folks!")) { // Acknowledge all the received messages - _session.messageAccept(_range); + _session.MessageAccept(_range); lock (_session) { Monitor.Pulse(_session); diff --git a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build index 1a1bea225d..a3e4691d10 100644 --- a/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build +++ b/qpid/dotnet/client-010/examples/request-response/example-request-response-Server/default.build @@ -40,7 +40,8 @@ - + + 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 f747f5692d..71ae819961 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 @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {922FBA9C-E483-4AEF-ABE8-AC87421E829B} Exe @@ -35,6 +35,7 @@ + @@ -48,6 +49,11 @@ Client + + + App.config + + - \ No newline at end of file + diff --git a/qpid/dotnet/client-010/gentool/IInvoker.tpl b/qpid/dotnet/client-010/gentool/IInvoker.tpl new file mode 100644 index 0000000000..713d10c610 --- /dev/null +++ b/qpid/dotnet/client-010/gentool/IInvoker.tpl @@ -0,0 +1,57 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using System.Collections.Generic; +using System.IO; + +namespace org.apache.qpid.transport +{ + +public interface IInvoker { + + IFuture Invoke(Method method, IFuture resultClass); + +${ +from dotnetgenutil import * + +for c in composites: + name = cname(c) + fields = get_fields(c) + params = get_dotnetparameters(c, fields) + args = get_arguments(c, fields) + result = c["result"] + if result: + if not result["@type"]: + rname = cname(result["struct"]) + else: + rname = cname(result, "@type") + jresult = "IFuture" + else: + jresult = "void" + + out(""" + $jresult $(name)($(", ".join(params))); +""") +} + +} +} diff --git a/qpid/dotnet/client-010/management/console/Agent.cs b/qpid/dotnet/client-010/management/console/Agent.cs index 50e2be34fe..df544a4dd0 100644 --- a/qpid/dotnet/client-010/management/console/Agent.cs +++ b/qpid/dotnet/client-010/management/console/Agent.cs @@ -61,12 +61,12 @@ namespace org.apache.qpid.console return String.Format("agent.{0}.{1}", BrokerBank, AgentBank) ; } - public static long getBrokerBank(string routingKey) { + public static long GetBrokerBank(string routingKey) { string delim = "." ; return long.Parse(routingKey.Split(delim.ToCharArray())[2]) ; } - public static long getAgentBank(string routingKey) { + public static long GetAgentBank(string routingKey) { string delim = "." ; return long.Parse(routingKey.Split(delim.ToCharArray())[3]) ; } diff --git a/qpid/dotnet/client-010/management/console/Broker.cs b/qpid/dotnet/client-010/management/console/Broker.cs index c1e17abfda..2d2bedf110 100644 --- a/qpid/dotnet/client-010/management/console/Broker.cs +++ b/qpid/dotnet/client-010/management/console/Broker.cs @@ -42,10 +42,10 @@ namespace org.apache.qpid.console public BrokerURL url ; public Dictionary Agents = new Dictionary() ; - private Client client ; - private ClientSession clientSession ; + private IClient client ; + private IClientSession clientSession ; //FIXME This second session should not be needed. There is a bug in the underlieing code. - private ClientSession outSession ; + private IClientSession outSession ; private int timeout = 50000 ; private string replyName ; private string topicName ; @@ -84,40 +84,40 @@ namespace org.apache.qpid.console Agent newAgent = new Agent(this,0,"BrokerAgent") ; Agents.Add(newAgent.AgentKey(), newAgent) ; client = new Client() ; - client.connect(url.Hostname, url.Port, null, url.AuthName, url.AuthPassword) ; - clientSession = client.createSession(timeout) ; - //clientSession.setAutoSync(false) ; - string name = System.Text.Encoding.UTF8.GetString(clientSession.getName()) ; + client.Connect(url.Hostname, url.Port, null, url.AuthName, url.AuthPassword) ; + clientSession = client.CreateSession(timeout) ; + //clientSession.SetAutoSync(false) ; + string name = System.Text.Encoding.UTF8.GetString(clientSession.GetName()) ; replyName = "reply-" + name ; topicName = "topic-" + name ; - clientSession.setAutoSync(true) ; + clientSession.SetAutoSync(true) ; Option[] options = new Option[] {Option.EXCLUSIVE, Option.AUTO_DELETE} ; // This queue is used for responses to messages which are sent. - clientSession.queueDeclare(replyName,options) ; - clientSession.exchangeBind(replyName,"amq.direct",replyName) ; - clientSession.attachMessageListener(this, "rdest") ; - clientSession.messageSubscribe(replyName,"rdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; - clientSession.messageSetFlowMode("rdest", MessageFlowMode.WINDOW); - clientSession.messageFlow("rdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - clientSession.messageFlow("rdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.QueueDeclare(replyName,options) ; + clientSession.ExchangeBind(replyName,"amq.direct",replyName) ; + clientSession.AttachMessageListener(this, "rdest") ; + clientSession.MessageSubscribe(replyName,"rdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; + clientSession.MessageSetFlowMode("rdest", MessageFlowMode.WINDOW); + clientSession.MessageFlow("rdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.MessageFlow("rdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); // This queue is used for unsolicited messages sent to this class. - clientSession.queueDeclare(topicName, options) ; - clientSession.attachMessageListener(this, "tdest") ; - clientSession.messageSubscribe(topicName,"tdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; - clientSession.messageSetFlowMode("tdest", MessageFlowMode.WINDOW); - clientSession.messageFlow("tdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - clientSession.messageFlow("tdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.QueueDeclare(topicName, options) ; + clientSession.AttachMessageListener(this, "tdest") ; + clientSession.MessageSubscribe(topicName,"tdest",MessageAcceptMode.NONE,MessageAcquireMode.PRE_ACQUIRED,null,0,null) ; + clientSession.MessageSetFlowMode("tdest", MessageFlowMode.WINDOW); + clientSession.MessageFlow("tdest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + clientSession.MessageFlow("tdest", MessageCreditUnit.MESSAGE, ClientSession.MESSAGE_FLOW_MAX_BYTES); - outSession = client.createSession(timeout) ; - outSession.exchangeBind(replyName,"amq.direct",replyName) ; + outSession = client.CreateSession(timeout) ; + outSession.ExchangeBind(replyName,"amq.direct",replyName) ; connected = true ; consoleSession.HandleBrokerConnect(this) ; - Encoder encoder = CreateEncoder() ; + IEncoder encoder = CreateEncoder() ; this.SetHeader(encoder, 'B', 0) ; this.Send(encoder) ; } @@ -125,10 +125,10 @@ namespace org.apache.qpid.console public void Shutdown() { if (connected) { this.WaitForStable() ; - clientSession.messageStop("rdest") ; - clientSession.messageStop("tdest") ; - clientSession.close() ; - client.close() ; + clientSession.MessageStop("rdest") ; + clientSession.MessageStop("tdest") ; + clientSession.Close() ; + client.Close() ; this.connected = false ; } } @@ -153,87 +153,87 @@ namespace org.apache.qpid.console } } - public Encoder CreateEncoder() { + public IEncoder CreateEncoder() { return new MSEncoder(1000) ; } - public Encoder CreateEncoder(char opcode, long sequence) { + public IEncoder CreateEncoder(char opcode, long sequence) { return SetHeader(this.CreateEncoder(), opcode, sequence) ; } - public Encoder SetHeader(Encoder enc, char opcode, long sequence) { - enc.writeUint8((short)'A') ; - enc.writeUint8((short)'M') ; - enc.writeUint8((short)'3') ; - enc.writeUint8((short)opcode) ; - enc.writeUint32(sequence) ; + public IEncoder SetHeader(IEncoder enc, char opcode, long sequence) { + enc.WriteUint8((short)'A') ; + enc.WriteUint8((short)'M') ; + enc.WriteUint8((short)'3') ; + enc.WriteUint8((short)opcode) ; + enc.WriteUint32(sequence) ; return enc ; } - public Message CreateMessage(Encoder enc) { + public Message CreateMessage(IEncoder enc) { return this.CreateMessage(enc, "broker", -1) ; } - public Message CreateMessage(Encoder enc, string routingKey) { + public Message CreateMessage(IEncoder enc, string routingKey) { return this.CreateMessage(enc, routingKey, -1) ; } - public Message CreateMessage(Encoder enc, string routingKey, long ttl) { + public Message CreateMessage(IEncoder enc, string routingKey, long ttl) { Message msg = new Message() ; - msg.Body = ((MSEncoder)enc).segment() ; - msg.DeliveryProperties.setRoutingKey(routingKey) ; + msg.Body = ((MSEncoder)enc).Segment() ; + msg.DeliveryProperties.SetRoutingKey(routingKey) ; if (-1 != ttl) { - msg.DeliveryProperties.setTtl(ttl) ; + msg.DeliveryProperties.SetTtl(ttl) ; } - msg.MessageProperties.setContentType("x-application/qmf") ; - msg.MessageProperties.setReplyTo(new ReplyTo("amq.direct", replyName)) ; + msg.MessageProperties.SetContentType("x-application/qmf") ; + msg.MessageProperties.SetReplyTo(new ReplyTo("amq.direct", replyName)) ; return msg ; } - public void Send(Encoder enc) { + public void Send(IEncoder enc) { this.Send(this.CreateMessage(enc)) ; } public void Send(Message msg) { lock (lockObject) { - log.Debug(String.Format("Sending message to routing key '{0}'", msg.DeliveryProperties.getRoutingKey())) ; + log.Debug(String.Format("Sending message to routing key '{0}'", msg.DeliveryProperties.GetRoutingKey())) ; //log.Debug(System.Text.Encoding.UTF8.GetString(msg.Body.ToArray())) ; - outSession.messageTransfer("qpid.management", msg) ; + outSession.MessageTransfer("qpid.management", msg) ; //clientSession.sync() ; } } - protected bool CheckHeader(Decoder decoder, out char opcode, out long sequence) { + protected bool CheckHeader(IDecoder decoder, out char opcode, out long sequence) { bool returnValue = false ; opcode = 'x' ; sequence = -1 ; - if(decoder.hasRemaining()) { - char character = (char) decoder.readUint8() ; + if(decoder.HasRemaining()) { + char character = (char) decoder.ReadUint8() ; if (character != 'A') { return returnValue ; } - character = (char) decoder.readUint8() ; + character = (char) decoder.ReadUint8() ; if (character != 'M') { return returnValue ; } - character = (char) decoder.readUint8() ; + character = (char) decoder.ReadUint8() ; if (character != '3') { return returnValue ; } returnValue = true ; - opcode = (char) decoder.readUint8() ; - sequence = decoder.readUint32() ; + opcode = (char) decoder.ReadUint8() ; + sequence = decoder.ReadUint32() ; } return returnValue ; } - public void messageTransfer(IMessage msg) { + public void MessageTransfer(IMessage msg) { MSDecoder decoder = new MSDecoder() ; - decoder.init(msg.Body) ; + decoder.Init(msg.Body) ; RangeSet rangeSet = new RangeSet() ; - rangeSet.add(msg.Id) ; + rangeSet.Add(msg.Id) ; char opcode = 'x' ; long seq = -1 ; while (this.CheckHeader(decoder, out opcode, out seq)) { @@ -279,7 +279,7 @@ namespace org.apache.qpid.console } } lock (lockObject) { - outSession.messageAccept(rangeSet) ; + outSession.MessageAccept(rangeSet) ; } } @@ -294,9 +294,9 @@ namespace org.apache.qpid.console this.reqsOutstanding -= 1 ; if ((reqsOutstanding == 0) & !topicBound) { foreach (string key in consoleSession.BindingKeys()) { - //this.clientSession.exchangeBind(topicName, "qpid.mannagement", key) ; + //this.clientSession.ExchangeBind(topicName, "qpid.mannagement", key) ; log.Debug("Setting Topic Binding " + key) ; - this.outSession.exchangeBind(topicName, "qpid.management", key) ; + this.outSession.ExchangeBind(topicName, "qpid.management", key) ; } topicBound = true ; } @@ -348,4 +348,4 @@ namespace org.apache.qpid.console } } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/management/console/BrokerURL.cs b/qpid/dotnet/client-010/management/console/BrokerURL.cs index c98c62e41a..77318e4295 100644 --- a/qpid/dotnet/client-010/management/console/BrokerURL.cs +++ b/qpid/dotnet/client-010/management/console/BrokerURL.cs @@ -20,7 +20,6 @@ */ using System; -using System.Net ; namespace org.apache.qpid.console { diff --git a/qpid/dotnet/client-010/management/console/ClassKey.cs b/qpid/dotnet/client-010/management/console/ClassKey.cs index 81beb60249..a3aba2761a 100644 --- a/qpid/dotnet/client-010/management/console/ClassKey.cs +++ b/qpid/dotnet/client-010/management/console/ClassKey.cs @@ -55,13 +55,13 @@ namespace org.apache.qpid.console Hash[3] = long.Parse(bytes[3], NumberStyles.HexNumber) ; } - public ClassKey(Decoder dec) { - PackageName = dec.readStr8() ; - ClassName = dec.readStr8() ; - Hash[0] = dec.readUint32() ; - Hash[1] = dec.readUint32() ; - Hash[2] = dec.readUint32() ; - Hash[3] = dec.readUint32() ; + public ClassKey(IDecoder dec) { + PackageName = dec.ReadStr8() ; + ClassName = dec.ReadStr8() ; + Hash[0] = dec.ReadUint32() ; + Hash[1] = dec.ReadUint32() ; + Hash[2] = dec.ReadUint32() ; + Hash[3] = dec.ReadUint32() ; } @@ -74,13 +74,13 @@ namespace org.apache.qpid.console return String.Format("{0:x8}-{1:x8}-{2:x8}-{3:x8}", (long) Hash[0],Hash[1], Hash[2],Hash[3]) ; } - public void encode(Encoder enc) { - enc.writeStr8(PackageName) ; - enc.writeStr8(ClassName) ; - enc.writeUint32(Hash[0]) ; - enc.writeUint32(Hash[1]) ; - enc.writeUint32(Hash[2]) ; - enc.writeUint32(Hash[3]) ; + public void encode(IEncoder enc) { + enc.WriteStr8(PackageName) ; + enc.WriteStr8(ClassName) ; + enc.WriteUint32(Hash[0]) ; + enc.WriteUint32(Hash[1]) ; + enc.WriteUint32(Hash[2]) ; + enc.WriteUint32(Hash[3]) ; } override public string ToString() { diff --git a/qpid/dotnet/client-010/management/console/ObjectID.cs b/qpid/dotnet/client-010/management/console/ObjectID.cs index af3c161f71..9532c8e64c 100644 --- a/qpid/dotnet/client-010/management/console/ObjectID.cs +++ b/qpid/dotnet/client-010/management/console/ObjectID.cs @@ -37,10 +37,10 @@ namespace org.apache.qpid.console public ObjectID() { } - public ObjectID(Decoder dec) + public ObjectID(IDecoder dec) { - first = (long)dec.readUint64() ; - second = (long)dec.readUint64() ; + first = (long)dec.ReadUint64() ; + second = (long)dec.ReadUint64() ; } public ObjectID(long first, long second) { @@ -72,9 +72,9 @@ namespace org.apache.qpid.console return Sequence() == 0 ; } - public void encode(Encoder enc) { - enc.writeUint64((long)first) ; - enc.writeUint64((long)second) ; + public void encode(IEncoder enc) { + enc.WriteUint64((long)first) ; + enc.WriteUint64((long)second) ; } override public string ToString() { diff --git a/qpid/dotnet/client-010/management/console/QMFEvent.cs b/qpid/dotnet/client-010/management/console/QMFEvent.cs index 1fe6cdb388..73e1a34c43 100644 --- a/qpid/dotnet/client-010/management/console/QMFEvent.cs +++ b/qpid/dotnet/client-010/management/console/QMFEvent.cs @@ -49,12 +49,12 @@ namespace org.apache.qpid.console public EventSeverity Severity {get;set;} public Dictionary Arguments {get;set;} - public QMFEvent(Session session, Decoder dec) + public QMFEvent(Session session, IDecoder dec) { Session = session ; ClassKey = new ClassKey(dec) ; - Timestamp = dec.readInt64() ; - Severity = (EventSeverity) dec.readUint8() ; + Timestamp = dec.ReadInt64() ; + Severity = (EventSeverity) dec.ReadUint8() ; SchemaClass sClass = Session.GetSchema(ClassKey) ; Arguments = new Dictionary() ; diff --git a/qpid/dotnet/client-010/management/console/QMFObject.cs b/qpid/dotnet/client-010/management/console/QMFObject.cs index d7141cb371..905422efd9 100644 --- a/qpid/dotnet/client-010/management/console/QMFObject.cs +++ b/qpid/dotnet/client-010/management/console/QMFObject.cs @@ -92,7 +92,7 @@ namespace org.apache.qpid.console // This constructor is used by the session to create an object based on a data // stream by the agent. - public QMFObject(Session session, SchemaClass schema, Decoder dec, bool hasProperties, bool hasStats , bool isManaged) + public QMFObject(Session session, SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats , bool isManaged) { Session = session ; Schema = schema ; @@ -100,9 +100,9 @@ namespace org.apache.qpid.console if (Managed) { // FIXME DateTime or Uint64?? - CurrentTime = new DateTime(dec.readDatetime()) ; - CreateTime = new DateTime(dec.readDatetime()) ; - DeleteTime = new DateTime(dec.readDatetime()) ; + CurrentTime = new DateTime(dec.ReadDatetime()) ; + CreateTime = new DateTime(dec.ReadDatetime()) ; + DeleteTime = new DateTime(dec.ReadDatetime()) ; ObjectID = new ObjectID(dec) ; } @@ -129,7 +129,7 @@ namespace org.apache.qpid.console } - protected List ProcessPresenceMasks(Decoder dec, SchemaClass schema) { + protected List ProcessPresenceMasks(IDecoder dec, SchemaClass schema) { List excludes = new List () ; short bit = 0 ; short mask = 0 ; @@ -137,7 +137,7 @@ namespace org.apache.qpid.console if (prop.Optional) { //log.Debug(String.Format("Property named {0} is optional", prop.Name)) ; if (bit == 0) { - mask=dec.readUint8() ; + mask=dec.ReadUint8() ; bit = 1 ; } @@ -234,13 +234,13 @@ namespace org.apache.qpid.console return Session.InvokeMethod(this, name, args, synchronous, timeToLive) ; } - public void Encode (Encoder enc) { + public void Encode (IEncoder enc) { int mask = 0 ; int bit = 0 ; List propsToEncode = new List() ; log.Debug(String.Format("Encoding class {0}:{1}", Schema.PackageName, Schema.ClassName)) ; - enc.writeUint8(20) ; + enc.WriteUint8(20) ; Schema.Key.encode(enc) ; foreach (SchemaProperty prop in Schema.GetAllProperties()) { @@ -256,7 +256,7 @@ namespace org.apache.qpid.console bit = bit << 1 ; if (bit == 256) { bit = 0 ; - enc.writeUint8((short)mask) ; + enc.WriteUint8((short)mask) ; mask = 0 ; } } else { @@ -264,7 +264,7 @@ namespace org.apache.qpid.console } } if (bit != 0) { - enc.writeUint8((short)mask) ; + enc.WriteUint8((short)mask) ; } foreach (SchemaProperty prop in propsToEncode) { @@ -291,4 +291,4 @@ namespace org.apache.qpid.console } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/management/console/SchemaArgument.cs b/qpid/dotnet/client-010/management/console/SchemaArgument.cs index e1ace84fe0..d3ee508b31 100644 --- a/qpid/dotnet/client-010/management/console/SchemaArgument.cs +++ b/qpid/dotnet/client-010/management/console/SchemaArgument.cs @@ -34,9 +34,9 @@ namespace org.apache.qpid.console public string Direction {get;set;} - public SchemaArgument(Decoder dec, bool methodArg) + public SchemaArgument(IDecoder dec, bool methodArg) { - Dictionary map = dec.readMap() ; + Dictionary map = dec.ReadMap() ; base.PopulateData(map) ; if (map.ContainsKey("dir")) { diff --git a/qpid/dotnet/client-010/management/console/SchemaClass.cs b/qpid/dotnet/client-010/management/console/SchemaClass.cs index 7d49accf61..653221034d 100644 --- a/qpid/dotnet/client-010/management/console/SchemaClass.cs +++ b/qpid/dotnet/client-010/management/console/SchemaClass.cs @@ -54,18 +54,18 @@ namespace org.apache.qpid.console protected Session Session {get;set;} - public SchemaClass(int kind, ClassKey key, Decoder dec, Session session) + public SchemaClass(int kind, ClassKey key, IDecoder dec, Session session) { log.Debug(String.Format("New schema class {0}", key)) ; Kind = kind ; Session = session ; this.Key = key ; - bool hasSupertype = !(dec.readUint8().Equals(0)) ; + bool hasSupertype = !(dec.ReadUint8().Equals(0)) ; if (kind == CLASS_KIND_TABLE) { - int propCount = dec.readUint16() ; - int statCount = dec.readUint16() ; - int methodCount = dec.readUint16() ; + int propCount = dec.ReadUint16() ; + int statCount = dec.ReadUint16() ; + int methodCount = dec.ReadUint16() ; if (hasSupertype) { SuperType = new ClassKey(dec) ; @@ -83,7 +83,7 @@ namespace org.apache.qpid.console } if (kind == CLASS_KIND_EVENT) { - int argCount = dec.readUint16() ; + int argCount = dec.ReadUint16() ; if (hasSupertype) { SuperType = new ClassKey(dec) ; } diff --git a/qpid/dotnet/client-010/management/console/SchemaMethod.cs b/qpid/dotnet/client-010/management/console/SchemaMethod.cs index 0410234741..0a843262a4 100644 --- a/qpid/dotnet/client-010/management/console/SchemaMethod.cs +++ b/qpid/dotnet/client-010/management/console/SchemaMethod.cs @@ -40,9 +40,9 @@ namespace org.apache.qpid.console public string Description {get;set;} public List Arguments = new List(); - public SchemaMethod(Decoder dec) + public SchemaMethod(IDecoder dec) { - Dictionary map = dec.readMap() ; + Dictionary map = dec.ReadMap() ; Name = (string) map["name"] ; ArgCount = (int) map["argCount"] ; if (map.ContainsKey("desc")) { diff --git a/qpid/dotnet/client-010/management/console/SchemaProperty.cs b/qpid/dotnet/client-010/management/console/SchemaProperty.cs index 80be5bd6fb..50d3c62f8d 100644 --- a/qpid/dotnet/client-010/management/console/SchemaProperty.cs +++ b/qpid/dotnet/client-010/management/console/SchemaProperty.cs @@ -35,9 +35,9 @@ namespace org.apache.qpid.console public bool Index {get;set;} public bool Optional {get;set;} - public SchemaProperty(Decoder dec) + public SchemaProperty(IDecoder dec) { - Dictionary map = dec.readMap() ; + Dictionary map = dec.ReadMap() ; base.PopulateData(map) ; Name = (string) map["name"] ; diff --git a/qpid/dotnet/client-010/management/console/SchemaStatistic.cs b/qpid/dotnet/client-010/management/console/SchemaStatistic.cs index 74aea113c3..ff96b98388 100644 --- a/qpid/dotnet/client-010/management/console/SchemaStatistic.cs +++ b/qpid/dotnet/client-010/management/console/SchemaStatistic.cs @@ -37,9 +37,9 @@ namespace org.apache.qpid.console public string Description {get;set;} public string Unit {get;set;} - public SchemaStatistic(Decoder dec) + public SchemaStatistic(IDecoder dec) { - Dictionary map = dec.readMap() ; + Dictionary map = dec.ReadMap() ; Name = (string) map["name"] ; Type = (short) short.Parse(""+map["type"]) ; diff --git a/qpid/dotnet/client-010/management/console/Session.cs b/qpid/dotnet/client-010/management/console/Session.cs index 8c04f21f00..cdc30e482b 100644 --- a/qpid/dotnet/client-010/management/console/Session.cs +++ b/qpid/dotnet/client-010/management/console/Session.cs @@ -201,8 +201,8 @@ namespace org.apache.qpid.console } } - Encoder enc = broker.CreateEncoder('G', seq) ; - enc.writeMap(getParameters) ; + IEncoder enc = broker.CreateEncoder('G', seq) ; + enc.WriteMap(getParameters) ; string routingKey = String.Format("agent.{0}.{1}", agent.BrokerBank, agent.AgentBank) ; Message msg = broker.CreateMessage(enc, routingKey) ; log.Debug("Get Object Keys: ") ; @@ -339,10 +339,10 @@ namespace org.apache.qpid.console if (method != null) { KeyValuePair pair = new KeyValuePair(method, synchronous) ; seq = SequenceManager.Reserve(pair) ; - Encoder enc = aBroker.CreateEncoder('M', seq) ; + IEncoder enc = aBroker.CreateEncoder('M', seq) ; obj.ObjectID.encode(enc) ; obj.Schema.Key.encode(enc) ; - enc.writeStr8(name) ; + enc.WriteStr8(name) ; if (args.Count < method.InputArgCount) { throw new Exception(String.Format("Incorrect number of arguments: expected {0}, got{1}", method.InputArgCount, args.Count)) ; @@ -404,18 +404,18 @@ namespace org.apache.qpid.console } } - public void HandleBrokerResponse(Broker broker, Decoder decoder, long sequence) { + public void HandleBrokerResponse(Broker broker, IDecoder decoder, long sequence) { if (Console != null) { Console.BrokerInformation(broker) ; } long seq = SequenceManager.Reserve(CONTEXT_STARTUP) ; - Encoder endocder = broker.CreateEncoder('P', seq) ; + IEncoder endocder = broker.CreateEncoder('P', seq) ; broker.Send(endocder) ; } - public void HandlePackageIndicator(Broker broker, Decoder decoder, long sequence) { - string packageName = decoder.readStr8() ; + public void HandlePackageIndicator(Broker broker, IDecoder decoder, long sequence) { + string packageName = decoder.ReadStr8() ; bool notify = false ; if (!Packages.ContainsKey(packageName)) { lock (LockObject) { @@ -430,15 +430,15 @@ namespace org.apache.qpid.console broker.IncrementOutstanding() ; long seq = SequenceManager.Reserve(Session.CONTEXT_STARTUP) ; - Encoder enc = broker.CreateEncoder('Q', seq) ; - enc.writeStr8(packageName) ; + IEncoder enc = broker.CreateEncoder('Q', seq) ; + enc.WriteStr8(packageName) ; broker.Send(enc) ; } - public void HandleCommandComplete(Broker broker, Decoder decoder, long sequence) { + public void HandleCommandComplete(Broker broker, IDecoder decoder, long sequence) { - long code = decoder.readUint32() ; - string text = decoder.readStr8() ; + long code = decoder.ReadUint32() ; + string text = decoder.ReadStr8() ; Object context = this.SequenceManager.Release(sequence) ; if (context.Equals(CONTEXT_STARTUP)) { @@ -459,8 +459,8 @@ namespace org.apache.qpid.console } } - public void HandleClassIndicator(Broker broker, Decoder decoder, long sequence) { - short kind = decoder.readUint8() ; + public void HandleClassIndicator(Broker broker, IDecoder decoder, long sequence) { + short kind = decoder.ReadUint8() ; ClassKey classKey = new ClassKey(decoder) ; bool unknown = false ; @@ -476,15 +476,15 @@ namespace org.apache.qpid.console if (unknown) { broker.IncrementOutstanding() ; long seq = SequenceManager.Reserve(Session.CONTEXT_STARTUP) ; - Encoder enc = broker.CreateEncoder('S', seq) ; + IEncoder enc = broker.CreateEncoder('S', seq) ; classKey.encode(enc) ; broker.Send(enc) ; } } - public void HandleMethodResponse(Broker broker, Decoder decoder, long sequence) { - long code = decoder.readUint32() ; - string text = decoder.readStr16() ; + public void HandleMethodResponse(Broker broker, IDecoder decoder, long sequence) { + long code = decoder.ReadUint32() ; + string text = decoder.ReadStr16() ; Dictionary outArgs = new Dictionary() ; object obj = SequenceManager.Release(sequence) ; @@ -514,15 +514,15 @@ namespace org.apache.qpid.console } } - public void HandleHeartbeatIndicator(Broker broker, Decoder decoder, long sequence, IMessage msg) { + public void HandleHeartbeatIndicator(Broker broker, IDecoder decoder, long sequence, IMessage msg) { if (Console != null) { long brokerBank = 1 ; long agentBank = 0 ; try { - string routingKey = msg.DeliveryProperties.getRoutingKey() ; + string routingKey = msg.DeliveryProperties.GetRoutingKey() ; if (routingKey != null) { - agentBank = Agent.getBrokerBank(routingKey) ; - brokerBank = Agent.getBrokerBank(routingKey) ; + agentBank = Agent.GetBrokerBank(routingKey) ; + brokerBank = Agent.GetBrokerBank(routingKey) ; } } catch (Exception e) { @@ -530,7 +530,7 @@ namespace org.apache.qpid.console } string agentKey = Agent.AgentKey(agentBank, brokerBank) ; - long timestamp = decoder.readUint64() ; + long timestamp = decoder.ReadUint64() ; if (broker.Agents.ContainsKey(agentKey)) { Agent agent = broker.Agents[agentKey] ; Console.HearbeatRecieved(agent, timestamp) ; @@ -539,15 +539,15 @@ namespace org.apache.qpid.console } - public void HandleEventIndicator(Broker broker, Decoder decoder, long sequence) { + public void HandleEventIndicator(Broker broker, IDecoder decoder, long sequence) { if (Console != null) { QMFEvent newEvent = new QMFEvent(this, decoder) ; Console.EventRecieved(broker, newEvent) ; } } - public void HandleSchemaResponse(Broker broker, Decoder decoder, long sequence) { - short kind = decoder.readUint8() ; + public void HandleSchemaResponse(Broker broker, IDecoder decoder, long sequence) { + short kind = decoder.ReadUint8() ; ClassKey classKey = new ClassKey(decoder) ; SchemaClass sClass = new SchemaClass(kind, classKey, decoder, this) ; lock(LockObject) { @@ -563,7 +563,7 @@ namespace org.apache.qpid.console } } - public void HandleContentIndicator(Broker broker, Decoder decoder, long sequence, bool hasProperties, bool hasStatistics) { + public void HandleContentIndicator(Broker broker, IDecoder decoder, long sequence, bool hasProperties, bool hasStatistics) { ClassKey key = new ClassKey(decoder) ; SchemaClass sClass = null ;; @@ -600,46 +600,46 @@ namespace org.apache.qpid.console return true ; } - public object DecodeValue(Decoder dec, short type) { + public object DecodeValue(IDecoder dec, short type) { switch (type) { - case 1: return dec.readUint8() ; // U8 - case 2: return dec.readUint16() ; // U16 - case 3: return dec.readUint32() ; // U32 - case 4: return dec.readUint64() ; // U64 - case 6: return dec.readStr8() ; // SSTR - case 7: return dec.readStr16() ; // LSTR - case 8: return dec.readDatetime() ; // ABSTIME - case 9: return dec.readUint32() ; // DELTATIME + case 1: return dec.ReadUint8() ; // U8 + case 2: return dec.ReadUint16() ; // U16 + case 3: return dec.ReadUint32() ; // U32 + case 4: return dec.ReadUint64() ; // U64 + case 6: return dec.ReadStr8() ; // SSTR + case 7: return dec.ReadStr16() ; // LSTR + case 8: return dec.ReadDatetime() ; // ABSTIME + case 9: return dec.ReadUint32() ; // DELTATIME case 10: return new ObjectID(dec) ; // ref - case 11: return dec.readUint8() != 0 ; // bool - case 12: return dec.readFloat() ; // float - case 13: return dec.readDouble() ; // double - case 14: return dec.readUuid() ; // UUID + case 11: return dec.ReadUint8() != 0 ; // bool + case 12: return dec.ReadFloat() ; // float + case 13: return dec.ReadDouble() ; // double + case 14: return dec.ReadUuid() ; // UUID case 15: // Ftable Dictionary ftable = new Dictionary() ; MSDecoder sc = new MSDecoder() ; - sc.init(new MemoryStream(dec.readVbin32())) ; - if (sc.hasRemaining()) { - long count = sc.readUint32() ; + sc.Init(new MemoryStream(dec.ReadVbin32())) ; + if (sc.HasRemaining()) { + long count = sc.ReadUint32() ; while (count > 0) { - string key = sc.readStr8() ; - short code = sc.readUint8() ; + string key = sc.ReadStr8() ; + short code = sc.ReadUint8() ; object newValue = this.DecodeValue(sc, code) ; ftable.Add(key, newValue) ; count -= 1 ; } } return ftable ; - case 16: return dec.readInt8() ; // int8 - case 17: return dec.readInt16() ; // int16 - case 18: return dec.readInt32() ; // int32 - case 19: return dec.readInt64() ; // int64 + case 16: return dec.ReadInt8() ; // int8 + case 17: return dec.ReadInt16() ; // int16 + case 18: return dec.ReadInt32() ; // int32 + case 19: return dec.ReadInt64() ; // int64 case 20: // Object // Peek into the inner type code, make sure // it is actually an object object returnValue = null ; - short innerTypeCode = dec.readUint8() ; + short innerTypeCode = dec.ReadUint8() ; if (innerTypeCode != 20) { returnValue = this.DecodeValue(dec, innerTypeCode) ; } @@ -653,75 +653,81 @@ namespace org.apache.qpid.console } } return returnValue; - case 21: // List - MSDecoder lDec = new MSDecoder() ; - lDec.init(new MemoryStream(dec.readVbin32())) ; - long count = lDec.readUint32() ; - List newList = new List() ; - while (count > 0){ - short innerType = lDec.readUint8() ; - newList.Add(this.DecodeValue(lDec, innerType)) ; - count -= 1 ; - } - return newList ; - case 22: // Array - MSDecoder aDec = new MSDecoder() ; - aDec.init(new MemoryStream(dec.readVbin32())) ; - long cnt = aDec.readUint32() ; - short innerType = aDec.readUint8() ; - List aList = new List() ; - while (cnt > 0){ - aList.Add(this.DecodeValue(aDec, innerType)) ; - cnt -= 1 ; - } - return aList ; - default: + case 21: // List + { + MSDecoder lDec = new MSDecoder(); + lDec.Init(new MemoryStream(dec.ReadVbin32())); + long count = lDec.ReadUint32(); + List newList = new List(); + while (count > 0) + { + short innerType = lDec.ReadUint8(); + newList.Add(this.DecodeValue(lDec, innerType)); + count -= 1; + } + return newList; + } + case 22: // Array + { + MSDecoder aDec = new MSDecoder(); + aDec.Init(new MemoryStream(dec.ReadVbin32())); + long cnt = aDec.ReadUint32(); + short innerType = aDec.ReadUint8(); + List aList = new List(); + while (cnt > 0) + { + aList.Add(this.DecodeValue(aDec, innerType)); + cnt -= 1; + } + return aList; + } + default: throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; } } - public void EncodeValue(Encoder enc, short type, object val) { + public void EncodeValue(IEncoder enc, short type, object val) { try { switch ((int)type) { - case 1: enc.writeUint8((short) val) ; break; // U8 - case 2: enc.writeUint16((int) val) ; break; // U16 - case 3: enc.writeUint32((long) val) ; break; // U32 - case 4: enc.writeUint64((long) val) ; break; // U64 - case 6: enc.writeStr8((string) val) ; break; // SSTR - case 7: enc.writeStr16((string) val) ; break; // LSTR - case 8: enc.writeDatetime((long) val); break; // ABSTIME - case 9: enc.writeUint32((long) val); break; // DELTATIME + case 1: enc.WriteUint8((short) val) ; break; // U8 + case 2: enc.WriteUint16((int) val) ; break; // U16 + case 3: enc.WriteUint32((long) val) ; break; // U32 + case 4: enc.WriteUint64((long) val) ; break; // U64 + case 6: enc.WriteStr8((string) val) ; break; // SSTR + case 7: enc.WriteStr16((string) val) ; break; // LSTR + case 8: enc.WriteDatetime((long) val); break; // ABSTIME + case 9: enc.WriteUint32((long) val); break; // DELTATIME case 10: ((ObjectID)val).encode(enc) ; break; // ref case 11: if ((bool) val) { - enc.writeUint8(1) ; + enc.WriteUint8(1) ; } else { - enc.writeUint8(0) ; + enc.WriteUint8(0) ; } break ; - case 12: enc.writeFloat((float) val); break; // FLOAT - case 13: enc.writeDouble((double) val); break; // DOUBLE - case 14: enc.writeUuid((UUID) val) ; break ; // UUID + case 12: enc.WriteFloat((float) val); break; // FLOAT + case 13: enc.WriteDouble((double) val); break; // DOUBLE + case 14: enc.WriteUuid((UUID) val) ; break ; // UUID case 15: // Ftable Dictionary ftable = (Dictionary) val ; MSEncoder sc = new MSEncoder(1) ; - sc.init() ; - sc.writeUint32(ftable.Count) ; + sc.Init() ; + sc.WriteUint32(ftable.Count) ; foreach (String key in ftable.Keys) { object obj = ftable[key] ; short innerType = Util.QMFType(obj) ; - sc.writeStr8(key) ; - sc.writeUint8(innerType) ; + sc.WriteStr8(key) ; + sc.WriteUint8(innerType) ; this.EncodeValue(sc,innerType,obj) ; } - byte[] bytes = sc.segment().ToArray() ; - enc.writeVbin32(bytes) ; + byte[] bytes = sc.Segment().ToArray() ; + enc.WriteVbin32(bytes) ; break ; - case 16: enc.writeInt8((short) val) ; break; // int8 - case 17: enc.writeInt16((int) val) ; break; // int16 - case 18: enc.writeInt32(long.Parse(""+ val)) ; break; // int32 - case 19: enc.writeInt64(long.Parse("" + val)) ; break; // int64 + case 16: enc.WriteInt8((short) val) ; break; // int8 + case 17: enc.WriteInt16((int) val) ; break; // int16 + case 18: enc.WriteInt32(long.Parse(""+ val)) ; break; // int32 + case 19: enc.WriteInt64(long.Parse("" + val)) ; break; // int64 case 20: // Object // Check that the object has a session, if not // take ownership of it @@ -734,30 +740,30 @@ namespace org.apache.qpid.console case 21: // List List items = (List) val ; MSEncoder lEnc = new MSEncoder(1) ; - lEnc.init() ; - lEnc.writeUint32(items.Count) ; + lEnc.Init() ; + lEnc.WriteUint32(items.Count) ; foreach (object obj in items) { short innerType = Util.QMFType(obj) ; - lEnc.writeUint8(innerType) ; + lEnc.WriteUint8(innerType) ; this.EncodeValue(lEnc,innerType,obj) ; } - enc.writeVbin32(lEnc.segment().ToArray()) ; + enc.WriteVbin32(lEnc.Segment().ToArray()) ; break ; case 22: // Array List aItems = (List) val ; MSEncoder aEnc = new MSEncoder(1) ; - aEnc.init() ; + aEnc.Init() ; long aCount = aItems.Count ; - aEnc.writeUint32(aCount) ; + aEnc.WriteUint32(aCount) ; if (aCount > 0) { Object anObj = aItems[0] ; short innerType = Util.QMFType(anObj) ; - aEnc.writeUint8(innerType) ; + aEnc.WriteUint8(innerType) ; foreach (object obj in aItems) { this.EncodeValue(aEnc,innerType,obj) ; } } - enc.writeVbin32(aEnc.segment().ToArray()) ; + enc.WriteVbin32(aEnc.Segment().ToArray()) ; break ; default: throw new Exception(String.Format("Invalid Type Code: {0}", type)) ; @@ -804,15 +810,15 @@ namespace org.apache.qpid.console return (QMFObject) ci.Invoke(args) ; } - protected QMFObject CreateQMFObject(SchemaClass schema, Decoder dec, bool hasProperties, bool hasStats , bool isManaged) { + protected QMFObject CreateQMFObject(SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats , bool isManaged) { Type realClass = typeof(QMFObject) ; if (Console != null) { realClass = Console.TypeMapping(schema.Key) ; } - Type[] types = new Type[] {typeof(Session), typeof(SchemaClass), typeof(Decoder), typeof(bool), typeof(bool),typeof(bool)} ; + Type[] types = new Type[] {typeof(Session), typeof(SchemaClass), typeof(IDecoder), typeof(bool), typeof(bool),typeof(bool)} ; object[] args = new object[] {this, schema, dec, hasProperties, hasStats, isManaged} ; ConstructorInfo ci = realClass.GetConstructor(types); return (QMFObject) ci.Invoke(args) ; } } -} \ No newline at end of file +} diff --git a/qpid/dotnet/client-010/management/console/console.csproj b/qpid/dotnet/client-010/management/console/console.csproj index 6e1a4a5586..27e7360672 100644 --- a/qpid/dotnet/client-010/management/console/console.csproj +++ b/qpid/dotnet/client-010/management/console/console.csproj @@ -1,74 +1,81 @@ - + Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 - {42E3CD17-EFDC-4533-95AA-4AF67FF534B5} - Exe - console + {E8D2202F-3959-4F29-AA0D-875CD37905CA} + Library + Properties + Console + Console + v2.0 + 512 true full false - bin\Debug - DEBUG + bin\Debug\ + DEBUG;TRACE prompt 4 - none - false - bin\Release + pdbonly + true + bin\Release\ + TRACE prompt 4 - - - + + False + ..\..\lib\log4net\log4net.dll + + + + + - - - + + + + + + - + + - - - - - - - - - - - - False - - - False - - - False - - - False - + + {B911FFD7-754F-4735-A188-218D5065BE79} + Client + + + + - \ No newline at end of file + + + diff --git a/qpid/dotnet/client-010/management/console/console.sln b/qpid/dotnet/client-010/management/console/console.sln index 8c08a9a2ce..8555aa79cc 100644 --- a/qpid/dotnet/client-010/management/console/console.sln +++ b/qpid/dotnet/client-010/management/console/console.sln @@ -1,7 +1,9 @@  -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}" +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console.csproj", "{E8D2202F-3959-4F29-AA0D-875CD37905CA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "..\..\client\Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -9,12 +11,16 @@ Global 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 + {E8D2202F-3959-4F29-AA0D-875CD37905CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8D2202F-3959-4F29-AA0D-875CD37905CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8D2202F-3959-4F29-AA0D-875CD37905CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8D2202F-3959-4F29-AA0D-875CD37905CA}.Release|Any CPU.Build.0 = Release|Any CPU + {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 EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = console.csproj + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection EndGlobal diff --git a/qpid/dotnet/client-010/perftest/PerfTest.cs b/qpid/dotnet/client-010/perftest/PerfTest.cs index e7b1cb8ecd..c94dd865d5 100644 --- a/qpid/dotnet/client-010/perftest/PerfTest.cs +++ b/qpid/dotnet/client-010/perftest/PerfTest.cs @@ -35,15 +35,20 @@ namespace PerfTest [CommandLineManager(ApplicationName = "Qpid Perf Tests", Copyright = "Apache Software Foundation")] public class Options { - [CommandLineOption(Description = "Displays this help text")] public bool Help; + [CommandLineOption(Description = "Displays this help text")] + public bool Help; - [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] public Boolean Setup; + [CommandLineOption(Description = "Create shared queues.", MinOccurs = 0)] + public Boolean Setup; - [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] public Boolean Control; + [CommandLineOption(Description = "Run test, print report.", MinOccurs = 0)] + public Boolean Control; - [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] public Boolean Publish; + [CommandLineOption(Description = "Publish messages.", MinOccurs = 0)] + public Boolean Publish; - [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] public Boolean Subscribe; + [CommandLineOption(Description = "Subscribe for messages.", MinOccurs = 0)] + public Boolean Subscribe; [CommandLineOption(Description = "Test mode: [shared|fanout|topic]", MinOccurs = 0)] public string Mode @@ -113,14 +118,18 @@ namespace PerfTest private long _size = 1024; - [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] public Boolean Confirm = true; + [CommandLineOption(Description = "Publisher use confirm-mode.", MinOccurs = 0)] + public Boolean Confirm = true; - [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] public Boolean Durable; + [CommandLineOption(Description = "Publish messages as durable.", MinOccurs = 0)] + public Boolean Durable; - [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] public Boolean UniqueData; + [CommandLineOption(Description = "Make data for each message unique.", MinOccurs = 0)] + public Boolean UniqueData; [CommandLineOption(Description = "Wait for confirmation of each message before sending the next one.", - MinOccurs = 0)] public Boolean SyncPub; + MinOccurs = 0)] + public Boolean SyncPub; [CommandLineOption(Description = ">=0 delay between msg publish.", MinOccurs = 0)] public double IntervalPub @@ -192,8 +201,8 @@ namespace PerfTest private int _tx; - [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] public Boolean - QueueDurable; + [CommandLineOption(Description = "Make queue durable (implied if durable set.", MinOccurs = 0)] + public Boolean QueueDurable; [CommandLineOption(Description = "Queue policy: count to trigger 'flow to disk'", MinOccurs = 0)] public double QueueMaxCount @@ -229,11 +238,11 @@ namespace PerfTest public abstract class PerfTestClient : Startable { - private readonly Client _connection; - private readonly ClientSession _session; + private readonly IClient _connection; + private readonly IClientSession _session; private readonly Options _options; - public ClientSession Session + public IClientSession Session { get { return _session; } } @@ -247,8 +256,8 @@ namespace PerfTest { _options = options; _connection = new Client(); - _connection.connect(options.Broker, options.Port, "test", "guest", "guest"); - _session = _connection.createSession(50000); + _connection.Connect(options.Broker, options.Port, "test", "guest", "guest"); + _session = _connection.CreateSession(50000); } public abstract void Start(); @@ -263,10 +272,10 @@ namespace PerfTest private void queueInit(String name, Boolean durable, Dictionary arguments) { - Session.queueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); - Session.queuePurge(name); - Session.exchangeBind(name, "amq.direct", name); - Session.sync(); + Session.QueueDeclare(name, null, arguments, durable ? Option.DURABLE : Option.NONE); + Session.QueuePurge(name); + Session.ExchangeBind(name, "amq.direct", name); + Session.Sync(); } public override void Start() @@ -298,10 +307,10 @@ namespace PerfTest public SubscribeThread(Options options, string key, string exchange) : base(options) { - _queue = "perftest" + (new UUID(10, 10)).ToString(); - Session.queueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, + _queue = "perftest" + (new UUID(10, 10)); + Session.QueueDeclare(_queue, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE, Options.Durable ? Option.DURABLE : Option.NONE); - Session.exchangeBind(_queue, exchange, key); + Session.ExchangeBind(_queue, exchange, key); } public SubscribeThread(Options options, string key) @@ -314,34 +323,35 @@ namespace PerfTest { if (Options.Tx > 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } CircularBuffer buffer = new CircularBuffer(100); // Create a listener and subscribe it to the queue named "message_queue" IMessageListener listener = new SyncListener(buffer); - string dest = "dest" + UUID.randomUUID().ToString(); - Session.attachMessageListener(listener, dest); - Session.messageSubscribe(_queue, dest, + + string dest = "dest" + UUID.RandomUuid(); + Session.AttachMessageListener(listener, dest); + Session.MessageSubscribe(_queue, dest, Options.Tx > 0 || Options.SubAck > 0 ? MessageAcceptMode.EXPLICIT : MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, null, 0, null); // issue credits - Session.messageSetFlowMode(dest, MessageFlowMode.WINDOW); - Session.messageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); + Session.MessageSetFlowMode(dest, MessageFlowMode.WINDOW); + Session.MessageFlow(dest, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES); // Notify controller we are ready. IMessage message = new Message(); - message.DeliveryProperties.setRoutingKey("sub_ready"); + message.DeliveryProperties.SetRoutingKey("sub_ready"); - message.appendData(Encoding.UTF8.GetBytes("ready")); - Session.messageTransfer("amq.direct", message); + message.AppendData(Encoding.UTF8.GetBytes("ready")); + Session.MessageTransfer("amq.direct", message); if (Options.Tx > 0) { - Session.txCommit(); - Session.sync(); + Session.TxCommit(); + Session.Sync(); } @@ -349,7 +359,7 @@ namespace PerfTest { //need to allocate some more credit - Session.messageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); + Session.MessageFlow(dest, MessageCreditUnit.MESSAGE, (long)Options.SubQuota); RangeSet range = new RangeSet(); IMessage msg; @@ -359,37 +369,37 @@ namespace PerfTest msg = buffer.Dequeue(); if (Options.Tx > 0 && ((i + 1)%Options.Tx == 0)) { - Session.txCommit(); - Session.sync(); + Session.TxCommit(); + Session.Sync(); } if (Options.IntervalSub > 0) { Thread.Sleep((int) Options.IntervalSub*1000); } - range.add(msg.Id); + range.Add(msg.Id); } if (Options.Tx > 0 || Options.SubAck > 0) - Session.messageAccept(range); - range.clear(); + Session.MessageAccept(range); + range.Clear(); if (Options.Tx > 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } DateTime end = DateTime.Now; // Report to publisher. - message.DeliveryProperties.setRoutingKey("sub_done"); - message.clearData(); - message.appendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); - Session.messageTransfer("amq.direct", message); + message.DeliveryProperties.SetRoutingKey("sub_done"); + message.ClearData(); + message.AppendData(BitConverter.GetBytes(Options.SubQuota / end.Subtract(start).TotalMilliseconds )); + Session.MessageTransfer("amq.direct", message); if (Options.Tx > 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } } - Session.close(); + Session.Close(); } } @@ -402,7 +412,7 @@ namespace PerfTest _buffer = buffer; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { _buffer.Enqueue(m); } @@ -429,31 +439,31 @@ namespace PerfTest Random r = new Random(34); r.NextBytes(data); IMessage message = new Message(); - message.appendData(data); + message.AppendData(data); - message.DeliveryProperties.setRoutingKey(_key); + message.DeliveryProperties.SetRoutingKey(_key); if (Options.Durable) - message.DeliveryProperties.setDeliveryMode(MessageDeliveryMode.PERSISTENT); + message.DeliveryProperties.SetDeliveryMode(MessageDeliveryMode.PERSISTENT); if (Options.Tx > 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } CircularBuffer buffer = new CircularBuffer(100); // Create a listener and subscribe it to the queue named "pub_start" IMessageListener listener = new SyncListener(buffer); - string localQueue = "localQueue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", "pub_start"); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); + string localQueue = "localQueue-" + UUID.RandomUuid().ToString(); + Session.QueueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.ExchangeBind(localQueue, "amq.direct", "pub_start"); + Session.AttachMessageListener(listener, localQueue); + Session.MessageSubscribe(localQueue); if (Options.Tx > 0) { - Session.txCommit(); - Session.sync(); + Session.TxCommit(); + Session.Sync(); } buffer.Dequeue(); @@ -462,39 +472,39 @@ namespace PerfTest DateTime start = DateTime.Now; for (long i = 0; i < Options.Count; ++i) { - Session.messageTransfer(_exchange, message); + Session.MessageTransfer(_exchange, message); if (Options.SyncPub) { - Session.sync(); + Session.Sync(); } if (Options.Tx > 0 && (i + 1)%Options.Tx == 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } if (Options.IntervalPub > 0) { Thread.Sleep((int) Options.IntervalSub*1000); } } - Session.sync(); + Session.Sync(); DateTime end = DateTime.Now; // Report to publisher. - message.DeliveryProperties.setRoutingKey("pub_done"); - message.clearData(); + message.DeliveryProperties.SetRoutingKey("pub_done"); + message.ClearData(); double time = end.Subtract(start).TotalMilliseconds; byte[] rate = BitConverter.GetBytes( Options.Count / time ); - message.appendData(rate); - Session.messageTransfer("amq.direct", message); + message.AppendData(rate); + Session.MessageTransfer("amq.direct", message); if (Options.Tx > 0) { - Session.txSelect(); - Session.sync(); + Session.TxSelect(); + Session.Sync(); } } - Session.close(); + Session.Close(); } } @@ -509,11 +519,11 @@ namespace PerfTest { CircularBuffer buffer = new CircularBuffer(100); IMessageListener listener = new SyncListener(buffer); - string localQueue = "queue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", queue); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); + string localQueue = "queue-" + UUID.RandomUuid(); + Session.QueueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.ExchangeBind(localQueue, "amq.direct", queue); + Session.AttachMessageListener(listener, localQueue); + Session.MessageSubscribe(localQueue); for (int i = 0; i < size; ++i) { buffer.Dequeue(); @@ -524,34 +534,34 @@ namespace PerfTest { CircularBuffer buffer = new CircularBuffer(100); IMessageListener listener = new SyncListener(buffer); - string localQueue = "queue-" + UUID.randomUUID().ToString(); - Session.queueDeclare(localQueue, null, null, Option.AUTO_DELETE); - Session.exchangeBind(localQueue, "amq.direct", queue); - Session.attachMessageListener(listener, localQueue); - Session.messageSubscribe(localQueue); + string localQueue = "queue-" + UUID.RandomUuid(); + Session.QueueDeclare(localQueue, null, null, Option.AUTO_DELETE); + Session.ExchangeBind(localQueue, "amq.direct", queue); + Session.AttachMessageListener(listener, localQueue); + Session.MessageSubscribe(localQueue); double rate = 0; RangeSet range = new RangeSet(); for (int i = 0; i < size; ++i) { IMessage m = buffer.Dequeue(); - range.add(m.Id); + range.Add(m.Id); BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8); byte[] body = new byte[m.Body.Length - m.Body.Position]; reader.Read(body, 0, body.Length); rate += BitConverter.ToDouble(body,0); } - Session.messageAccept(range); + Session.MessageAccept(range); return rate; } private void send(int size, string queue, string data) { IMessage message = new Message(); - message.DeliveryProperties.setRoutingKey(queue); - message.appendData(Encoding.UTF8.GetBytes(data)); + message.DeliveryProperties.SetRoutingKey(queue); + message.AppendData(Encoding.UTF8.GetBytes(data)); for (int i = 0; i < size; ++i) { - Session.messageTransfer("amq.direct", message); + Session.MessageTransfer("amq.direct", message); } } diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj index 57e49cc954..34632d94a5 100644 --- a/qpid/dotnet/client-010/perftest/perftest.csproj +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {7F7E8DE7-FDF2-4A52-A4CE-D3756B05273C} Exe @@ -56,6 +56,11 @@ Client + + + App.config + + - \ 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 f5f338aebb..b917e17b49 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 8.0.50727 + 9.0.30729 2.0 {95CB4C90-7C53-44A9-B11C-96235F158ACA} Library @@ -64,6 +64,11 @@ Client + + + App.config + + - \ 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 18ab58599a..163e4cf49a 100644 --- a/qpid/dotnet/client-010/test/interop/Admin.cs +++ b/qpid/dotnet/client-010/test/interop/Admin.cs @@ -26,34 +26,34 @@ using org.apache.qpid.transport.util; namespace test.interop { - public class Admin:TestCase + public class Admin : TestCase { - private static readonly Logger _log = Logger.get(typeof(Admin)); + private static readonly Logger _log = Logger.Get(typeof(Admin)); [Test] public void createSession() { - _log.debug("Running: createSession"); - ClientSession ssn = Client.createSession(0); - ssn.close(); + _log.Debug("Running: CreateSession"); + IClientSession 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(); + _log.Debug("Running: queueLifecycle"); + IClientSession 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(); + ssn.ExchangeBind("queue1", "amq.direct", "queue1", null); + ssn.Sync(); } - catch (SessionException e) + catch (SessionException) { // as expected } @@ -63,25 +63,25 @@ namespace test.interop [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()); + _log.Debug("Running: exchangeCheck"); + IClientSession 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); + _log.Debug("Running: ExchangeBind"); + IClientSession 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 5dbb9e15e2..d932057fd2 100644 --- a/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs +++ b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs @@ -28,23 +28,23 @@ namespace test.interop { public class ApplicationHeaders:TestCase { - private static readonly Logger _log = Logger.get(typeof(ApplicationHeaders)); + 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(); + _log.Debug("Running: setHeaders"); + IClientSession ssn = Client.CreateSession(0); + ssn.QueueDeclare("queue1"); + ssn.ExchangeBind("queue1", "amq.direct", "queue1"); + ssn.Sync(); CircularBuffer buff = new CircularBuffer(10); SyncListener listener = new SyncListener(ssn, buff); - ssn.attachMessageListener(listener, "queue1"); - ssn.messageSubscribe("queue1"); + ssn.AttachMessageListener(listener, "queue1"); + ssn.MessageSubscribe("queue1"); IMessage message = new org.apache.qpid.client.Message(); - message.DeliveryProperties.setRoutingKey("queue1"); + message.DeliveryProperties.SetRoutingKey("queue1"); const long someLong = 14444444; message.ApplicationHeaders.Add("someLong", someLong); const int someInt = 14; @@ -63,7 +63,7 @@ namespace test.interop message.ApplicationHeaders.Add("someBoolean", someBoolean); // transfer the message - ssn.messageTransfer("amq.direct", message); + ssn.MessageTransfer("amq.direct", message); // get the message and check the headers IMessage messageBack = buff.Dequeue(); diff --git a/qpid/dotnet/client-010/test/interop/Message.cs b/qpid/dotnet/client-010/test/interop/Message.cs index 935978864c..107e69c287 100644 --- a/qpid/dotnet/client-010/test/interop/Message.cs +++ b/qpid/dotnet/client-010/test/interop/Message.cs @@ -30,38 +30,39 @@ namespace test.interop { public class Message : TestCase { - private static readonly Logger _log = Logger.get(typeof (Message)); + 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); + _log.Debug("Running: ExchangeBind"); + IClientSession 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())), + 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); + 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"); + _log.Debug("Running: sendAndReceiveSmallMessages"); byte[] smallMessage = Encoding.UTF8.GetBytes("test"); sendAndReceive(smallMessage, 100); } @@ -69,7 +70,7 @@ namespace test.interop [Test] public void sendAndReceiveLargeMessages() { - _log.debug("Running: sendAndReceiveSmallMessages"); + _log.Debug("Running: sendAndReceiveSmallMessages"); byte[] largeMessage = new byte[100 * 1024]; Random random = new Random(); random.NextBytes(largeMessage); @@ -79,7 +80,7 @@ namespace test.interop [Test] public void sendAndReceiveVeryLargeMessages() { - _log.debug("Running: sendAndReceiveSmallMessages"); + _log.Debug("Running: sendAndReceiveSmallMessages"); byte[] verylargeMessage = new byte[1000 * 1024]; Random random = new Random(); random.NextBytes(verylargeMessage); @@ -88,36 +89,36 @@ namespace test.interop 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); + IClientSession 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.AttachMessageListener(myListener, "myDest"); - ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null, + 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(); + 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())), + ssn.MessageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED, + new Header(new DeliveryProperties().SetRoutingKey("queue1"), + new MessageProperties().SetMessageId(UUID.RandomUuid())), messageBody); } - ssn.sync(); + ssn.Sync(); lock (myLock) { @@ -127,19 +128,19 @@ namespace test.interop } } Assert.IsTrue(myListener.Count == 0); - ssn.messageAccept(myListener.UnAck); - ssn.sync(); + ssn.MessageAccept(myListener.UnAck); + ssn.Sync(); // the queue should be empty - result = (QueueQueryResult)ssn.queueQuery("queue1").Result; - Assert.IsTrue(result.getMessageCount() == 0); - ssn.close(); + 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 static readonly Logger _log = Logger.Get(typeof (MyListener)); private readonly Object _wl; private int _count; private RangeSet _rs = new RangeSet(); @@ -150,11 +151,11 @@ namespace test.interop _count = count; } - public void messageTransfer(IMessage m) + 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); + _log.Debug("Got a message of size: " + body.Length + " count = " + _count); + _rs.Add(m.Id); lock (_wl) { _count--; diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs index 8e3f2a3085..99f81d9ff7 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -45,13 +45,13 @@ namespace test.interop { XmlConfigurator.Configure(new FileInfo("/log.xml")); // populate default properties - _properties.Add("UserName", "guest"); + _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"); + XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + "/Qpid Test.dll.config"); while (reader.Read()) { // if node type is an element @@ -70,15 +70,17 @@ namespace test.interop } // 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"]); + _client.Connect(Properties["Host"], Convert.ToInt16(Properties["Port"]), Properties["VirtualHost"], + Properties["Username"], Properties["Password"]); } [TestFixtureTearDown] public void Cleanup() { - _client.close(); + // Note : breaks the Resharper nunit test runner. It blocks on the Monitor.WaitAll() + // Certainly a problem with the threading context.. + //_client.Close(); } public Client Client @@ -94,22 +96,22 @@ namespace test.interop public class SyncListener : IMessageListener { - private static readonly Logger _log = Logger.get(typeof(SyncListener)); + private static readonly Logger _log = Logger.Get(typeof(SyncListener)); private readonly CircularBuffer _buffer; private readonly RangeSet _range = new RangeSet(); - private readonly ClientSession _session; + private readonly IClientSession _session; - public SyncListener(ClientSession session, CircularBuffer buffer) + public SyncListener(IClientSession session, CircularBuffer buffer) { _buffer = buffer; _session = session; } - public void messageTransfer(IMessage m) + public void MessageTransfer(IMessage m) { - _range.clear(); - _range.add(m.Id); - _session.messageAccept(_range); + _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 a92741143d..f3a05f1c3c 100644 --- a/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs @@ -29,12 +29,12 @@ namespace test.transport.util public class ByteEncoderTest { - private static readonly Logger _log = Logger.get(typeof(ByteEncoderTest)); + private static readonly Logger _log = Logger.Get(typeof(ByteEncoderTest)); [Test] public void GetBigEndianInt32() { - _log.debug("Running: GetBigEndianInt32"); + _log.Debug("Running: GetBigEndianInt32"); const int anInt = -12345; Int32 aNewInt = ByteEncoder.GetBigEndian(anInt); Assert.IsTrue( anInt == ByteEncoder.GetBigEndian(aNewInt) ); @@ -43,7 +43,7 @@ namespace test.transport.util [Test] public void GetBigEndianUInt16() { - _log.debug("Running: GetBigEndianUInt16"); + _log.Debug("Running: GetBigEndianUInt16"); const UInt16 anInt = 123; UInt16 aNewInt = ByteEncoder.GetBigEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); @@ -52,7 +52,7 @@ namespace test.transport.util [Test] public void GetBigEndianUInt32() { - _log.debug("Running: GetBigEndianUInt32"); + _log.Debug("Running: GetBigEndianUInt32"); const UInt32 anInt = 12345; UInt32 aNewInt = ByteEncoder.GetBigEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); @@ -61,7 +61,7 @@ namespace test.transport.util [Test] public void GetBigEndianlong() { - _log.debug("Running: GetBigEndianlong"); + _log.Debug("Running: GetBigEndianlong"); const long anInt = 123456660700770; long aNewInt = ByteEncoder.GetBigEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt)); @@ -70,7 +70,7 @@ namespace test.transport.util [Test] public void GetLittleEndianInt32() { - _log.debug("Running: GetBigEndianInt32"); + _log.Debug("Running: GetBigEndianInt32"); const int anInt = -12345; Int32 aNewInt = ByteEncoder.GetLittleEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); @@ -79,7 +79,7 @@ namespace test.transport.util [Test] public void GetLittleEndianUInt16() { - _log.debug("Running: GetLittleEndianUInt16"); + _log.Debug("Running: GetLittleEndianUInt16"); const UInt16 anInt = 123; UInt16 aNewInt = ByteEncoder.GetLittleEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); @@ -88,7 +88,7 @@ namespace test.transport.util [Test] public void GetLittleEndianUInt32() { - _log.debug("Running: GetLittleEndianUInt32"); + _log.Debug("Running: GetLittleEndianUInt32"); const UInt32 anInt = 12345; UInt32 aNewInt = ByteEncoder.GetLittleEndian(anInt); Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt)); @@ -97,7 +97,7 @@ namespace test.transport.util [Test] public void GetLittleEndianlong() { - _log.debug("Running: 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 3e61af2cd1..5e39569cf8 100644 --- a/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs @@ -32,12 +32,12 @@ namespace test.transport.util public class CircularBufferTest { private CircularBuffer _buf; - private static readonly Logger _log = Logger.get(typeof(CircularBufferTest)); + private static readonly Logger _log = Logger.Get(typeof(CircularBufferTest)); [Test] public void BlockingEnqueue() { - _log.debug("Running: BlockingEnqueue"); + _log.Debug("Running: BlockingEnqueue"); const int size = 10; _buf = new CircularBuffer(size); // add size element anc check that the size +1 add blocks @@ -60,7 +60,7 @@ namespace test.transport.util [Test] public void Close() { - _log.debug("Running: BlockingEnqueue"); + _log.Debug("Running: BlockingEnqueue"); const int size = 10; _buf = new CircularBuffer(size); // add size element anc check that the size +1 add blocks @@ -74,7 +74,7 @@ namespace test.transport.util Thread.Sleep(1000); // the trhead t should block until the buffer is closed Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin); - _buf.close(); + _buf.Close(); Thread.Sleep(100); // t should now be stopped Assert.IsTrue(t.ThreadState == ThreadState.Stopped); diff --git a/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs index 2dae4b318e..e8e011a1e9 100644 --- a/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs @@ -33,17 +33,17 @@ namespace test.transport.util [TestFixture] public class ResultFutureTest { - private static readonly Logger _log = Logger.get(typeof (ByteEncoderTest)); + private static readonly Logger _log = Logger.Get(typeof (ByteEncoderTest)); private static ResultFuture _future; [Test] public void getFutureTimeout() { - _log.debug("Running: getFutureTimeout"); + _log.Debug("Running: getFutureTimeout"); _future = new ResultFuture(); _future.Session = new Session(new byte[1]); DateTime start = DateTime.Now; - Struct result = _future.get(1000); + Struct result = _future.Get(1000); Assert.IsTrue(DateTime.Now.Subtract(start).TotalMilliseconds >= 1000); Assert.IsNull(result); } @@ -51,12 +51,12 @@ namespace test.transport.util [Test] public void getFuture() { - _log.debug("Running: 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); + Struct result = _future.Get(2000); Assert.IsNotNull(result); } @@ -70,27 +70,27 @@ namespace test.transport.util public class myStruct:Struct { - public override int getStructType() + public override int GetStructType() { throw new System.NotImplementedException(); } - public override int getSizeWidth() + public override int GetSizeWidth() { throw new System.NotImplementedException(); } - public override int getPackWidth() + public override int GetPackWidth() { throw new System.NotImplementedException(); } - public override void read(Decoder dec) + public override void Read(IDecoder dec) { throw new System.NotImplementedException(); } - public override void write(Encoder enc) + public override void Write(IEncoder enc) { 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 21a1209b00..772327c3b0 100644 --- a/qpid/dotnet/client-010/test/transport/util/SerialTest.cs +++ b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs @@ -26,7 +26,7 @@ namespace test.transport.util [TestFixture] public class SerialTest { - private static readonly Logger _log = Logger.get(typeof (SerialTest)); + private static readonly Logger _log = Logger.Get(typeof (SerialTest)); [Test] /// @@ -34,11 +34,11 @@ namespace test.transport.util /// public void testBoundaries() { - Assert.IsTrue(Serial.gt(1, 0)); - Assert.IsTrue(Serial.lt(0, 1)); + 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)); + Assert.IsTrue(Serial.Gt(int.MaxValue, int.MaxValue - 1)); + Assert.IsTrue(Serial.Lt(int.MaxValue - 1, int.MaxValue)); } /// @@ -57,8 +57,8 @@ namespace test.transport.util { for (int n = 1; n < 4096; n += 512) { - Assert.IsTrue(Serial.gt(s + n, s)); - Assert.IsTrue(Serial.lt(s, s + n)); + Assert.IsTrue(Serial.Gt(s + n, s)); + Assert.IsTrue(Serial.Lt(s, s + n)); } s += 1024; -- cgit v1.2.1 From 876fea5cfb56d2f10fe8cf4561956afd38bd11e7 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Fri, 4 Dec 2009 14:07:27 +0000 Subject: QPID-1987: missed adding App.config git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@887201 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/App.config | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 qpid/dotnet/client-010/App.config (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/App.config b/qpid/dotnet/client-010/App.config new file mode 100644 index 0000000000..36b4ffab3e --- /dev/null +++ b/qpid/dotnet/client-010/App.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + -- cgit v1.2.1 From 9eec95983e482eea09d43710ed6e4686d80a4f34 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Tue, 8 Dec 2009 01:02:15 +0000 Subject: Fix test config file. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@888207 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/default.build | 2 +- qpid/dotnet/client-010/test/Qpid Test.dll.config | 31 ++++++++++++++++++++++++ qpid/dotnet/client-010/test/test.config | 31 ------------------------ 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 qpid/dotnet/client-010/test/Qpid Test.dll.config delete mode 100644 qpid/dotnet/client-010/test/test.config (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/default.build b/qpid/dotnet/client-010/default.build index 5d6a4c581e..eb6ee371f7 100644 --- a/qpid/dotnet/client-010/default.build +++ b/qpid/dotnet/client-010/default.build @@ -207,7 +207,7 @@ - + diff --git a/qpid/dotnet/client-010/test/Qpid Test.dll.config b/qpid/dotnet/client-010/test/Qpid Test.dll.config new file mode 100644 index 0000000000..2a2fb72b61 --- /dev/null +++ b/qpid/dotnet/client-010/test/Qpid Test.dll.config @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/qpid/dotnet/client-010/test/test.config b/qpid/dotnet/client-010/test/test.config deleted file mode 100644 index 2a2fb72b61..0000000000 --- a/qpid/dotnet/client-010/test/test.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - -- cgit v1.2.1 From 8f574938e3c5d164823ae9bdc274bd13e6e29aae Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Tue, 8 Dec 2009 01:04:09 +0000 Subject: QPID-2237: Decode UUID properly patch by julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@888208 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs index 014fb82ef7..eb8bdae80a 100644 --- a/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs +++ b/qpid/dotnet/client-010/client/transport/codec/AbstractEncoder.cs @@ -49,6 +49,7 @@ namespace org.apache.qpid.transport.codec ENCODINGS.Add(typeof (Double), Code.DOUBLE); ENCODINGS.Add(typeof (char), Code.CHAR); ENCODINGS.Add(typeof (byte[]), Code.VBIN32); + ENCODINGS.Add(typeof (UUID), Code.UUID); } protected abstract void DoPut(byte b); -- cgit v1.2.1 From 5a63e55645834cf654db9a5c1367289c879330da Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Tue, 8 Dec 2009 01:05:24 +0000 Subject: QPID-2238: ToString calls itselfs causing stack overflow exception patch by julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@888209 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/transport/Connection.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/transport/Connection.cs b/qpid/dotnet/client-010/client/transport/Connection.cs index 74e3892b22..bd1509384c 100644 --- a/qpid/dotnet/client-010/client/transport/Connection.cs +++ b/qpid/dotnet/client-010/client/transport/Connection.cs @@ -163,10 +163,6 @@ namespace org.apache.qpid.transport { _sender.Close(); } - - public override String ToString() - { - return String.Format("conn:{0}", this); - } } + } -- cgit v1.2.1 From 3bc7e889caef716d8fdd8006f2d53b821ecef6c1 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 11 Dec 2009 13:52:48 +0000 Subject: QPID-2245 QMF protocol changes will make 0.6 incompatible with 0.5 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@889619 13f79535-47bb-0310-9956-ffa450edef68 --- .../dotnet/client-010/management/console/Broker.cs | 4 +-- .../client-010/management/console/SchemaClass.cs | 2 +- .../client-010/management/console/Session.cs | 32 ++-------------------- 3 files changed, 5 insertions(+), 33 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/management/console/Broker.cs b/qpid/dotnet/client-010/management/console/Broker.cs index 2d2bedf110..7684da9e12 100644 --- a/qpid/dotnet/client-010/management/console/Broker.cs +++ b/qpid/dotnet/client-010/management/console/Broker.cs @@ -165,7 +165,7 @@ namespace org.apache.qpid.console public IEncoder SetHeader(IEncoder enc, char opcode, long sequence) { enc.WriteUint8((short)'A') ; enc.WriteUint8((short)'M') ; - enc.WriteUint8((short)'3') ; + enc.WriteUint8((short)'2') ; enc.WriteUint8((short)opcode) ; enc.WriteUint32(sequence) ; return enc ; @@ -219,7 +219,7 @@ namespace org.apache.qpid.console return returnValue ; } character = (char) decoder.ReadUint8() ; - if (character != '3') { + if (character != '2') { return returnValue ; } returnValue = true ; diff --git a/qpid/dotnet/client-010/management/console/SchemaClass.cs b/qpid/dotnet/client-010/management/console/SchemaClass.cs index 653221034d..320312b61d 100644 --- a/qpid/dotnet/client-010/management/console/SchemaClass.cs +++ b/qpid/dotnet/client-010/management/console/SchemaClass.cs @@ -60,7 +60,7 @@ namespace org.apache.qpid.console Kind = kind ; Session = session ; this.Key = key ; - bool hasSupertype = !(dec.ReadUint8().Equals(0)) ; + bool hasSupertype = false ; if (kind == CLASS_KIND_TABLE) { int propCount = dec.ReadUint16() ; diff --git a/qpid/dotnet/client-010/management/console/Session.cs b/qpid/dotnet/client-010/management/console/Session.cs index cdc30e482b..d9c5948e57 100644 --- a/qpid/dotnet/client-010/management/console/Session.cs +++ b/qpid/dotnet/client-010/management/console/Session.cs @@ -616,21 +616,7 @@ namespace org.apache.qpid.console case 12: return dec.ReadFloat() ; // float case 13: return dec.ReadDouble() ; // double case 14: return dec.ReadUuid() ; // UUID - case 15: // Ftable - Dictionary ftable = new Dictionary() ; - MSDecoder sc = new MSDecoder() ; - sc.Init(new MemoryStream(dec.ReadVbin32())) ; - if (sc.HasRemaining()) { - long count = sc.ReadUint32() ; - while (count > 0) { - string key = sc.ReadStr8() ; - short code = sc.ReadUint8() ; - object newValue = this.DecodeValue(sc, code) ; - ftable.Add(key, newValue) ; - count -= 1 ; - } - } - return ftable ; + case 15: return dec.ReadMap() ; // Ftable case 16: return dec.ReadInt8() ; // int8 case 17: return dec.ReadInt16() ; // int16 case 18: return dec.ReadInt32() ; // int32 @@ -709,21 +695,7 @@ namespace org.apache.qpid.console case 12: enc.WriteFloat((float) val); break; // FLOAT case 13: enc.WriteDouble((double) val); break; // DOUBLE case 14: enc.WriteUuid((UUID) val) ; break ; // UUID - case 15: // Ftable - Dictionary ftable = (Dictionary) val ; - MSEncoder sc = new MSEncoder(1) ; - sc.Init() ; - sc.WriteUint32(ftable.Count) ; - foreach (String key in ftable.Keys) { - object obj = ftable[key] ; - short innerType = Util.QMFType(obj) ; - sc.WriteStr8(key) ; - sc.WriteUint8(innerType) ; - this.EncodeValue(sc,innerType,obj) ; - } - byte[] bytes = sc.Segment().ToArray() ; - enc.WriteVbin32(bytes) ; - break ; + case 15: enc.WriteMap((Dictionary) val) ; break ; // Ftable case 16: enc.WriteInt8((short) val) ; break; // int8 case 17: enc.WriteInt16((int) val) ; break; // int16 case 18: enc.WriteInt32(long.Parse(""+ val)) ; break; // int32 -- cgit v1.2.1 From 7f9ed6e2b0f36ecaaecddaf70c8647b1fa9d1db9 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Tue, 22 Dec 2009 20:59:57 +0000 Subject: QPID-2239: make sure the close() does not hand. Also handle authentication failures properly, QPID-2240. Patch by julien.lavigne git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@893315 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Client.cs | 36 ++++++++++--- .../client/client/ClientConnectionDelegate.cs | 29 +++++++---- qpid/dotnet/client-010/client/client/IClient.cs | 10 +++- qpid/dotnet/client-010/client/transport/Channel.cs | 4 +- .../client-010/client/transport/ClientDelegate.cs | 2 +- .../client-010/client/transport/Connection.cs | 2 +- .../client/transport/ConnectionDelegate.cs | 10 ++-- .../client/transport/network/Assembler.cs | 56 +++++--------------- .../client/transport/network/InputHandler.cs | 24 ++------- .../client/transport/network/io/IoReceiver.cs | 6 +-- .../client/transport/network/io/IoSSLTransport.cs | 4 +- .../client/transport/network/io/IoTransport.cs | 6 +-- .../client-010/test/Helpers/ConfigHelpers.cs | 44 ++++++++++++++++ qpid/dotnet/client-010/test/Test.csproj | 4 +- .../client-010/test/interop/ConnectionTests.cs | 59 ++++++++++++++++++++++ qpid/dotnet/client-010/test/interop/TestCase.cs | 31 ++---------- 16 files changed, 199 insertions(+), 128 deletions(-) create mode 100644 qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs create mode 100644 qpid/dotnet/client-010/test/interop/ConnectionTests.cs (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 1b87a3d578..864cf65186 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -34,11 +34,18 @@ namespace org.apache.qpid.client private readonly Object _closeOK; private IClosedListener _closedListner; + public event EventHandler ExceptionRaised; + public event EventHandler ConnectionLost; public bool IsClosed { get { return _isClosed; } - set { _isClosed = value; } + set + { + _isClosed = value; + if(_isClosed && ConnectionLost != null) + ConnectionLost(this, EventArgs.Empty); + } } public Object CloseOk @@ -67,14 +74,20 @@ namespace org.apache.qpid.client { _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); + ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); ManualResetEvent negotiationComplete = new ManualResetEvent(false); - connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.SetCondition(negotiationComplete); connectionDelegate.VirtualHost = virtualHost; _conn = IoTransport.Connect(host, port, connectionDelegate); _conn.Send(new ProtocolHeader(1, 0, 10)); negotiationComplete.WaitOne(); + + if (connectionDelegate.Exception != null) + throw connectionDelegate.Exception; + + connectionDelegate.SetCondition(null); + } /// @@ -93,15 +106,20 @@ namespace org.apache.qpid.client { _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); + _log.Debug(String.Format("SSL paramters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted)); + ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); ManualResetEvent negotiationComplete = new ManualResetEvent(false); - connectionDelegate.setCondition(negotiationComplete); + connectionDelegate.SetCondition(negotiationComplete); connectionDelegate.VirtualHost = virtualHost; _conn = IoSSLTransport.Connect(host, port, serverName, certPath, rejectUntrusted, connectionDelegate); _conn.Send(new ProtocolHeader(1, 0, 10)); negotiationComplete.WaitOne(); + + if (connectionDelegate.Exception != null) + throw connectionDelegate.Exception; + + connectionDelegate.SetCondition(null); } public void Close() @@ -142,5 +160,11 @@ namespace org.apache.qpid.client } #endregion + + public void RaiseException(Exception exception) + { + if (ExceptionRaised != null) + ExceptionRaised(this, new ExceptionArgs(exception)); + } } } diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index fff65673bc..9999f5312d 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -33,6 +33,7 @@ namespace org.apache.qpid.client private readonly Client _client; private string _username; private string _password; + private Exception _exception; public ClientConnectionDelegate(Client client, string username, string pasword) { @@ -41,14 +42,24 @@ namespace org.apache.qpid.client _password = pasword; } + public Exception Exception + { + get { return _exception; } + } + public override SessionDelegate GetSessionDelegate() { return new ClientSessionDelegate(); } - public override void Exception(Exception t) + public override void RaiseException(Exception exception) { - throw t; + _exception = exception; + + if (_negotiationComplete != null) + _negotiationComplete.Set(); + else + _client.RaiseException(exception); } public override void ConnectionStart(Channel context, ConnectionStart mystruct) @@ -78,7 +89,7 @@ namespace org.apache.qpid.client catch (Exception e) { throw new SystemException("Error when closing client", e); - } + } } } @@ -86,12 +97,12 @@ namespace org.apache.qpid.client { 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); + + if(_client.ClosedListener != null) + _client.ClosedListener.OnClosed(errorCode, connectionClose.GetReplyText(), null); + + if (errorCode.Code != (int)QpidErrorCode.NO_ERROR) + throw new Exception ("Server Closed the connection: Reason " + connectionClose.GetReplyText()); } } } diff --git a/qpid/dotnet/client-010/client/client/IClient.cs b/qpid/dotnet/client-010/client/client/IClient.cs index a9da74a840..6fe4a4d4b8 100644 --- a/qpid/dotnet/client-010/client/client/IClient.cs +++ b/qpid/dotnet/client-010/client/client/IClient.cs @@ -18,6 +18,7 @@ */ using System; +using org.apache.qpid.transport; namespace org.apache.qpid.client { @@ -49,13 +50,18 @@ namespace org.apache.qpid.client /// A newly created (suspended) session. IClientSession CreateSession(long expiryInSeconds); + + event EventHandler ExceptionRaised; + event EventHandler ConnectionLost; + /// - /// If the communication layer detects a serious problem with a connection, it - // informs the client's ClosedListener + /// If the broker sends a disconnect message, it will notify the ClosedListener /// /// IClosedListener ClosedListener { set; } + + bool IsClosed { get; set; } /// diff --git a/qpid/dotnet/client-010/client/transport/Channel.cs b/qpid/dotnet/client-010/client/transport/Channel.cs index 1742c05a3d..48ba707182 100644 --- a/qpid/dotnet/client-010/client/transport/Channel.cs +++ b/qpid/dotnet/client-010/client/transport/Channel.cs @@ -64,7 +64,7 @@ namespace org.apache.qpid.transport public void Init(Object v, ProtocolHeader hdr) { - _connection.ConnectionDelegate.init(this, hdr); + _connection.ConnectionDelegate.Init(this, hdr); } public void Control(Object v, Method method) @@ -171,4 +171,4 @@ namespace org.apache.qpid.transport return String.Format("{0}:{1}", _connection, _channel); } } -} +} \ 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 865cc6df20..957324ad41 100644 --- a/qpid/dotnet/client-010/client/transport/ClientDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ClientDelegate.cs @@ -24,7 +24,7 @@ namespace org.apache.qpid.transport { abstract class ClientDelegate : ConnectionDelegate { - public override void init(Channel ch, ProtocolHeader hdr) + public override void Init(Channel ch, ProtocolHeader hdr) { if (hdr.Major != 0 && hdr.Minor != 10) { diff --git a/qpid/dotnet/client-010/client/transport/Connection.cs b/qpid/dotnet/client-010/client/transport/Connection.cs index bd1509384c..b97357a96b 100644 --- a/qpid/dotnet/client-010/client/transport/Connection.cs +++ b/qpid/dotnet/client-010/client/transport/Connection.cs @@ -130,7 +130,7 @@ namespace org.apache.qpid.transport public void On_ReceivedException(Object sender, ExceptionArgs arg) { - _connDdelegate.Exception(arg.Exception); + _connDdelegate.RaiseException(arg.Exception); } public void On_ReceivedClosed(Object sender, EventArgs arg) diff --git a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs index 825909645d..5d491bc06f 100644 --- a/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/transport/ConnectionDelegate.cs @@ -35,20 +35,20 @@ namespace org.apache.qpid.transport private static readonly Logger log = Logger.Get(typeof(ConnectionDelegate)); private String _virtualHost; - private ManualResetEvent _negotiationComplete; + protected ManualResetEvent _negotiationComplete; public abstract SessionDelegate GetSessionDelegate(); - public abstract void Exception(Exception t); + public abstract void RaiseException(Exception t); public abstract void Closed(); - public void setCondition(ManualResetEvent negotiationComplete) + public void SetCondition(ManualResetEvent negotiationComplete) { _negotiationComplete = negotiationComplete; } - public virtual void init(Channel ch, ProtocolHeader hdr) + public virtual void Init(Channel ch, ProtocolHeader hdr) { ch.Connection.Send(new ProtocolHeader((byte)1, hdr.Major, hdr.Minor)); List plain = new List(); @@ -105,4 +105,4 @@ namespace org.apache.qpid.transport ch.ConnectionCloseOk(); } } -} +} \ 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 ac8f48567f..ff85f11c2f 100644 --- a/qpid/dotnet/client-010/client/transport/network/Assembler.cs +++ b/qpid/dotnet/client-010/client/transport/network/Assembler.cs @@ -42,8 +42,11 @@ namespace org.apache.qpid.transport.network // the event raised when a buffer is read from the wire public event EventHandler> ReceivedEvent; - public event EventHandler ExceptionProcessing; - public event EventHandler HandlerClosed; + public event EventHandler Closed; + + + // Not in use : + public event EventHandler Exception; event EventHandler> IReceiver>.Received { @@ -63,42 +66,6 @@ namespace org.apache.qpid.transport.network } } - event EventHandler IReceiver>.Exception - { - add - { - lock (m_objectLock) - { - ExceptionProcessing += value; - } - } - remove - { - lock (m_objectLock) - { - ExceptionProcessing -= value; - } - } - } - - event EventHandler IReceiver>.Closed - { - add - { - lock (m_objectLock) - { - HandlerClosed += value; - } - } - remove - { - lock (m_objectLock) - { - HandlerClosed -= value; - } - } - } - public Assembler() { segments = new Dictionary>(); @@ -267,16 +234,21 @@ namespace org.apache.qpid.transport.network log.Debug("Assembler: protocol event:", protevent); ReceivedPayload payload = new ReceivedPayload(); payload.Payload = protevent; - if (ReceivedEvent != null) + + if (protevent is ConnectionCloseOk) { - ReceivedEvent(this, payload); + if (Closed != null) + Closed(this, EventArgs.Empty); } else { - log.Debug("No listener for event: {0}", 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/InputHandler.cs b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs index 1872b9a111..c5d5f13727 100644 --- a/qpid/dotnet/client-010/client/transport/network/InputHandler.cs +++ b/qpid/dotnet/client-010/client/transport/network/InputHandler.cs @@ -44,7 +44,9 @@ namespace org.apache.qpid.transport.network // the event raised when a buffer is read from the wire public event EventHandler> ReceivedEvent; public event EventHandler ExceptionProcessing; - public event EventHandler HandlerClosed; + + // Not in used... This even is never raised in the code => the application will block on Close() until the timeout is reached + public event EventHandler Closed; event EventHandler> IReceiver>.Received { @@ -82,24 +84,6 @@ namespace org.apache.qpid.transport.network } } - event EventHandler IReceiver>.Closed - { - add - { - lock (m_objectLock) - { - HandlerClosed += value; - } - } - remove - { - lock (m_objectLock) - { - HandlerClosed -= value; - } - } - } - private State state; private MemoryStream input; private int needed; @@ -279,4 +263,4 @@ namespace org.apache.qpid.transport.network #endregion } -} +} \ No newline at end of file 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 97f8a7d3cd..b60444fa29 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoReceiver.cs @@ -166,10 +166,6 @@ namespace org.apache.qpid.transport.network.io } log.Debug("Receiver thread terminating"); } - catch (IOException) - { - // IOException is thrown when the socket is Closed according to the docs - } catch (Exception t) { if (ExceptionReading != null) @@ -186,4 +182,4 @@ namespace org.apache.qpid.transport.network.io } } } -} +} \ 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 82b42f2bfe..8b36693bc2 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs @@ -62,11 +62,9 @@ namespace org.apache.qpid.transport.network.io inputHandler.ReceivedEvent += assembler.On_ReceivedEvent; // Connection listen to asembler protocol event Receiver.Closed += Connection.On_ReceivedClosed; + assembler.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; } 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 af754ea57f..483e5428b8 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoTransport.cs @@ -65,11 +65,9 @@ namespace org.apache.qpid.transport.network.io inputHandler.ReceivedEvent += assembler.On_ReceivedEvent; // Connection listen to asembler protocol event Receiver.Closed += Connection.On_ReceivedClosed; + assembler.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; } @@ -140,4 +138,4 @@ namespace org.apache.qpid.transport.network.io #endregion } -} +} \ No newline at end of file diff --git a/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs new file mode 100644 index 0000000000..92374b5c41 --- /dev/null +++ b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using log4net.Config; + +namespace test.Helpers +{ + class ConfigHelpers + { + public static Dictionary LoadConfig() + { + Dictionary properties = new Dictionary(); + + 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 + "/Qpid Test.dll.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")); + } + } + } + + return properties; + } + } +} diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index b917e17b49..7bb6eaa999 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -47,6 +47,8 @@ + + @@ -77,4 +79,4 @@ --> - + \ No newline at end of file diff --git a/qpid/dotnet/client-010/test/interop/ConnectionTests.cs b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs new file mode 100644 index 0000000000..0c2ea8a648 --- /dev/null +++ b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs @@ -0,0 +1,59 @@ +using System; +using System.Net.Sockets; +using NUnit.Framework; +using org.apache.qpid.client; +using test.Helpers; + +namespace test +{ + [TestFixture] + public class ConnectionTests + { + [SetUp] + public void Setup() + { + + } + + [Test] + [ExpectedException(typeof(Exception))] + public void should_raise_exception_in_calling_thread_on_authentification_failure() + { + var properties = ConfigHelpers.LoadConfig(); + + var client = new Client(); + client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], + properties["Username"], "some silly password to make sure the authentification fail"); + } + + [Test] + [ExpectedException(typeof(Exception))] + public void should_raise_exception_in_calling_thread_on_authentification_failure_with_clodedListener() + { + var properties = ConfigHelpers.LoadConfig(); + + var client = new Client(); + client.ClosedListener = new FakeListener(); + client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], + properties["Username"], "some silly password to make sure the authentification fail"); + } + + [Test] + public void should_not_block_on_close() + { + var properties = ConfigHelpers.LoadConfig(); + + var client = new Client(); + client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], + properties["Username"], properties["Password"]); + client.Close(); + } + } + + public class FakeListener : IClosedListener + { + public void OnClosed(ErrorCode errorCode, string reason, Exception t) + { + } + } +} diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs index 99f81d9ff7..867f082000 100644 --- a/qpid/dotnet/client-010/test/interop/TestCase.cs +++ b/qpid/dotnet/client-010/test/interop/TestCase.cs @@ -30,6 +30,7 @@ using NUnit.Framework; using org.apache.qpid.client; using org.apache.qpid.transport; using org.apache.qpid.transport.util; +using test.Helpers; namespace test.interop { @@ -43,35 +44,11 @@ namespace test.interop [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 + "/Qpid Test.dll.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")); - } - - } - } + var properties = ConfigHelpers.LoadConfig(); // 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"]); + _client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], + properties["Username"], properties["Password"]); } -- cgit v1.2.1 From 8618b7e45ba6b0f74b27c68d2bcf94cd57f15758 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Fri, 12 Feb 2010 22:30:38 +0000 Subject: I have added the license header to the files included in this commit. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@909641 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/client/client/IClientSession.cs | 21 +++++++++++++++++++++ qpid/dotnet/client-010/client/transport/ISession.cs | 21 +++++++++++++++++++++ .../demo/Properties/Resources.Designer.cs | 21 +++++++++++++++++++++ .../client-010/demo/Properties/Settings.Designer.cs | 21 +++++++++++++++++++++ .../dotnet/client-010/management/console/XMLUtil.cs | 21 +++++++++++++++++++++ .../dotnet/client-010/test/Helpers/ConfigHelpers.cs | 21 +++++++++++++++++++++ .../client-010/test/interop/ConnectionTests.cs | 21 +++++++++++++++++++++ 7 files changed, 147 insertions(+) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/IClientSession.cs b/qpid/dotnet/client-010/client/client/IClientSession.cs index b8bc7e4db8..8667db1fb4 100644 --- a/qpid/dotnet/client-010/client/client/IClientSession.cs +++ b/qpid/dotnet/client-010/client/client/IClientSession.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; diff --git a/qpid/dotnet/client-010/client/transport/ISession.cs b/qpid/dotnet/client-010/client/transport/ISession.cs index 257b42b455..e843095df6 100644 --- a/qpid/dotnet/client-010/client/transport/ISession.cs +++ b/qpid/dotnet/client-010/client/transport/ISession.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; diff --git a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs index 761056a770..912f9e5b81 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Resources.Designer.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs index 6bf34e7ce0..fc41e577fe 100644 --- a/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs +++ b/qpid/dotnet/client-010/demo/Properties/Settings.Designer.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/qpid/dotnet/client-010/management/console/XMLUtil.cs b/qpid/dotnet/client-010/management/console/XMLUtil.cs index 255b9c4dd1..b24ad51747 100644 --- a/qpid/dotnet/client-010/management/console/XMLUtil.cs +++ b/qpid/dotnet/client-010/management/console/XMLUtil.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; diff --git a/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs index 92374b5c41..883e52c264 100644 --- a/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs +++ b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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; diff --git a/qpid/dotnet/client-010/test/interop/ConnectionTests.cs b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs index 0c2ea8a648..37fd0e7933 100644 --- a/qpid/dotnet/client-010/test/interop/ConnectionTests.cs +++ b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.Net.Sockets; using NUnit.Framework; -- cgit v1.2.1 From 20d520e4d47de046d789c8e25c35b6104a575fb0 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 24 Aug 2010 11:07:58 +0000 Subject: QPID-1392: Committed patch from Elena Nee and Jakub Scholz for SASL EXTERNAL support git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@988482 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/client-010/client/client/Client.cs | 63 +++++++++++------ .../client/client/ClientConnectionDelegate.cs | 36 +++++++--- qpid/dotnet/client-010/client/client/IClient.cs | 5 +- .../client/transport/network/io/IoSSLTransport.cs | 79 ++++++++++++++++------ .../client/transport/network/io/IoSender.cs | 7 +- 5 files changed, 137 insertions(+), 53 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/client/client/Client.cs b/qpid/dotnet/client-010/client/client/Client.cs index 864cf65186..fc9ff22191 100644 --- a/qpid/dotnet/client-010/client/client/Client.cs +++ b/qpid/dotnet/client-010/client/client/Client.cs @@ -22,6 +22,7 @@ using System.Threading; using org.apache.qpid.transport; using org.apache.qpid.transport.network.io; using org.apache.qpid.transport.util; +using System.Security.Cryptography.X509Certificates; namespace org.apache.qpid.client { @@ -35,6 +36,7 @@ namespace org.apache.qpid.client private IClosedListener _closedListner; public event EventHandler ExceptionRaised; + public event EventHandler ConnectionOpenOK; public event EventHandler ConnectionLost; public bool IsClosed @@ -61,6 +63,11 @@ namespace org.apache.qpid.client #region Interface IClient + public void Connect(String host, int port, String virtualHost, String username, String password) + { + Connect(host, port, virtualHost, username, password, "PLAIN"); + } + /// /// Establishes a connection with a broker using the provided user auths /// @@ -70,11 +77,12 @@ namespace org.apache.qpid.client /// virtual host name /// User Name /// Password - public void Connect(String host, int port, String virtualHost, String username, String password) + /// SASL authentication mechanism, possible values: PLAIN, EXTERNAL, DIGEST-MD5, ANONYMOUS + public void Connect(String host, int port, String virtualHost, String username, String password, String mechanism) { - _log.Debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}", host, - port, virtualHost, username)); - ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password); + _log.Debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}; mechanism {4}", + host, port, virtualHost, username, mechanism)); + ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(this, username, password, mechanism); ManualResetEvent negotiationComplete = new ManualResetEvent(false); connectionDelegate.SetCondition(negotiationComplete); connectionDelegate.VirtualHost = virtualHost; @@ -99,27 +107,36 @@ namespace org.apache.qpid.client /// virtual host name /// User Name /// Password + /// SASL authentication mechanism, possible values: PLAIN, EXTERNAL, DIGEST-MD5, ANONYMOUS /// Name of the SSL server /// Path to the X509 certificate to be used for client authentication + /// Password to certificate file, pass null if no password is required /// If true connection will not be established if the broker is not trusted - public void ConnectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted) + public void ConnectSSL(String host, int port, String virtualHost, String username, String password, String mechanism, string serverName, string certPath, String certPass, 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)); - ClientConnectionDelegate 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(); + _log.Debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}; mechanism {4}", + host, port, virtualHost, username, mechanism)); + _log.Debug(String.Format("SSL parameters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted)); + _conn = IoSSLTransport.Connect(host, port, virtualHost, mechanism, serverName, certPath, certPass, rejectUntrusted, this); + } - if (connectionDelegate.Exception != null) - throw connectionDelegate.Exception; + /// + /// Establishes a connection with a broker using SSL + /// + /// + /// Host name on which a broker is deployed + /// Broker port + /// SASL authentication mechanism, possible values: PLAIN, EXTERNAL, DIGEST-MD5, ANONYMOUS + /// X509 certificate to be used for client authentication + /// If true connection will not be established if the broker is not trusted + public void ConnectSSL(String host, int port, String mechanism, X509Certificate certificate, bool rejectUntrusted) + { + _log.Debug(String.Format("Client Connecting to host {0}; port {1}; mechanism {2}", + host, port, mechanism)); + _log.Debug(String.Format("SSL parameters: certSubject: {0}; rejectUntrusted: {1}", + certificate.Subject, rejectUntrusted)); - connectionDelegate.SetCondition(null); + _conn = IoSSLTransport.Connect(host, port, mechanism, certificate, rejectUntrusted, this); } public void Close() @@ -166,5 +183,13 @@ namespace org.apache.qpid.client if (ExceptionRaised != null) ExceptionRaised(this, new ExceptionArgs(exception)); } + + internal void ConnectionOpenOk(Channel context, ConnectionOpenOk mstruct) + { + if (ConnectionOpenOK != null) + { + ConnectionOpenOK(this, new EventArgs()); + } + } } } diff --git a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs index 9999f5312d..83aac80e83 100644 --- a/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs +++ b/qpid/dotnet/client-010/client/client/ClientConnectionDelegate.cs @@ -33,6 +33,9 @@ namespace org.apache.qpid.client private readonly Client _client; private string _username; private string _password; + + // PLAIN SASL mechanism by default + private string _mechanism = "PLAIN"; private Exception _exception; public ClientConnectionDelegate(Client client, string username, string pasword) @@ -42,6 +45,12 @@ namespace org.apache.qpid.client _password = pasword; } + public ClientConnectionDelegate(Client client, string username, string pasword, string mechanism) + : this(client, username, pasword) + { + _mechanism = mechanism; + } + public Exception Exception { get { return _exception; } @@ -64,16 +73,27 @@ namespace org.apache.qpid.client 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); + + // do not send username and password for EXTERNAL mechanism, + // because they are inside a certificate file + if (_mechanism != "EXTERNAL") + { + 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 props = new Dictionary(); - context.ConnectionStartOk(props, mechanism, stResponse.ToArray(), "utf8"); + context.ConnectionStartOk(props, _mechanism, stResponse.ToArray(), "utf8"); + } + + public override void ConnectionOpenOk(Channel context, ConnectionOpenOk mstruct) + { + base.ConnectionOpenOk(context, mstruct); + _client.ConnectionOpenOk(context, mstruct); } public override void Closed() diff --git a/qpid/dotnet/client-010/client/client/IClient.cs b/qpid/dotnet/client-010/client/client/IClient.cs index 6fe4a4d4b8..b7b6c26957 100644 --- a/qpid/dotnet/client-010/client/client/IClient.cs +++ b/qpid/dotnet/client-010/client/client/IClient.cs @@ -33,7 +33,8 @@ namespace org.apache.qpid.client /// virtualHost the virtual host name /// username user name /// password password - void Connect(String host, int port, String virtualHost, String username, String passwor); + void Connect(String host, int port, String virtualHost, String username, String password, String mechanism); + void Connect(String host, int port, String virtualHost, String username, String password); /// /// Close this client @@ -76,6 +77,6 @@ namespace org.apache.qpid.client /// Name of the SSL server /// Path to the X509 certificate to be used for client authentication /// If true connection will not be established if the broker is not trusted - void ConnectSSL(String host, int port, String virtualHost, String username, String password, string serverName, string certPath, bool rejectUntrusted); + void ConnectSSL(String host, int port, String virtualHost, String username, String password, String mechanism, string serverName, string certPath, String certPass, bool rejectUntrusted); } } 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 8b36693bc2..b6c7940a1d 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSSLTransport.cs @@ -22,7 +22,10 @@ using System.Net.Security; using System.Net.Sockets; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; +using System.Threading; + using org.apache.qpid.transport.util; +using org.apache.qpid.client; namespace org.apache.qpid.transport.network.io { @@ -41,16 +44,48 @@ namespace org.apache.qpid.transport.network.io 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 static Connection Connect(String host, int port, String mechanism, X509Certificate certificate, bool rejectUntrusted, Client client) + { + ClientConnectionDelegate connectionDelegate = new ClientConnectionDelegate(client, string.Empty, string.Empty, mechanism); + ManualResetEvent negotiationComplete = new ManualResetEvent(true); + connectionDelegate.SetCondition(negotiationComplete); + connectionDelegate.VirtualHost = string.Empty; + + IIoTransport transport = new IoSSLTransport(host, port, certificate, rejectUntrusted, connectionDelegate); + + Connection _conn = transport.Connection; + _conn.Send(new ProtocolHeader(1, 0, 10)); + negotiationComplete.WaitOne(); + + if (connectionDelegate.Exception != null) + throw connectionDelegate.Exception; + + connectionDelegate.SetCondition(null); + + return _conn; + } + + public static Connection Connect(String host, int port, String virtualHost, String mechanism, string serverName, string certPath, String certPass, bool rejectUntrusted, Client client) + { + // create certificate object based on whether or not password is null + X509Certificate cert; + if (certPass != null) + { + cert = new X509Certificate2(certPath, certPass); + } + else + { + cert = X509Certificate.CreateFromCertFile(certPath); + } + + return Connect(host, port, mechanism, cert, rejectUntrusted, client); } - public IoSSLTransport(String host, int port, string serverName, string certPath, bool rejectUntrusted, ConnectionDelegate conndel) + public IoSSLTransport(String host, int port, X509Certificate certificate, bool rejectUntrusted, ConnectionDelegate conndel) { _rejectUntrusted = rejectUntrusted; - CreateSocket(host, port, serverName, certPath); + CreateSocket(host, port); + CreateSSLStream(host, Socket, certificate); Sender = new IoSender(this, QUEUE_SIZE, TIMEOUT); Receiver = new IoReceiver(Stream, Socket.ReceiveBufferSize*2, TIMEOUT); Assembler assembler = new Assembler(); @@ -101,7 +136,7 @@ namespace org.apache.qpid.transport.network.io #region Private Support Functions - private void CreateSocket(String host, int port, string serverName, string certPath) + private void CreateSocket(String host, int port) { TcpClient socket; try @@ -128,23 +163,21 @@ namespace org.apache.qpid.transport.network.io } catch (Exception e) { - throw new TransportException("Error connecting to broker", e); + throw new TransportException(string.Format("Error connecting to broker: {0}", e.Message)); } + } + + private void CreateSSLStream(String host, TcpClient socket, X509Certificate certificate) + { 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); - } + SslStream sslStream = new SslStream(socket.GetStream(), false, ValidateServerCertificate, LocalCertificateSelection); + + X509CertificateCollection certCol = new X509CertificateCollection(); + certCol.Add(certificate); + + sslStream.AuthenticateAsClient(host, certCol, SslProtocols.Default, true); Stream = sslStream; } catch (AuthenticationException e) @@ -153,9 +186,10 @@ namespace org.apache.qpid.transport.network.io if (e.InnerException != null) { log.Warn("Inner exception: {0}", e.InnerException.Message); + e = new AuthenticationException(e.InnerException.Message, e.InnerException); } socket.Close(); - throw new TransportException("Authentication failed - closing the connection."); + throw new TransportException(string.Format("Authentication failed, closing connection to broker: {0}", e.Message)); } } @@ -184,7 +218,8 @@ namespace org.apache.qpid.transport.network.io string[] acceptableIssuers ) { - return remoteCertificate; + // used to be return null; in the original version + return localCertificates[0]; } #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 4491d2e98b..025b782a12 100644 --- a/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs +++ b/qpid/dotnet/client-010/client/transport/network/io/IoSender.cs @@ -27,6 +27,7 @@ namespace org.apache.qpid.transport.network.io public sealed class IoSender : IIoSender { private static readonly Logger log = Logger.Get(typeof (IoReceiver)); + private readonly IIoTransport ioTransport; private readonly Stream bufStream; private bool closed; private readonly Mutex mutClosed = new Mutex(); @@ -37,6 +38,7 @@ namespace org.apache.qpid.transport.network.io public IoSender(IIoTransport transport, int queueSize, int timeout) { this.timeout = timeout; + ioTransport = transport; bufStream = transport.Stream; queue = new CircularBuffer(queueSize); thread = new Thread(Go); @@ -71,7 +73,7 @@ namespace org.apache.qpid.transport.network.io int length = (int)_tobeSent.Position; byte[] buf = new byte[length]; _tobeSent.Seek(0, SeekOrigin.Begin); - _tobeSent.Read(buf, 0, length); + _tobeSent.Read(buf, 0, length); queue.Enqueue(buf); // bufStream.Write(buf, 0, length); // _tobeSent = new MemoryStream(); @@ -125,7 +127,8 @@ namespace org.apache.qpid.transport.network.io } catch (Exception e) { - Console.WriteLine(e); + closed = true; + ioTransport.Connection.On_ReceivedException(this, new ExceptionArgs(e)); } } } -- cgit v1.2.1 From 67245fc07c3e52e528c8d50739d848dbd484f89b Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 31 Oct 2010 23:37:31 +0000 Subject: Delete the unlicenced .net client example verification scripts etc which depend on the old Python and Java examples that have previously been deleted git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1029518 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/examples/direct/verify_dotnet_java | 15 ---- .../examples/direct/verify_dotnet_java.in | 20 ----- .../examples/direct/verify_dotnet_python | 10 --- .../examples/direct/verify_dotnet_python.in | 14 ---- .../client-010/examples/direct/verify_java_dotnet | 15 ---- .../examples/direct/verify_java_dotnet.in | 29 ------- .../examples/direct/verify_python_dotnet | 10 --- .../examples/direct/verify_python_dotnet.in | 14 ---- .../client-010/examples/fanout/verify_dotnet_java | 16 ---- .../examples/fanout/verify_dotnet_java.in | 19 ----- .../examples/fanout/verify_dotnet_python | 11 --- .../examples/fanout/verify_dotnet_python.in | 14 ---- .../client-010/examples/fanout/verify_java_dotnet | 16 ---- .../examples/fanout/verify_java_dotnet.in | 29 ------- .../examples/fanout/verify_python_dotnet | 11 --- .../examples/fanout/verify_python_dotnet.in | 14 ---- .../client-010/examples/pub-sub/verify_dotnet_java | 15 ---- .../examples/pub-sub/verify_dotnet_java.in | 95 ---------------------- .../examples/pub-sub/verify_dotnet_python | 11 --- .../examples/pub-sub/verify_dotnet_python.in | 95 ---------------------- .../client-010/examples/pub-sub/verify_java_dotnet | 15 ---- .../examples/pub-sub/verify_java_dotnet.in | 95 ---------------------- .../examples/pub-sub/verify_python_dotnet | 11 --- .../examples/pub-sub/verify_python_dotnet.in | 55 ------------- .../examples/request-response/verify_dotnet_java | 16 ---- .../request-response/verify_dotnet_java.in | 21 ----- .../examples/request-response/verify_dotnet_python | 12 --- .../request-response/verify_dotnet_python.in | 17 ---- .../examples/request-response/verify_java_dotnet | 15 ---- .../request-response/verify_java_dotnet.in | 36 -------- .../examples/request-response/verify_python_dotnet | 12 --- .../request-response/verify_python_dotnet.in | 12 --- 32 files changed, 790 deletions(-) delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_java delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_python delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_java_dotnet delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_python_dotnet delete mode 100644 qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_java delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_python delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_java_dotnet delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_python_dotnet delete mode 100644 qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet delete mode 100644 qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_java delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_python delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_java_dotnet delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_python_dotnet delete mode 100644 qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java deleted file mode 100644 index 528f3eb664..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java +++ /dev/null @@ -1,15 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/direct - -direct_consumer_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Consumer -} - -direct_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 -} - -clients $cpp/declare_queues direct_producer_dotnet direct_consumer_java -outputs $cpp/declare_queues.out ./direct_producer_dotnet.out ./direct_consumer_java.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in deleted file mode 100644 index cd87551305..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_dotnet_java.in +++ /dev/null @@ -1,20 +0,0 @@ -==== declare_queues.out -==== direct_producer_dotnet.out -==== direct_consumer_java.out -Consumer: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Consumer: Creating a non-transacted, auto-acknowledged session -Consumer: Creating a MessageConsumer -Consumer: Starting connection so MessageConsumer can receive messages -Consumer: Received message: Message 0 -Consumer: Received message: Message 1 -Consumer: Received message: Message 2 -Consumer: Received message: Message 3 -Consumer: Received message: Message 4 -Consumer: Received message: Message 5 -Consumer: Received message: Message 6 -Consumer: Received message: Message 7 -Consumer: Received message: Message 8 -Consumer: Received message: Message 9 -Consumer: Received final message That's all, folks! -Consumer: Closing connection -Consumer: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python deleted file mode 100644 index 0c70465bc5..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/direct - -direct_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 -} - -clients $py/declare_queues.py direct_producer_dotnet $py/direct_consumer.py -outputs $py/declare_queues.py.out ./direct_producer_dotnet.out $py/direct_consumer.py.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in deleted file mode 100644 index 7059b3079c..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_dotnet_python.in +++ /dev/null @@ -1,14 +0,0 @@ -==== declare_queues.py.out -==== direct_producer_dotnet.out -==== direct_consumer.py.out -Message 0 -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet deleted file mode 100644 index 50eb73f9f5..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet +++ /dev/null @@ -1,15 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -cpp=$CPP/direct - -direct_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 -} - -direct_producer_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.direct.Producer -} - -clients $cpp/declare_queues direct_producer_java direct_listener_dotnet -outputs $cpp/declare_queues.out ./direct_producer_java.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in deleted file mode 100644 index 23628b89de..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_java_dotnet.in +++ /dev/null @@ -1,29 +0,0 @@ -==== declare_queues.out -==== direct_producer_java.out -Producer: Creating a non-transacted, auto-acknowledged session -Producer: Creating a Message Producer -Producer: Creating a TestMessage to send to the destination -Producer: Sending message: 1 -Producer: Sending message: 2 -Producer: Sending message: 3 -Producer: Sending message: 4 -Producer: Sending message: 5 -Producer: Sending message: 6 -Producer: Sending message: 7 -Producer: Sending message: 8 -Producer: Sending message: 9 -Producer: Sending message: 10 -Producer: Closing connection -Producer: Closing JNDI context -==== direct_listener_dotnet.out -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet deleted file mode 100644 index 086b31caf4..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet +++ /dev/null @@ -1,10 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/direct - -direct_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 -} - -clients $py/declare_queues.py $py/direct_producer.py direct_listener_dotnet -outputs $py/declare_queues.py.out $py/direct_producer.py.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in deleted file mode 100644 index a556e7ad86..0000000000 --- a/qpid/dotnet/client-010/examples/direct/verify_python_dotnet.in +++ /dev/null @@ -1,14 +0,0 @@ -==== declare_queues.py.out -==== direct_producer.py.out -==== direct_listener_dotnet.out -Message: message 0 -Message: message 1 -Message: message 2 -Message: message 3 -Message: message 4 -Message: message 5 -Message: message 6 -Message: message 7 -Message: message 8 -Message: message 9 -Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java deleted file mode 100644 index 88576814d7..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java +++ /dev/null @@ -1,16 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -fanout_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 -} - - -fanout_listener_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Listener $1 -} - -background "can receive messages" fanout_listener_java fanoutQueue1 -clients fanout_producer_dotnet -outputs ./fanout_producer_dotnet.out "./fanout_listener_java.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in deleted file mode 100644 index 06d3a6e66b..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_java.in +++ /dev/null @@ -1,19 +0,0 @@ -==== fanout_producer_dotnet.out -==== fanout_listener_java.out | remove_uuid -Listener: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Creating a MessageConsumer -Listener: Starting connection so MessageConsumer can receive messages -Listener: Received message: Message 0 -Listener: Received message: Message 1 -Listener: Received message: Message 2 -Listener: Received message: Message 3 -Listener: Received message: Message 4 -Listener: Received message: Message 5 -Listener: Received message: Message 6 -Listener: Received message: Message 7 -Listener: Received message: Message 8 -Listener: Received message: Message 9 -Listener: Received final message That's all, folks! -Listener: Closing connection -Listener: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python deleted file mode 100644 index a09b26ca6a..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/fanout - -fanout_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-fanout-Producer.exe localhost 5672 -} - -background "Subscribed" $py/fanout_consumer.py -clients fanout_producer_dotnet -outputs ./fanout_producer_dotnet.out "$py/fanout_consumer.py.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in deleted file mode 100644 index e9959c2e25..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_python.in +++ /dev/null @@ -1,14 +0,0 @@ -==== fanout_producer_dotnet.out -==== fanout_consumer.py.out | remove_uuid -Subscribed to queue -Message 0 -Message 1 -Message 2 -Message 3 -Message 4 -Message 5 -Message 6 -Message 7 -Message 8 -Message 9 -That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet deleted file mode 100644 index d72954de0e..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet +++ /dev/null @@ -1,16 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -fanout_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 -} - - -fanout_producer_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.fanout.Producer -} - -background "Listening" fanout_listener_dotnet -clients fanout_producer_java -outputs fanout_producer_java.out "./fanout_listener_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in deleted file mode 100644 index acf1b61221..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_java_dotnet.in +++ /dev/null @@ -1,29 +0,0 @@ -==== fanout_producer_java.out -Producer: Creating a non-transacted, auto-acknowledged session -Producer: Creating a Message Producer -Producer: Creating a TestMessage to send to the destination -Producer: Sending message: 1 -Producer: Sending message: 2 -Producer: Sending message: 3 -Producer: Sending message: 4 -Producer: Sending message: 5 -Producer: Sending message: 6 -Producer: Sending message: 7 -Producer: Sending message: 8 -Producer: Sending message: 9 -Producer: Sending message: 10 -Producer: Closing connection -Producer: Closing JNDI context -==== fanout_listener_dotnet.out | remove_uuid -Listening -Message: Message 1 -Message: Message 2 -Message: Message 3 -Message: Message 4 -Message: Message 5 -Message: Message 6 -Message: Message 7 -Message: Message 8 -Message: Message 9 -Message: Message 10 -Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet deleted file mode 100644 index ac472c0f72..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/fanout - -fanout_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-fanout-Listener.exe localhost 5672 -} - -background "Listening" fanout_listener_dotnet -clients $py/fanout_producer.py -outputs $py/fanout_producer.py.out "./fanout_listener_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in deleted file mode 100644 index b489c63a2c..0000000000 --- a/qpid/dotnet/client-010/examples/fanout/verify_python_dotnet.in +++ /dev/null @@ -1,14 +0,0 @@ -==== fanout_producer.py.out -==== fanout_listener_dotnet.out | remove_uuid -Listening -Message: message 0 -Message: message 1 -Message: message 2 -Message: message 3 -Message: message 4 -Message: message 5 -Message: message 6 -Message: message 7 -Message: message 8 -Message: message 9 -Message: That's all, folks! diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java deleted file mode 100644 index 0b90416a7e..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java +++ /dev/null @@ -1,15 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -topic_listener_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Listener -} - -pubsub_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 -} - -background "can receive messages" topic_listener_java -clients pubsub_producer_dotnet -outputs pubsub_producer_dotnet.out "topic_listener_java.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in deleted file mode 100644 index 5db02e64b1..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_java.in +++ /dev/null @@ -1,95 +0,0 @@ -==== pubsub_producer_dotnet.out -==== topic_listener_java.out | remove_uuid | sort -Listener: Closing connection -Listener: Closing JNDI context -Listener: Creating a Message Subscriber for topic europe -Listener: Creating a Message Subscriber for topic news -Listener: Creating a Message Subscriber for topic usa -Listener: Creating a Message Subscriber for topic weather -Listener: Creating a non-transacted, auto-acknowledged session -Listener: Received message for topic: europe: Message 0 -Listener: Received message for topic: europe: Message 0 -Listener: Received message for topic: europe: Message 1 -Listener: Received message for topic: europe: Message 1 -Listener: Received message for topic: europe: Message 2 -Listener: Received message for topic: europe: Message 2 -Listener: Received message for topic: europe: Message 3 -Listener: Received message for topic: europe: Message 3 -Listener: Received message for topic: europe: Message 4 -Listener: Received message for topic: europe: Message 4 -Listener: Received message for topic: europe: Message 5 -Listener: Received message for topic: europe: Message 5 -Listener: Received message for topic: europe: Message 6 -Listener: Received message for topic: europe: Message 6 -Listener: Received message for topic: europe: Message 7 -Listener: Received message for topic: europe: Message 7 -Listener: Received message for topic: europe: Message 8 -Listener: Received message for topic: europe: Message 8 -Listener: Received message for topic: europe: Message 9 -Listener: Received message for topic: europe: Message 9 -Listener: Received message for topic: news: Message 0 -Listener: Received message for topic: news: Message 0 -Listener: Received message for topic: news: Message 1 -Listener: Received message for topic: news: Message 1 -Listener: Received message for topic: news: Message 2 -Listener: Received message for topic: news: Message 2 -Listener: Received message for topic: news: Message 3 -Listener: Received message for topic: news: Message 3 -Listener: Received message for topic: news: Message 4 -Listener: Received message for topic: news: Message 4 -Listener: Received message for topic: news: Message 5 -Listener: Received message for topic: news: Message 5 -Listener: Received message for topic: news: Message 6 -Listener: Received message for topic: news: Message 6 -Listener: Received message for topic: news: Message 7 -Listener: Received message for topic: news: Message 7 -Listener: Received message for topic: news: Message 8 -Listener: Received message for topic: news: Message 8 -Listener: Received message for topic: news: Message 9 -Listener: Received message for topic: news: Message 9 -Listener: Received message for topic: usa: Message 0 -Listener: Received message for topic: usa: Message 0 -Listener: Received message for topic: usa: Message 1 -Listener: Received message for topic: usa: Message 1 -Listener: Received message for topic: usa: Message 2 -Listener: Received message for topic: usa: Message 2 -Listener: Received message for topic: usa: Message 3 -Listener: Received message for topic: usa: Message 3 -Listener: Received message for topic: usa: Message 4 -Listener: Received message for topic: usa: Message 4 -Listener: Received message for topic: usa: Message 5 -Listener: Received message for topic: usa: Message 5 -Listener: Received message for topic: usa: Message 6 -Listener: Received message for topic: usa: Message 6 -Listener: Received message for topic: usa: Message 7 -Listener: Received message for topic: usa: Message 7 -Listener: Received message for topic: usa: Message 8 -Listener: Received message for topic: usa: Message 8 -Listener: Received message for topic: usa: Message 9 -Listener: Received message for topic: usa: Message 9 -Listener: Received message for topic: weather: Message 0 -Listener: Received message for topic: weather: Message 0 -Listener: Received message for topic: weather: Message 1 -Listener: Received message for topic: weather: Message 1 -Listener: Received message for topic: weather: Message 2 -Listener: Received message for topic: weather: Message 2 -Listener: Received message for topic: weather: Message 3 -Listener: Received message for topic: weather: Message 3 -Listener: Received message for topic: weather: Message 4 -Listener: Received message for topic: weather: Message 4 -Listener: Received message for topic: weather: Message 5 -Listener: Received message for topic: weather: Message 5 -Listener: Received message for topic: weather: Message 6 -Listener: Received message for topic: weather: Message 6 -Listener: Received message for topic: weather: Message 7 -Listener: Received message for topic: weather: Message 7 -Listener: Received message for topic: weather: Message 8 -Listener: Received message for topic: weather: Message 8 -Listener: Received message for topic: weather: Message 9 -Listener: Received message for topic: weather: Message 9 -Listener: Setting an ExceptionListener on the connection as sample uses a TopicSubscriber -Listener: Shutting down listener for europe -Listener: Shutting down listener for news -Listener: Shutting down listener for usa -Listener: Shutting down listener for weather -Listener: Starting connection so TopicSubscriber can receive messages diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python deleted file mode 100644 index dd62dbcbeb..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/pubsub - -pubsub_producer_dotnet() -{ -mono $DOTNET_EXAMPLES/example-pub-sub-Publisher.exe localhost 5672 -} - -background "Queues created" $py/topic_subscriber.py -clients pubsub_producer_dotnet -outputs ./pubsub_producer_dotnet.out "$py/topic_subscriber.py.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in deleted file mode 100644 index 130efa2b0e..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_python.in +++ /dev/null @@ -1,95 +0,0 @@ -==== pubsub_producer_dotnet.out -==== topic_subscriber.py.out | remove_uuid | sort -Message 0 -Message 0 -Message 0 -Message 0 -Message 0 -Message 0 -Message 0 -Message 0 -Message 1 -Message 1 -Message 1 -Message 1 -Message 1 -Message 1 -Message 1 -Message 1 -Message 2 -Message 2 -Message 2 -Message 2 -Message 2 -Message 2 -Message 2 -Message 2 -Message 3 -Message 3 -Message 3 -Message 3 -Message 3 -Message 3 -Message 3 -Message 3 -Message 4 -Message 4 -Message 4 -Message 4 -Message 4 -Message 4 -Message 4 -Message 4 -Message 5 -Message 5 -Message 5 -Message 5 -Message 5 -Message 5 -Message 5 -Message 5 -Message 6 -Message 6 -Message 6 -Message 6 -Message 6 -Message 6 -Message 6 -Message 6 -Message 7 -Message 7 -Message 7 -Message 7 -Message 7 -Message 7 -Message 7 -Message 7 -Message 8 -Message 8 -Message 8 -Message 8 -Message 8 -Message 8 -Message 8 -Message 8 -Message 9 -Message 9 -Message 9 -Message 9 -Message 9 -Message 9 -Message 9 -Message 9 -Messages on 'europe' queue: -Messages on 'news' queue: -Messages on 'usa' queue: -Messages on 'weather' queue: -Queues created - please start the topic producer -Subscribing local queue 'local_europe' to europe-' -Subscribing local queue 'local_news' to news-' -Subscribing local queue 'local_usa' to usa-' -Subscribing local queue 'local_weather' to weather-' -That's all, folks! -That's all, folks! -That's all, folks! -That's all, folks! diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet deleted file mode 100644 index 52069957c5..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet +++ /dev/null @@ -1,15 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -pubsub_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 -} - -topic_publisher_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.pubsub.Publisher -} - -background "Listening for messages ..." pubsub_listener_dotnet -clients topic_publisher_java -outputs topic_publisher_java.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in deleted file mode 100644 index 1b37f711c4..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_java_dotnet.in +++ /dev/null @@ -1,95 +0,0 @@ -==== topic_publisher_java.out -Publisher: Creating a non-transacted, auto-acknowledged session -Publisher: Creating a TestMessage to send to the topics -Publisher: Creating a Message Publisher for topic usa.weather -Publisher: Sending message 1 -Publisher: Sending message 2 -Publisher: Sending message 3 -Publisher: Sending message 4 -Publisher: Sending message 5 -Publisher: Sending message 6 -Publisher: Creating a Message Publisher for topic usa.news -Publisher: Sending message 1 -Publisher: Sending message 2 -Publisher: Sending message 3 -Publisher: Sending message 4 -Publisher: Sending message 5 -Publisher: Sending message 6 -Publisher: Creating a Message Publisher for topic europe.weather -Publisher: Sending message 1 -Publisher: Sending message 2 -Publisher: Sending message 3 -Publisher: Sending message 4 -Publisher: Sending message 5 -Publisher: Sending message 6 -Publisher: Creating a Message Publisher for topic europe.news -Publisher: Sending message 1 -Publisher: Sending message 2 -Publisher: Sending message 3 -Publisher: Sending message 4 -Publisher: Sending message 5 -Publisher: Sending message 6 -Publisher: Closing connection -Publisher: Closing JNDI context -==== pubsub_listener_dotnet.out | remove_uuid | sort -Declaring queue: europe -Declaring queue: news -Declaring queue: usa -Declaring queue: weather -Listening for messages ... -Message: message 1 from europe -Message: message 1 from europe -Message: message 1 from news -Message: message 1 from news -Message: message 1 from usa -Message: message 1 from usa -Message: message 1 from weather -Message: message 1 from weather -Message: message 2 from europe -Message: message 2 from europe -Message: message 2 from news -Message: message 2 from news -Message: message 2 from usa -Message: message 2 from usa -Message: message 2 from weather -Message: message 2 from weather -Message: message 3 from europe -Message: message 3 from europe -Message: message 3 from news -Message: message 3 from news -Message: message 3 from usa -Message: message 3 from usa -Message: message 3 from weather -Message: message 3 from weather -Message: message 4 from europe -Message: message 4 from europe -Message: message 4 from news -Message: message 4 from news -Message: message 4 from usa -Message: message 4 from usa -Message: message 4 from weather -Message: message 4 from weather -Message: message 5 from europe -Message: message 5 from europe -Message: message 5 from news -Message: message 5 from news -Message: message 5 from usa -Message: message 5 from usa -Message: message 5 from weather -Message: message 5 from weather -Message: message 6 from europe -Message: message 6 from europe -Message: message 6 from news -Message: message 6 from news -Message: message 6 from usa -Message: message 6 from usa -Message: message 6 from weather -Message: message 6 from weather -Message: That's all, folks! from europe -Message: That's all, folks! from news -Message: That's all, folks! from usa -Message: That's all, folks! from weather -Shutting down listener for control -Shutting down listener for control -Shutting down listener for control -Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet deleted file mode 100644 index 0366e3a9ac..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet +++ /dev/null @@ -1,11 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/pubsub - -pubsub_listener_dotnet() -{ -mono $DOTNET_EXAMPLES/example-pub-sub-Listener.exe localhost 5672 -} - -background "Listening for messages ..." pubsub_listener_dotnet -clients $py/topic_publisher.py -outputs $py/topic_publisher.py.out "pubsub_listener_dotnet.out | remove_uuid | sort" diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in deleted file mode 100644 index ac1b681b32..0000000000 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_python_dotnet.in +++ /dev/null @@ -1,55 +0,0 @@ -==== topic_publisher.py.out -==== pubsub_listener_dotnet.out | remove_uuid | sort -Declaring queue: europe -Declaring queue: news -Declaring queue: usa -Declaring queue: weather -Listening for messages ... -Message: europe.news 0 from europe -Message: europe.news 0 from news -Message: europe.news 1 from europe -Message: europe.news 1 from news -Message: europe.news 2 from europe -Message: europe.news 2 from news -Message: europe.news 3 from europe -Message: europe.news 3 from news -Message: europe.news 4 from europe -Message: europe.news 4 from news -Message: europe.weather 0 from europe -Message: europe.weather 0 from weather -Message: europe.weather 1 from europe -Message: europe.weather 1 from weather -Message: europe.weather 2 from europe -Message: europe.weather 2 from weather -Message: europe.weather 3 from europe -Message: europe.weather 3 from weather -Message: europe.weather 4 from europe -Message: europe.weather 4 from weather -Message: That's all, folks! from europe -Message: That's all, folks! from news -Message: That's all, folks! from usa -Message: That's all, folks! from weather -Message: usa.news 0 from news -Message: usa.news 0 from usa -Message: usa.news 1 from news -Message: usa.news 1 from usa -Message: usa.news 2 from news -Message: usa.news 2 from usa -Message: usa.news 3 from news -Message: usa.news 3 from usa -Message: usa.news 4 from news -Message: usa.news 4 from usa -Message: usa.weather 0 from usa -Message: usa.weather 0 from weather -Message: usa.weather 1 from usa -Message: usa.weather 1 from weather -Message: usa.weather 2 from usa -Message: usa.weather 2 from weather -Message: usa.weather 3 from usa -Message: usa.weather 3 from weather -Message: usa.weather 4 from usa -Message: usa.weather 4 from weather -Shutting down listener for control -Shutting down listener for control -Shutting down listener for control -Shutting down listener for control diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java deleted file mode 100644 index 56477c623a..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java +++ /dev/null @@ -1,16 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -server_dotnet() -{ -mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 -} - -client_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Client -} - -background "Waiting for requests" server_dotnet -clients client_java -kill %% -outputs ./server_dotnet.out "client_java.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in deleted file mode 100644 index 96e8b8a255..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_java.in +++ /dev/null @@ -1,21 +0,0 @@ -==== server_dotnet.out -Waiting for requests -Request: Twas brillig, and the slithy toves -Request: Did gire and gymble in the wabe. -Request: All mimsy were the borogroves, -Request: And the mome raths outgrabe. -==== client_java.out | remove_uuid -Client: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Client: Creating a non-transacted, auto-acknowledged session -Client: Creating a QueueRequestor -Client: Starting connection -Client: Request Content= Twas brillig, and the slithy toves -Client: Response Content= TWAS BRILLIG, AND THE SLITHY TOVES -Client: Request Content= Did gire and gymble in the wabe. -Client: Response Content= DID GIRE AND GYMBLE IN THE WABE. -Client: Request Content= All mimsy were the borogroves, -Client: Response Content= ALL MIMSY WERE THE BOROGROVES, -Client: Request Content= And the mome raths outgrabe. -Client: Response Content= AND THE MOME RATHS OUTGRABE. -Client: Closing connection -Client: Closing JNDI context diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python deleted file mode 100644 index 8ae2f41361..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python +++ /dev/null @@ -1,12 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/request-response - -server_dotnet() -{ -mono $DOTNET_EXAMPLES/example-request-response-Server.exe localhost 5672 -} - -background "Waiting for requests" server_dotnet -clients $py/client.py -kill %% -outputs "$py/client.py.out | remove_uuid" "server_dotnet.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in deleted file mode 100644 index 4455f4e133..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_python.in +++ /dev/null @@ -1,17 +0,0 @@ -==== client.py.out | remove_uuid -Request: Twas brillig, and the slithy toves -Request: Did gyre and gimble in the wabe. -Request: All mimsy were the borogroves, -Request: And the mome raths outgrabe. -Messages on queue: reply_to: -Response: TWAS BRILLIG, AND THE SLITHY TOVES -Response: DID GYRE AND GIMBLE IN THE WABE. -Response: ALL MIMSY WERE THE BOROGROVES, -Response: AND THE MOME RATHS OUTGRABE. -No more messages! -==== server_dotnet.out | remove_uuid -Waiting for requests -Request: Twas brillig, and the slithy toves -Request: Did gyre and gimble in the wabe. -Request: All mimsy were the borogroves, -Request: And the mome raths outgrabe. diff --git a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet deleted file mode 100644 index 6950a6a4ec..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet +++ /dev/null @@ -1,15 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify - -server_java() -{ -java -Dlog4j.configuration=file://"$JAVA"/log4j.xml -cp "$CLASSPATH" org.apache.qpid.example.jmsexample.requestResponse.Server -} - -client_dotnet() -{ -mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 -} -background "can receive messages" server_java -clients client_dotnet -kill %% -outputs "server_java.out | remove_uuid" ./client_dotnet.out diff --git a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in b/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in deleted file mode 100644 index 16b1853f37..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_java_dotnet.in +++ /dev/null @@ -1,36 +0,0 @@ -==== server_java.out | remove_uuid -Server: Setting an ExceptionListener on the connection as sample uses a MessageConsumer -Server: Creating a non-transacted, auto-acknowledged session -Server: Creating a MessageConsumer -Server: Creating a MessageProducer -Server: Starting connection so MessageConsumer can receive messages -Server: Receiving the message -Server: Activating response queue listener -Server: Response = TWAS BRILLIG, AND THE SLITHY TOVES - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = DID GIRE AND GYMBLE IN THE WABE. - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = ALL MIMSY WERE THE BOROGROVES, - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = AND THE MOME RATHS OUTGRABE. - -Server: Receiving the message -Server: Activating response queue listener -Server: Response = THAT'S ALL, FOLKS! - -Server: Receiving the message -==== client_dotnet.out -Activating response queue listener for: clientSystem.Byte[] -Waiting for all responses to arrive ... -Response: TWAS BRILLIG, AND THE SLITHY TOVES -Response: DID GIRE AND GYMBLE IN THE WABE. -Response: ALL MIMSY WERE THE BOROGROVES, -Response: AND THE MOME RATHS OUTGRABE. -Shutting down listener for clientSystem.Byte[] -Response: THAT'S ALL, FOLKS! diff --git a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet deleted file mode 100644 index f1b5d662bd..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet +++ /dev/null @@ -1,12 +0,0 @@ -# See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify -py=$PYTHON_EXAMPLES/request-response - -client_dotnet() -{ -mono $DOTNET_EXAMPLES/example-request-response-Client.exe localhost 5672 -} - -background "Request server running" $py/server.py -clients client_dotnet -kill %% -outputs "client_dotnet.out | remove_uuid" "$py/server.py.out | remove_uuid" diff --git a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in b/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in deleted file mode 100644 index d982a61a04..0000000000 --- a/qpid/dotnet/client-010/examples/request-response/verify_python_dotnet.in +++ /dev/null @@ -1,12 +0,0 @@ -==== client_dotnet.out | remove_uuid -Activating response queue listener for: clientSystem.Byte[] -Waiting for all responses to arrive ... -Response: TWAS BRILLIG, AND THE SLITHY TOVES -Response: DID GIRE AND GYMBLE IN THE WABE. -Response: ALL MIMSY WERE THE BOROGROVES, -Response: AND THE MOME RATHS OUTGRABE. -Shutting down listener for clientSystem.Byte[] -Response: THAT'S ALL, FOLKS! -==== server.py.out | remove_uuid -Request server running - run your client now. -(Times out after 100 seconds ...) -- cgit v1.2.1 From e39d81aba69a7fd968de28184ac11472b359f731 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 31 Oct 2010 23:37:48 +0000 Subject: Remove unlicenced MonoDevelop user files, shouldnt be version controlled git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1029519 13f79535-47bb-0310-9956-ffa450edef68 --- .../management/console/console.userprefs | 42 ---------------------- .../management/console/console.usertasks | 2 -- 2 files changed, 44 deletions(-) delete mode 100644 qpid/dotnet/client-010/management/console/console.userprefs delete mode 100644 qpid/dotnet/client-010/management/console/console.usertasks (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/management/console/console.userprefs b/qpid/dotnet/client-010/management/console/console.userprefs deleted file mode 100644 index 3dbea952ee..0000000000 --- a/qpid/dotnet/client-010/management/console/console.userprefs +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/qpid/dotnet/client-010/management/console/console.usertasks b/qpid/dotnet/client-010/management/console/console.usertasks deleted file mode 100644 index d887d0ef8d..0000000000 --- a/qpid/dotnet/client-010/management/console/console.usertasks +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file -- cgit v1.2.1 From 367481fd620e4a3d7bae123c40fe74afa49cb643 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Sun, 31 Oct 2010 23:39:02 +0000 Subject: add ASF licence to various files in the .net tree git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1029520 13f79535-47bb-0310-9956-ffa450edef68 --- .../client-010/addins/ExcelAddIn/ExcelAddIn.csproj | 20 ++++++++++++++++++++ .../ExcelAddInMessageProcessor.csproj | 20 ++++++++++++++++++++ .../ExcelAddInProducer/ExcelAddInProducer.csproj | 20 ++++++++++++++++++++ qpid/dotnet/client-010/client/Client.csproj | 20 ++++++++++++++++++++ qpid/dotnet/client-010/client/client.sln | 20 ++++++++++++++++++++ qpid/dotnet/client-010/demo/Demo.csproj | 20 ++++++++++++++++++++ .../client-010/demo/Properties/Resources.resx | 20 ++++++++++++++++++++ .../client-010/demo/Properties/Settings.settings | 20 ++++++++++++++++++++ .../example-direct-Listener.csproj | 20 ++++++++++++++++++++ .../example-direct-producer.csproj | 20 ++++++++++++++++++++ .../client-010/examples/direct/verify_cpp_dotnet | 21 ++++++++++++++++++++- .../client-010/examples/direct/verify_dotnet_cpp | 21 ++++++++++++++++++++- .../example-fanout-Listener.csproj | 20 ++++++++++++++++++++ .../example-fanout-Producer.csproj | 20 ++++++++++++++++++++ .../client-010/examples/fanout/verify_cpp_dotnet | 19 +++++++++++++++++++ .../client-010/examples/fanout/verify_dotnet_cpp | 19 +++++++++++++++++++ .../example-pub-sub-Listener.csproj | 20 ++++++++++++++++++++ .../example-pub-sub-Publisher.csproj | 20 ++++++++++++++++++++ .../client-010/examples/pub-sub/verify_cpp_dotnet | 19 +++++++++++++++++++ .../client-010/examples/pub-sub/verify_dotnet_cpp | 19 +++++++++++++++++++ .../example-request-response-Client.csproj | 20 ++++++++++++++++++++ .../example-request-response-Server.csproj | 20 ++++++++++++++++++++ .../examples/request-response/verify_cpp_dotnet | 19 +++++++++++++++++++ .../examples/request-response/verify_dotnet_cpp | 19 +++++++++++++++++++ qpid/dotnet/client-010/gentool/Enum.tpl | 21 +++++++++++++++++++++ .../client-010/management/console/console.csproj | 20 ++++++++++++++++++++ .../client-010/management/console/console.sln | 20 ++++++++++++++++++++ qpid/dotnet/client-010/perftest/perftest.csproj | 20 ++++++++++++++++++++ qpid/dotnet/client-010/test/Test.csproj | 20 ++++++++++++++++++++ .../client-010/wcf/demo/wcfBookingClient/Form1.resx | 20 ++++++++++++++++++++ .../demo/wcfBookingClient/Properties/Resources.resx | 20 ++++++++++++++++++++ .../wcfBookingClient/Properties/Settings.settings | 20 ++++++++++++++++++++ .../demo/wcfBookingClient/wcBookingClient.csproj | 20 ++++++++++++++++++++ .../demo/wcfBookingServer/wcfBookingServer.csproj | 20 ++++++++++++++++++++ .../wcf/demo/wcfHelloClient/wcfHelloClient.csproj | 20 ++++++++++++++++++++ .../wcf/demo/wcfHelloServer/wcfHelloServer.csproj | 20 ++++++++++++++++++++ .../dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj | 20 ++++++++++++++++++++ qpid/dotnet/client-010/wcf/wcf.csproj | 20 ++++++++++++++++++++ qpid/dotnet/client-010/wcf/wcf.sln | 20 ++++++++++++++++++++ 39 files changed, 775 insertions(+), 2 deletions(-) (limited to 'qpid/dotnet/client-010') diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj index 34c8bda33b..b44bf9cc69 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj @@ -1,3 +1,23 @@ + Debug diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj index c7ae1d1c6d..447ded4b55 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj @@ -1,3 +1,23 @@ + Debug diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj index e69f4cf35a..d9b1b63737 100644 --- a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj +++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj @@ -1,3 +1,23 @@ + Debug diff --git a/qpid/dotnet/client-010/client/Client.csproj b/qpid/dotnet/client-010/client/Client.csproj index 5b71ad0581..000407da59 100644 --- a/qpid/dotnet/client-010/client/Client.csproj +++ b/qpid/dotnet/client-010/client/Client.csproj @@ -1,3 +1,23 @@ + Debug diff --git a/qpid/dotnet/client-010/client/client.sln b/qpid/dotnet/client-010/client/client.sln index 0d7a57d880..37455fd177 100644 --- a/qpid/dotnet/client-010/client/client.sln +++ b/qpid/dotnet/client-010/client/client.sln @@ -1,6 +1,26 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License +# + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "..\demo\Demo.csproj", "{E4C46FBC-7560-406D-BFEF-CA010E584DF4}" diff --git a/qpid/dotnet/client-010/demo/Demo.csproj b/qpid/dotnet/client-010/demo/Demo.csproj index 6b1c36c633..1668314425 100644 --- a/qpid/dotnet/client-010/demo/Demo.csproj +++ b/qpid/dotnet/client-010/demo/Demo.csproj @@ -1,4 +1,24 @@ + Debug diff --git a/qpid/dotnet/client-010/demo/Properties/Resources.resx b/qpid/dotnet/client-010/demo/Properties/Resources.resx index af7dbebbac..af03750170 100644 --- a/qpid/dotnet/client-010/demo/Properties/Resources.resx +++ b/qpid/dotnet/client-010/demo/Properties/Resources.resx @@ -1,4 +1,24 @@  + 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 dea7666e49..ac026b397d 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,4 +1,24 @@  + Debug 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 6a4c9ceb92..10d9d96aea 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,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet index 86fb7dddd4..648c8b6bc1 100644 --- a/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet +++ b/qpid/dotnet/client-010/examples/direct/verify_cpp_dotnet @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/direct @@ -7,4 +26,4 @@ mono $DOTNET_EXAMPLES/example-direct-Listener.exe localhost 5672 } clients $cpp/declare_queues $cpp/direct_producer direct_listener_dotnet -outputs $cpp/declare_queues.out $cpp/direct_producer.out ./direct_listener_dotnet.out \ No newline at end of file +outputs $cpp/declare_queues.out $cpp/direct_producer.out ./direct_listener_dotnet.out diff --git a/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp index fe86159fcc..5093da6088 100644 --- a/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp +++ b/qpid/dotnet/client-010/examples/direct/verify_dotnet_cpp @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/direct @@ -7,4 +26,4 @@ mono $DOTNET_EXAMPLES/example-direct-Producer.exe localhost 5672 } clients $cpp/declare_queues direct_producer_dotnet $cpp/listener -outputs $cpp/declare_queues.out ./direct_producer_dotnet.out $cpp/listener.out \ No newline at end of file +outputs $cpp/declare_queues.out ./direct_producer_dotnet.out $cpp/listener.out 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 771e6a6891..3bd0b3d0d0 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,4 +1,24 @@  + Debug 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 6c164924a3..8b04dd8199 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,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet index b9b0d94857..5716d3119b 100644 --- a/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet +++ b/qpid/dotnet/client-010/examples/fanout/verify_cpp_dotnet @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/fanout diff --git a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp index 1b27ea8653..c755d1da41 100644 --- a/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp +++ b/qpid/dotnet/client-010/examples/fanout/verify_dotnet_cpp @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/fanout 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 f7222fc865..851faa7f21 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,4 +1,24 @@  + Debug 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 3793b73625..a9dee76a36 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,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet index 86d60578ad..39d92cbb8b 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_cpp_dotnet @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/pub-sub diff --git a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp index 66d0f5ba52..bf99e422a1 100644 --- a/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp +++ b/qpid/dotnet/client-010/examples/pub-sub/verify_dotnet_cpp @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/pub-sub 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 858f4eaf13..21dc6ceed4 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,4 +1,24 @@  + Debug 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 71ae819961..3eb2a3c035 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,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet index 3cc0370ada..791f48fe60 100644 --- a/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet +++ b/qpid/dotnet/client-010/examples/request-response/verify_cpp_dotnet @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/request-response diff --git a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp index 81b86a0b41..95905c43c9 100644 --- a/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp +++ b/qpid/dotnet/client-010/examples/request-response/verify_dotnet_cpp @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + # See https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/bin/verify cpp=$CPP/request-response diff --git a/qpid/dotnet/client-010/gentool/Enum.tpl b/qpid/dotnet/client-010/gentool/Enum.tpl index 33af038cc6..5d958c7bf6 100644 --- a/qpid/dotnet/client-010/gentool/Enum.tpl +++ b/qpid/dotnet/client-010/gentool/Enum.tpl @@ -1,3 +1,24 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 { diff --git a/qpid/dotnet/client-010/management/console/console.csproj b/qpid/dotnet/client-010/management/console/console.csproj index 27e7360672..3cc84e6073 100644 --- a/qpid/dotnet/client-010/management/console/console.csproj +++ b/qpid/dotnet/client-010/management/console/console.csproj @@ -1,4 +1,24 @@ + Debug diff --git a/qpid/dotnet/client-010/management/console/console.sln b/qpid/dotnet/client-010/management/console/console.sln index 8555aa79cc..1cfc056302 100644 --- a/qpid/dotnet/client-010/management/console/console.sln +++ b/qpid/dotnet/client-010/management/console/console.sln @@ -1,6 +1,26 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console.csproj", "{E8D2202F-3959-4F29-AA0D-875CD37905CA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "..\..\client\Client.csproj", "{B911FFD7-754F-4735-A188-218D5065BE79}" diff --git a/qpid/dotnet/client-010/perftest/perftest.csproj b/qpid/dotnet/client-010/perftest/perftest.csproj index 34632d94a5..90136f18bb 100644 --- a/qpid/dotnet/client-010/perftest/perftest.csproj +++ b/qpid/dotnet/client-010/perftest/perftest.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj index 7bb6eaa999..a9cd7c18af 100644 --- a/qpid/dotnet/client-010/test/Test.csproj +++ b/qpid/dotnet/client-010/test/Test.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx index 360ccecbfe..7c6a1b6a50 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/Form1.resx @@ -1,4 +1,24 @@ + diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj index dbf12d376c..1449446ae2 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingClient/wcBookingClient.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj index 84e8bd5a06..2f744f8b6b 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfBookingServer/wcfBookingServer.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj index 5ad1e9624e..2e518d0da0 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloClient/wcfHelloClient.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj index b32c353c18..3a672a87f4 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfHelloServer/wcfHelloServer.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj index c45dea2d39..e8f7fee8f5 100644 --- a/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj +++ b/qpid/dotnet/client-010/wcf/demo/wcfRPC/wcfRPC.csproj @@ -1,4 +1,24 @@  + Debug diff --git a/qpid/dotnet/client-010/wcf/wcf.csproj b/qpid/dotnet/client-010/wcf/wcf.csproj index d04fefbfc2..f07c5ab1fd 100644 --- a/qpid/dotnet/client-010/wcf/wcf.csproj +++ b/qpid/dotnet/client-010/wcf/wcf.csproj @@ -1,4 +1,24 @@ + Debug diff --git a/qpid/dotnet/client-010/wcf/wcf.sln b/qpid/dotnet/client-010/wcf/wcf.sln index f65368bd66..8120f44576 100644 --- a/qpid/dotnet/client-010/wcf/wcf.sln +++ b/qpid/dotnet/client-010/wcf/wcf.sln @@ -1,6 +1,26 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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}" -- cgit v1.2.1