2010-06-23: Michael Barker <mike@middlesoft.co.uk>
authorMichael Barker <mike@middlesoft.co.uk>
Wed, 23 Jun 2010 21:39:05 +0000 (21:39 -0000)
committerMichael Barker <mike@middlesoft.co.uk>
Wed, 23 Jun 2010 21:39:05 +0000 (21:39 -0000)
* Upgrade to RabbitMQ.Client 1.8.

svn path=/trunk/mcs/; revision=159465

135 files changed:
mcs/class/Mono.Messaging.RabbitMQ/Mono.Messaging.RabbitMQ/ChangeLog
mcs/class/Mono.Messaging.RabbitMQ/Mono.Messaging.RabbitMQ/RabbitMQMessageEnumerator.cs
mcs/class/Mono.Messaging.RabbitMQ/Mono.Messaging.RabbitMQ/RabbitMQMessageQueue.cs
mcs/class/RabbitMQ.Client/ChangeLog
mcs/class/RabbitMQ.Client/src/apigen/AmqpClass.cs
mcs/class/RabbitMQ.Client/src/apigen/AmqpEntity.cs
mcs/class/RabbitMQ.Client/src/apigen/AmqpField.cs
mcs/class/RabbitMQ.Client/src/apigen/AmqpMethod.cs
mcs/class/RabbitMQ.Client/src/apigen/Apigen.cs
mcs/class/RabbitMQ.Client/src/client/RabbitMQ.Client.dll.sources
mcs/class/RabbitMQ.Client/src/client/api/AccessRequestConfig.cs [deleted file]
mcs/class/RabbitMQ.Client/src/client/api/AmqpTcpEndpoint.cs
mcs/class/RabbitMQ.Client/src/client/api/AmqpTimestamp.cs
mcs/class/RabbitMQ.Client/src/client/api/AmqpVersion.cs
mcs/class/RabbitMQ.Client/src/client/api/BinaryTableValue.cs
mcs/class/RabbitMQ.Client/src/client/api/ConnectionFactory.cs
mcs/class/RabbitMQ.Client/src/client/api/ConnectionParameters.cs [deleted file]
mcs/class/RabbitMQ.Client/src/client/api/DefaultBasicConsumer.cs
mcs/class/RabbitMQ.Client/src/client/api/ExchangeType.cs
mcs/class/RabbitMQ.Client/src/client/api/IBasicConsumer.cs
mcs/class/RabbitMQ.Client/src/client/api/IBasicProperties.cs
mcs/class/RabbitMQ.Client/src/client/api/IConnection.cs
mcs/class/RabbitMQ.Client/src/client/api/IContentHeader.cs
mcs/class/RabbitMQ.Client/src/client/api/IFileProperties.cs
mcs/class/RabbitMQ.Client/src/client/api/IMethod.cs
mcs/class/RabbitMQ.Client/src/client/api/IModel.cs
mcs/class/RabbitMQ.Client/src/client/api/IProtocol.cs
mcs/class/RabbitMQ.Client/src/client/api/IStreamProperties.cs
mcs/class/RabbitMQ.Client/src/client/api/Protocols.cs
mcs/class/RabbitMQ.Client/src/client/api/PublicationAddress.cs
mcs/class/RabbitMQ.Client/src/client/api/QueueingBasicConsumer.cs
mcs/class/RabbitMQ.Client/src/client/api/ShutdownEventArgs.cs
mcs/class/RabbitMQ.Client/src/client/api/ShutdownInitiator.cs
mcs/class/RabbitMQ.Client/src/client/api/ShutdownReportEntry.cs
mcs/class/RabbitMQ.Client/src/client/api/SslHelper.cs [new file with mode: 0644]
mcs/class/RabbitMQ.Client/src/client/api/SslOption.cs [new file with mode: 0644]
mcs/class/RabbitMQ.Client/src/client/content/BasicMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/BasicMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/BytesMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/BytesMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/BytesWireFormatting.cs
mcs/class/RabbitMQ.Client/src/client/content/IBytesMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/IBytesMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/IMapMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/IMapMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/IMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/IMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/IStreamMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/IStreamMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/MapMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/MapMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/MapWireFormatting.cs
mcs/class/RabbitMQ.Client/src/client/content/PrimitiveParser.cs
mcs/class/RabbitMQ.Client/src/client/content/StreamMessageBuilder.cs
mcs/class/RabbitMQ.Client/src/client/content/StreamMessageReader.cs
mcs/class/RabbitMQ.Client/src/client/content/StreamWireFormatting.cs
mcs/class/RabbitMQ.Client/src/client/events/BasicDeliverEventArgs.cs
mcs/class/RabbitMQ.Client/src/client/events/BasicDeliverEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/BasicReturnEventArgs.cs
mcs/class/RabbitMQ.Client/src/client/events/BasicReturnEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/CallbackExceptionEventArgs.cs
mcs/class/RabbitMQ.Client/src/client/events/CallbackExceptionEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/ConnectionShutdownEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/ConsumerEventArgs.cs
mcs/class/RabbitMQ.Client/src/client/events/ConsumerEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/ConsumerShutdownEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/events/EventingBasicConsumer.cs
mcs/class/RabbitMQ.Client/src/client/events/ModelShutdownEventHandler.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/AlreadyClosedException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/BrokerUnreachableException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/ChannelAllocationException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/OperationInterruptedException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/PacketNotRecognizedException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/PossibleAuthenticationFailureException.cs [new file with mode: 0644]
mcs/class/RabbitMQ.Client/src/client/exceptions/ProtocolVersionMismatchException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/UnexpectedMethodException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/UnsupportedMethodException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/UnsupportedMethodFieldException.cs
mcs/class/RabbitMQ.Client/src/client/exceptions/WireFormattingException.cs
mcs/class/RabbitMQ.Client/src/client/impl/AbstractProtocolBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/BasicProperties.cs
mcs/class/RabbitMQ.Client/src/client/impl/BodyTooLongException.cs [deleted file]
mcs/class/RabbitMQ.Client/src/client/impl/ChannelErrorException.cs
mcs/class/RabbitMQ.Client/src/client/impl/Command.cs
mcs/class/RabbitMQ.Client/src/client/impl/CommandAssembler.cs
mcs/class/RabbitMQ.Client/src/client/impl/ConnectionBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/ConnectionStartDetails.cs
mcs/class/RabbitMQ.Client/src/client/impl/ContentHeaderBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/ContentHeaderPropertyReader.cs
mcs/class/RabbitMQ.Client/src/client/impl/ContentHeaderPropertyWriter.cs
mcs/class/RabbitMQ.Client/src/client/impl/FileProperties.cs
mcs/class/RabbitMQ.Client/src/client/impl/Frame.cs
mcs/class/RabbitMQ.Client/src/client/impl/HardProtocolException.cs
mcs/class/RabbitMQ.Client/src/client/impl/IFrameHandler.cs
mcs/class/RabbitMQ.Client/src/client/impl/IRpcContinuation.cs
mcs/class/RabbitMQ.Client/src/client/impl/ISession.cs
mcs/class/RabbitMQ.Client/src/client/impl/MainSession.cs
mcs/class/RabbitMQ.Client/src/client/impl/MalformedFrameException.cs
mcs/class/RabbitMQ.Client/src/client/impl/MethodArgumentReader.cs
mcs/class/RabbitMQ.Client/src/client/impl/MethodArgumentWriter.cs
mcs/class/RabbitMQ.Client/src/client/impl/MethodBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/ModelBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/ProtocolException.cs
mcs/class/RabbitMQ.Client/src/client/impl/QuiescingSession.cs
mcs/class/RabbitMQ.Client/src/client/impl/RedirectException.cs
mcs/class/RabbitMQ.Client/src/client/impl/RpcContinuationQueue.cs
mcs/class/RabbitMQ.Client/src/client/impl/Session.cs
mcs/class/RabbitMQ.Client/src/client/impl/SessionBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/SessionManager.cs
mcs/class/RabbitMQ.Client/src/client/impl/ShutdownContinuation.cs
mcs/class/RabbitMQ.Client/src/client/impl/SimpleBlockingRpcContinuation.cs
mcs/class/RabbitMQ.Client/src/client/impl/SocketFrameHandler_0_9.cs
mcs/class/RabbitMQ.Client/src/client/impl/SoftProtocolException.cs
mcs/class/RabbitMQ.Client/src/client/impl/StreamProperties.cs
mcs/class/RabbitMQ.Client/src/client/impl/SyntaxError.cs
mcs/class/RabbitMQ.Client/src/client/impl/UnexpectedFrameException.cs
mcs/class/RabbitMQ.Client/src/client/impl/UnknownClassOrMethodException.cs
mcs/class/RabbitMQ.Client/src/client/impl/WireFormatting.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_8/Connection.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_8/ProtocolBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_8qpid/Connection.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_8qpid/ProtocolBase.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_9/Connection.cs
mcs/class/RabbitMQ.Client/src/client/impl/v0_9/ProtocolBase.cs
mcs/class/RabbitMQ.Client/src/client/messagepatterns/SimpleRpcClient.cs
mcs/class/RabbitMQ.Client/src/client/messagepatterns/SimpleRpcServer.cs
mcs/class/RabbitMQ.Client/src/client/messagepatterns/Subscription.cs
mcs/class/RabbitMQ.Client/src/util/BlockingCell.cs
mcs/class/RabbitMQ.Client/src/util/DebugUtil.cs
mcs/class/RabbitMQ.Client/src/util/Either.cs
mcs/class/RabbitMQ.Client/src/util/IntAllocator.cs [new file with mode: 0644]
mcs/class/RabbitMQ.Client/src/util/NetworkBinaryReader.cs
mcs/class/RabbitMQ.Client/src/util/NetworkBinaryWriter.cs
mcs/class/RabbitMQ.Client/src/util/SharedQueue.cs
mcs/class/RabbitMQ.Client/src/util/XmlUtil.cs

index c55a640041a0b9b4e5863006d7a5a2df894ece7f..d977d8de291f4282f3744ff4ca4607483b3f9a13 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-23  Michael Barker  <mike@middlesoft.co.uk>
+
+       * RabbitMQMessageQueue.cs: Modified to support RabbitMQ 1.8
+       * RabbitMQMessageEnumerator.cs: Modified to support RabbitMQ 1.8
+       
 2009-07-14  Michael Barker  <mike@middlesoft.co.uk>
 
        * RabbitMQMessageQueue.cs: Refactored, removed dead code and renamed methods.
index 1a05d37146571b7713442966922d8145d1e5d1c1..c96c62f82fa77f4edfac8673cc43f50c9650d914 100644 (file)
@@ -105,7 +105,8 @@ namespace Mono.Messaging.RabbitMQ {
                        get {
                                if (cn == null) {
                                        ConnectionFactory cf = new ConnectionFactory ();
-                                       cn = cf.CreateConnection (qRef.Host);
+                                       cf.Address = qRef.Host;
+                                       cn = cf.CreateConnection ();
                                }
                                
                                if (model == null) {
index b2d1f2fc9b0ab2b5ea2b35870bbfc35e8fdaa480..588ceca263bb371dece323e74cfab63e283dc418 100644 (file)
@@ -196,9 +196,7 @@ namespace Mono.Messaging.RabbitMQ {
                
                public static void Delete (QueueReference qRef)
                {
-                       ConnectionFactory cf = new ConnectionFactory ();
-                       
-                       using (IConnection cn = cf.CreateConnection (qRef.Host)) {
+                       using (IConnection cn = CreateConnection (qRef)) {
                                using (IModel model = cn.CreateModel ()) {
                                        model.QueueDelete (qRef.Queue, false, false, false);
                                }
@@ -213,10 +211,8 @@ namespace Mono.Messaging.RabbitMQ {
                        if (msg.BodyStream == null)
                                throw new ArgumentException ("Message is not serialized properly");
                
-                       ConnectionFactory cf = new ConnectionFactory ();
-                       
                        try {
-                               using (IConnection cn = cf.CreateConnection (QRef.Host)) {
+                               using (IConnection cn = CreateConnection (QRef)) {
                                        SetDeliveryInfo (msg, GetVersion (cn), null);
                                        using (IModel ch = cn.CreateModel ()) {
                                                Send (ch, msg);
@@ -272,10 +268,8 @@ namespace Mono.Messaging.RabbitMQ {
                        else if (host != QRef.Host)
                                throw new MonoMessagingException ("Transactions can not span multiple hosts");
                        
-                       if (cn == null) {
-                               ConnectionFactory cf = new ConnectionFactory ();
-                               cn = cf.CreateConnection (host);
-                       }
+                       if (cn == null)
+                               cn = CreateConnection (QRef);
                        
                        if (model == null) {
                                model = cn.CreateModel ();
@@ -298,9 +292,7 @@ namespace Mono.Messaging.RabbitMQ {
                
                public void Purge ()
                {
-                       ConnectionFactory cf = new ConnectionFactory ();
-
-                       using (IConnection cn = cf.CreateConnection (QRef.Host)) {
+                       using (IConnection cn = CreateConnection (QRef)) {
                                using (IModel model = cn.CreateModel ()) {
                                        model.QueuePurge (QRef.Queue, false);
                                }
@@ -309,9 +301,7 @@ namespace Mono.Messaging.RabbitMQ {
                
                public IMessage Peek ()
                {
-                       ConnectionFactory cf = new ConnectionFactory ();
-
-                       using (IConnection cn = cf.CreateConnection (QRef.Host)) {
+                       using (IConnection cn = CreateConnection (QRef)) {
                                using (IModel ch = cn.CreateModel ()) {
                                        return Receive (ch, -1, false);
                                }
@@ -488,8 +478,7 @@ namespace Mono.Messaging.RabbitMQ {
                
                private IMessage Run (RecieveDelegate r)
                {
-                       ConnectionFactory cf = new ConnectionFactory ();
-                       using (IConnection cn = cf.CreateConnection (QRef.Host)) {
+                       using (IConnection cn = CreateConnection (QRef)) {
                                using (IModel model = cn.CreateModel ()) {
                                        return r (this, model);
                                }
@@ -514,10 +503,8 @@ namespace Mono.Messaging.RabbitMQ {
                                else if (host != q.QRef.Host)
                                        throw new MonoMessagingException ("Transactions can not span multiple hosts");
                                
-                               if (cn == null) {
-                                       ConnectionFactory cf = new ConnectionFactory ();
-                                       cn = cf.CreateConnection (host);
-                               }
+                               if (cn == null)
+                                       cn = CreateConnection (q.QRef);
                                
                                if (model == null) {
                                        model = cn.CreateModel ();
@@ -679,6 +666,13 @@ namespace Mono.Messaging.RabbitMQ {
                private RabbitMQMessageQueueTransaction GetTx ()
                {
                        return (RabbitMQMessageQueueTransaction) provider.CreateMessageQueueTransaction ();
+               }
+
+               private static IConnection CreateConnection (QueueReference qRef)
+               {
+                       ConnectionFactory cf = new ConnectionFactory ();
+                       cf.Address = qRef.Host;
+                       return cf.CreateConnection ();
                }               
        }
 }
index 38b25b8f6b5758e7598a508ace89217a47a0970c..beade138412b03709423e736eea8a77f0fac52a9 100644 (file)
@@ -1,3 +1,7 @@
+2010-06-23  Michael Barker  <mike@middlesoft.co.uk>
+
+       * Updated to version 1.8 of the RabbitMQ libraries
+         
 2009-12-23  Jo Shields  <directhex@apebox.org>
 
        * docs/specs/Makefile: Use compiled Mono, not system Mono (fixes 
index 0e1c454af0d29b7a1d204c2d58ae8425c017e1b3..369994400c2cbd43b54396cc21b465dc7117652e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index b71c13cde214eec712ba0ab668f8217b2005ece1..f46f31eaebddfdb67e5bbb771cba457cd5aeb4b5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index b69aef194c5a7cb32e90745be71f80123038dcf2..414c821a996dfc5b2013681c501dccdadec20cbe 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index c21aecc853631ba80087bd6fa2f38a6cd602c403..29b872a7281578f6852faa6b678684d79a7073c5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index bf0fbb45c6f8bf3d6159038aeef9778cef8c159f..5539fea58542a651bacf83c80fae6f99cd4f8978 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -347,6 +347,63 @@ namespace RabbitMQ.Client.Apigen {
         public void EmitPrelude() {
             EmitLine("// Autogenerated code. Do not edit.");
             EmitLine("");
+            EmitLine("// This source code is dual-licensed under the Apache License, version");
+            EmitLine("// 2.0, and the Mozilla Public License, version 1.1.");
+            EmitLine("//");
+            EmitLine("// The APL v2.0:");
+            EmitLine("//");
+            EmitLine("//---------------------------------------------------------------------------");
+            EmitLine("//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial");
+            EmitLine("//   Technologies LLC., and Rabbit Technologies Ltd.");
+            EmitLine("//");
+            EmitLine("//   Licensed under the Apache License, Version 2.0 (the \"License\");");
+            EmitLine("//   you may not use this file except in compliance with the License.");
+            EmitLine("//   You may obtain a copy of the License at");
+            EmitLine("//");
+            EmitLine("//       http://www.apache.org/licenses/LICENSE-2.0");
+            EmitLine("//");
+            EmitLine("//   Unless required by applicable law or agreed to in writing, software");
+            EmitLine("//   distributed under the License is distributed on an \"AS IS\" BASIS,");
+            EmitLine("//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+            EmitLine("//   See the License for the specific language governing permissions and");
+            EmitLine("//   limitations under the License.");
+            EmitLine("//---------------------------------------------------------------------------");
+            EmitLine("//");
+            EmitLine("// The MPL v1.1:");
+            EmitLine("//");
+            EmitLine("//---------------------------------------------------------------------------");
+            EmitLine("//   The contents of this file are subject to the Mozilla Public License");
+            EmitLine("//   Version 1.1 (the \"License\"); you may not use this file except in");
+            EmitLine("//   compliance with the License. You may obtain a copy of the License at");
+            EmitLine("//   http://www.rabbitmq.com/mpl.html");
+            EmitLine("//");
+            EmitLine("//   Software distributed under the License is distributed on an \"AS IS\"");
+            EmitLine("//   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the");
+            EmitLine("//   License for the specific language governing rights and limitations");
+            EmitLine("//   under the License.");
+            EmitLine("//");
+            EmitLine("//   The Original Code is The RabbitMQ .NET Client.");
+            EmitLine("//");
+            EmitLine("//   The Initial Developers of the Original Code are LShift Ltd,");
+            EmitLine("//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.");
+            EmitLine("//");
+            EmitLine("//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,");
+            EmitLine("//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd");
+            EmitLine("//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial");
+            EmitLine("//   Technologies LLC, and Rabbit Technologies Ltd.");
+            EmitLine("//");
+            EmitLine("//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift");
+            EmitLine("//   Ltd. Portions created by Cohesive Financial Technologies LLC are");
+            EmitLine("//   Copyright (C) 2007-2010 Cohesive Financial Technologies");
+            EmitLine("//   LLC. Portions created by Rabbit Technologies Ltd are Copyright");
+            EmitLine("//   (C) 2007-2010 Rabbit Technologies Ltd.");
+            EmitLine("//");
+            EmitLine("//   All Rights Reserved.");
+            EmitLine("//");
+            EmitLine("//   Contributor(s): ______________________________________.");
+            EmitLine("//");
+            EmitLine("//---------------------------------------------------------------------------");
+            EmitLine("");
             EmitLine("using RabbitMQ.Client;");
             EmitLine("using RabbitMQ.Client.Exceptions;");
             EmitLine("");
@@ -482,6 +539,14 @@ namespace RabbitMQ.Client.Apigen {
                    EmitLine("    public "+maybeOverride+"void Clear"+MangleClass(f.Name)+"() { m_"+MangleMethod(f.Name)+"_present = false; }");
                }
             }
+
+            EmitLine("");
+            foreach (AmqpField f in c.m_Fields)
+            {
+                if (!IsBoolean(f))
+                    EmitLine("    public " + maybeOverride + "bool Is" + MangleClass(f.Name) + "Present() { return m_" + MangleMethod(f.Name) + "_present; }");
+            }
+
             EmitLine("");
             EmitLine("    public "+MangleClass(c.Name)+"Properties() {}");
             EmitLine("    public override int ProtocolClassId { get { return "+c.Index+"; } }");
index 2f4ed36868d3aaf3abd31b68ae644b798cec1c85..cb3fe2d42fb0d5380b7edb328a05c5ba0063308f 100644 (file)
 ./AssemblyInfo.cs
 ../../../../build/common/Consts.cs
-./messagepatterns/SimpleRpcServer.cs
-./messagepatterns/SimpleRpcClient.cs
-./messagepatterns/Subscription.cs
-./exceptions/AlreadyClosedException.cs
+./events/EventingBasicConsumer.cs
+./events/BasicDeliverEventHandler.cs
+./events/CallbackExceptionEventHandler.cs
+./events/BasicReturnEventHandler.cs
+./events/ModelShutdownEventHandler.cs
+./events/ConsumerEventHandler.cs
+./events/CallbackExceptionEventArgs.cs
+./events/BasicReturnEventArgs.cs
+./events/ConsumerEventArgs.cs
+./events/BasicDeliverEventArgs.cs
+./events/ConnectionShutdownEventHandler.cs
+./events/ConsumerShutdownEventHandler.cs
+./exceptions/ChannelAllocationException.cs
+./exceptions/UnexpectedMethodException.cs
 ./exceptions/PacketNotRecognizedException.cs
-./exceptions/UnsupportedMethodFieldException.cs
+./exceptions/PossibleAuthenticationFailureException.cs
 ./exceptions/WireFormattingException.cs
-./exceptions/BrokerUnreachableException.cs
+./exceptions/UnsupportedMethodFieldException.cs
 ./exceptions/ProtocolVersionMismatchException.cs
-./exceptions/ChannelAllocationException.cs
+./exceptions/AlreadyClosedException.cs
+./exceptions/BrokerUnreachableException.cs
 ./exceptions/UnsupportedMethodException.cs
 ./exceptions/OperationInterruptedException.cs
-./exceptions/UnexpectedMethodException.cs
-./content/PrimitiveParser.cs
-./content/MapMessageBuilder.cs
-./content/IMessageBuilder.cs
-./content/IBytesMessageBuilder.cs
-./content/BytesMessageBuilder.cs
-./content/IMessageReader.cs
-./content/BytesMessageReader.cs
-./content/BasicMessageReader.cs
-./content/IStreamMessageBuilder.cs
-./content/IBytesMessageReader.cs
-./content/BytesWireFormatting.cs
-./content/StreamWireFormatting.cs
-./content/StreamMessageBuilder.cs
-./content/StreamMessageReader.cs
-./content/IStreamMessageReader.cs
-./content/BasicMessageBuilder.cs
-./content/MapMessageReader.cs
-./content/IMapMessageReader.cs
-./content/IMapMessageBuilder.cs
-./content/MapWireFormatting.cs
-./impl/SyntaxError.cs
-./impl/MainSession.cs
-./impl/ConnectionStartDetails.cs
-./impl/RpcContinuationQueue.cs
-./impl/MethodArgumentReader.cs
-./impl/ShutdownContinuation.cs
-./impl/ProtocolException.cs
-./impl/ChannelErrorException.cs
-./impl/BodyTooLongException.cs
-./impl/CommandAssembler.cs
-./impl/SimpleBlockingRpcContinuation.cs
-./impl/ConnectionBase.cs
-./impl/FileProperties.cs
-./impl/MethodArgumentWriter.cs
-./impl/ModelBase.cs
-./impl/StreamProperties.cs
-./impl/v0_8qpid/Connection.cs
-./impl/v0_8qpid/ProtocolBase.cs
+./messagepatterns/SimpleRpcServer.cs
+./messagepatterns/Subscription.cs
+./messagepatterns/SimpleRpcClient.cs
 ./impl/SessionBase.cs
-./impl/IFrameHandler.cs
-./impl/SessionManager.cs
-./impl/Command.cs
-./impl/UnknownClassOrMethodException.cs
-./impl/v0_8/Connection.cs
-./impl/v0_8/ProtocolBase.cs
 ./impl/UnexpectedFrameException.cs
+./impl/ContentHeaderPropertyReader.cs
+./impl/ConnectionStartDetails.cs
+./impl/SessionManager.cs
 ./impl/AbstractProtocolBase.cs
-./impl/SocketFrameHandler_0_9.cs
-./impl/WireFormatting.cs
-./impl/RedirectException.cs
-./impl/ISession.cs
+./impl/MalformedFrameException.cs
+./impl/ModelBase.cs
+./impl/RpcContinuationQueue.cs
+./impl/ConnectionBase.cs
 ./impl/Session.cs
+./impl/ContentHeaderBase.cs
+./impl/WireFormatting.cs
+./impl/MethodArgumentReader.cs
+./impl/SimpleBlockingRpcContinuation.cs
 ./impl/QuiescingSession.cs
+./impl/ContentHeaderPropertyWriter.cs
+./impl/ChannelErrorException.cs
+./impl/SoftProtocolException.cs
 ./impl/v0_9/Connection.cs
 ./impl/v0_9/ProtocolBase.cs
-./impl/BasicProperties.cs
-./impl/Frame.cs
-./impl/SoftProtocolException.cs
-./impl/MalformedFrameException.cs
+./impl/MethodArgumentWriter.cs
+./impl/ShutdownContinuation.cs
+./impl/SyntaxError.cs
 ./impl/HardProtocolException.cs
+./impl/v0_8/Connection.cs
+./impl/v0_8/ProtocolBase.cs
+./impl/UnknownClassOrMethodException.cs
+./impl/MainSession.cs
+./impl/FileProperties.cs
+./impl/BasicProperties.cs
+./impl/ISession.cs
+./impl/Command.cs
+./impl/v0_8qpid/Connection.cs
+./impl/v0_8qpid/ProtocolBase.cs
 ./impl/IRpcContinuation.cs
-./impl/ContentHeaderBase.cs
-./impl/ContentHeaderPropertyWriter.cs
+./impl/RedirectException.cs
+./impl/SocketFrameHandler_0_9.cs
+./impl/ProtocolException.cs
+./impl/Frame.cs
 ./impl/MethodBase.cs
-./impl/ContentHeaderPropertyReader.cs
-./events/CallbackExceptionEventArgs.cs
-./events/ConsumerEventHandler.cs
-./events/BasicDeliverEventHandler.cs
-./events/BasicReturnEventHandler.cs
-./events/ConsumerEventArgs.cs
-./events/BasicReturnEventArgs.cs
-./events/ModelShutdownEventHandler.cs
-./events/ConnectionShutdownEventHandler.cs
-./events/EventingBasicConsumer.cs
-./events/ConsumerShutdownEventHandler.cs
-./events/BasicDeliverEventArgs.cs
-./events/CallbackExceptionEventHandler.cs
-./api/Protocols.cs
-./api/PublicationAddress.cs
-./api/ShutdownReportEntry.cs
+./impl/IFrameHandler.cs
+./impl/CommandAssembler.cs
+./impl/StreamProperties.cs
+./content/BasicMessageReader.cs
+./content/BytesWireFormatting.cs
+./content/IMessageBuilder.cs
+./content/StreamMessageBuilder.cs
+./content/IMessageReader.cs
+./content/IMapMessageReader.cs
+./content/IBytesMessageBuilder.cs
+./content/BasicMessageBuilder.cs
+./content/StreamMessageReader.cs
+./content/MapMessageReader.cs
+./content/StreamWireFormatting.cs
+./content/IMapMessageBuilder.cs
+./content/PrimitiveParser.cs
+./content/MapMessageBuilder.cs
+./content/MapWireFormatting.cs
+./content/IBytesMessageReader.cs
+./content/IStreamMessageReader.cs
+./content/IStreamMessageBuilder.cs
+./content/BytesMessageBuilder.cs
+./content/BytesMessageReader.cs
+./api/SslHelper.cs
+./api/IConnection.cs
+./api/IModel.cs
+./api/AmqpTimestamp.cs
 ./api/IFileProperties.cs
+./api/PublicationAddress.cs
 ./api/QueueingBasicConsumer.cs
-./api/AmqpTimestamp.cs
-./api/IMethod.cs
-./api/ConnectionParameters.cs
+./api/AmqpVersion.cs
+./api/IProtocol.cs
+./api/IBasicConsumer.cs
+./api/ExchangeType.cs
 ./api/AmqpTcpEndpoint.cs
+./api/IBasicProperties.cs
 ./api/IContentHeader.cs
+./api/IMethod.cs
+./api/ShutdownReportEntry.cs
+./api/ShutdownEventArgs.cs
+./api/IStreamProperties.cs
+./api/Protocols.cs
+./api/ShutdownInitiator.cs
 ./api/DefaultBasicConsumer.cs
-./api/ExchangeType.cs
-./api/IProtocol.cs
+./api/SslOption.cs
 ./api/BinaryTableValue.cs
-./api/AmqpVersion.cs
-./api/IBasicConsumer.cs
-./api/IConnection.cs
-./api/ShutdownInitiator.cs
-./api/IModel.cs
 ./api/ConnectionFactory.cs
-./api/IStreamProperties.cs
-./api/IBasicProperties.cs
-./api/ShutdownEventArgs.cs
 ../util/DebugUtil.cs
 ../util/NetworkBinaryReader.cs
 ../util/NetworkBinaryWriter.cs
 ../util/Either.cs
 ../util/SharedQueue.cs
 ../util/XmlUtil.cs
+../util/IntAllocator.cs
 ../../docs/specs/autogenerated-api-0-9.cs
 ../../docs/specs/autogenerated-api-0-8.cs
 ../../docs/specs/autogenerated-api-qpid-0-8.cs
diff --git a/mcs/class/RabbitMQ.Client/src/client/api/AccessRequestConfig.cs b/mcs/class/RabbitMQ.Client/src/client/api/AccessRequestConfig.cs
deleted file mode 100644 (file)
index c17091d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// This source code is dual-licensed under the Apache License, version
-// 2.0, and the Mozilla Public License, version 1.1.
-//
-// The APL v2.0:
-//
-//---------------------------------------------------------------------------
-//   Copyright (C) 2007, 2008 LShift Ltd., Cohesive Financial
-//   Technologies LLC., and Rabbit Technologies Ltd.
-//
-//   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.
-//---------------------------------------------------------------------------
-//
-// The MPL v1.1:
-//
-//---------------------------------------------------------------------------
-//   The contents of this file are subject to the Mozilla Public License
-//   Version 1.1 (the "License"); you may not use this file except in
-//   compliance with the License. You may obtain a copy of the License at
-//   http://www.rabbitmq.com/mpl.html
-//
-//   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 RabbitMQ .NET Client.
-//
-//   The Initial Developers of the Original Code are LShift Ltd.,
-//   Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
-//
-//   Portions created by LShift Ltd., Cohesive Financial Technologies
-//   LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007, 2008
-//   LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
-//   Technologies Ltd.;
-//
-//   All Rights Reserved.
-//
-//   Contributor(s): ______________________________________.
-//
-//---------------------------------------------------------------------------
-namespace RabbitMQ.Client
-{
-
-    ///<summary>Used within ConnectionParameters to control
-    ///suppression of Access.Request calls.</summary>
-    public enum AccessRequestConfig
-    {
-
-        ///<summary>Uses the default for the protocol variant
-        ///selected.</summary>
-        UseDefault,
-
-        ///<summary>Overrides the protocol's default, causing
-        ///Access.Request methods to be sent to the peer when
-        ///IModel.AccessRequest is called.</summary>
-        Enable,
-
-        ///<summary>Overrides the protocol's default, preventing
-        ///Access.Request methods from being sent to the
-        ///peer.</summary>
-        Suppress
-    };
-}
index 197bf686af61011cb1532c1a4c08ddaecde1a722..fe30a574e54124e0c5e34d34b643f899c694cb36 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -63,8 +63,19 @@ namespace RabbitMQ.Client
     ///<summary>Represents a TCP-addressable AMQP peer, including the
     ///protocol variant to use, and a host name and port
     ///number.</summary>
+    ///<para>
+    /// Some of the constructors take, as a convenience, a System.Uri
+    /// instance representing an AMQP server address. The use of Uri
+    /// here is not standardised - Uri is simply a convenient
+    /// container for internet-address-like components. In particular,
+    /// the Uri "Scheme" property is ignored: only the "Host" and
+    /// "Port" properties are extracted.
+    ///</para>
     public class AmqpTcpEndpoint
     {
+        ///<summary>Indicates that the default port for the protocol should be used</summary>
+        public const int UseDefaultPort = -1;
+
         private IProtocol m_protocol;
         ///<summary>Retrieve or set the IProtocol of this AmqpTcpEndpoint.</summary>
         public IProtocol Protocol
@@ -87,19 +98,117 @@ namespace RabbitMQ.Client
         ///port number for the IProtocol to be used.</summary>
         public int Port
         {
-            get { return (m_port == -1) ? m_protocol.DefaultPort : m_port; }
+            get { return (m_port == UseDefaultPort) ? m_protocol.DefaultPort : m_port; }
             set { m_port = value; }
         }
 
+
+        private SslOption m_ssl;
+        ///<summary>Retrieve the SSL options for this AmqpTcpEndpoint.
+        ///If not set, null is returned</summary>
+        public SslOption Ssl
+        {
+            get { return m_ssl; }
+            set { m_ssl = value; }
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///IProtocol, hostname, port number and ssl option. If the port 
+        ///number is -1, the default port number for the IProtocol 
+        ///will be used.</summary>
+        public AmqpTcpEndpoint(IProtocol protocol, string hostName, int portOrMinusOne, SslOption ssl)
+        {
+            m_protocol = protocol;
+            m_hostName = hostName;
+            m_port = portOrMinusOne;
+            m_ssl = ssl;
+        }
+
         ///<summary>Construct an AmqpTcpEndpoint with the given
         ///IProtocol, hostname, and port number. If the port number is
         ///-1, the default port number for the IProtocol will be
         ///used.</summary>
-        public AmqpTcpEndpoint(IProtocol protocolVariant, string hostname, int portOrMinusOne)
+        public AmqpTcpEndpoint(IProtocol protocol, string hostName, int portOrMinusOne) :
+            this(protocol, hostName, portOrMinusOne, new SslOption())
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///IProtocol and hostname, using the default port for the
+        ///IProtocol.</summary>
+        public AmqpTcpEndpoint(IProtocol protocol, string hostName) :
+            this(protocol, hostName, -1)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///IProtocol, "localhost" as the hostname, and using the
+        ///default port for the IProtocol.</summary>
+        public AmqpTcpEndpoint(IProtocol protocol) :
+            this(protocol, "localhost", -1)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///hostname and port number, using the IProtocol from
+        ///Protocols.FromEnvironment(). If the port number is
+        ///-1, the default port number for the IProtocol will be
+        ///used.</summary>
+        public AmqpTcpEndpoint(string hostName, int portOrMinusOne) :
+            this(Protocols.FromEnvironment(), hostName, portOrMinusOne)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///hostname, using the IProtocol from
+        ///Protocols.FromEnvironment(), and the default port number of
+        ///that IProtocol.</summary>
+        public AmqpTcpEndpoint(string hostName) :
+            this(Protocols.FromEnvironment(), hostName)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with a hostname of
+        ///"localhost", using the IProtocol from
+        ///Protocols.FromEnvironment(), and the default port number of
+        ///that IProtocol.</summary>
+        public AmqpTcpEndpoint() :
+            this(Protocols.FromEnvironment())
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///IProtocol, Uri and ssl options.</summary>
+        ///<remarks>
+        /// Please see the class overview documentation for
+        /// information about the Uri format in use.
+        ///</remarks>
+        public AmqpTcpEndpoint(IProtocol protocol, Uri uri, SslOption ssl) :
+            this(protocol, uri.Host, uri.Port, ssl)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///IProtocol and Uri.</summary>
+        ///<remarks>
+        /// Please see the class overview documentation for
+        /// information about the Uri format in use.
+        ///</remarks>
+        public AmqpTcpEndpoint(IProtocol protocol, Uri uri) :
+            this(protocol, uri.Host, uri.Port)
+        {
+        }
+
+        ///<summary>Construct an AmqpTcpEndpoint with the given
+        ///Uri, using the IProtocol from
+        ///Protocols.FromEnvironment().</summary>
+        ///<remarks>
+        /// Please see the class overview documentation for
+        /// information about the Uri format in use.
+        ///</remarks>
+        public AmqpTcpEndpoint(Uri uri) :
+            this(Protocols.FromEnvironment(), uri)
         {
-            m_protocol = protocolVariant;
-            m_hostName = hostname;
-            m_port = portOrMinusOne;
         }
 
         ///<summary>Returns a URI-like string of the form
index 0b930f5aba106a295a1a3e94189a462b860ad801..359344a8ea5654b5cdadea4122f89d1c7d105e70 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 77ae1801be105bdd7c2b9f0a304c015dd3cd6f0f..3c074f531d4b29fe0ee1f733daf372b9be7f038f 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 00ff7ff69d8509b3468e9a297b0597e9bfb0746b..f6b8250fa89ee9aa61e4ec22bfe7aa47cc47ac86 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1500f8f7c37b0736e6e387978322887a7f6a8fd0..309e58fd8733b04d5c08215d0f0dae6463a858a2 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -74,20 +74,22 @@ namespace RabbitMQ.Client
     ///<example><code>
     ///     ConnectionFactory factory = new ConnectionFactory();
     ///     //
-    ///     // The next three lines are optional:
-    ///     factory.Parameters.UserName = ConnectionParameters.DefaultUser;
-    ///     factory.Parameters.Password = ConnectionParameters.DefaultPass;
-    ///     factory.Parameters.VirtualHost = ConnectionParameters.DefaultVHost;
+    ///     // The next six lines are optional:
+    ///     factory.UserName = ConnectionFactory.DefaultUser;
+    ///     factory.Password = ConnectionFactory.DefaultPass;
+    ///     factory.VirtualHost = ConnectionFactory.DefaultVHost;
+    ///     factory.Protocol = Protocols.FromEnvironment();
+    ///     factory.HostName = hostName;
+    ///     factory.PortNumber = AmqpTcpEndpoint.UseDefaultPort;
     ///     //
-    ///     IProtocol protocol = Protocols.DefaultProtocol;
-    ///     IConnection conn = factory.CreateConnection(protocol, hostName, portNumber);
+    ///     IConnection conn = factory.CreateConnection();
     ///     //
     ///     IModel ch = conn.CreateModel();
     ///     //
     ///     // ... use ch's IModel methods ...
     ///     //
-    ///     ch.Close(200, "Closing the channel");
-    ///     conn.Close(200, "Closing the connection");
+    ///     ch.Close(Constants.ReplySuccess, "Closing the channel");
+    ///     conn.Close(Constants.ReplySuccess, "Closing the connection");
     ///</code></example>
     ///<para>
     /// Please see also the API overview and tutorial in the User Guide.
@@ -103,23 +105,97 @@ namespace RabbitMQ.Client
     ///</remarks>
     public class ConnectionFactory
     {
-        private ConnectionParameters m_parameters = new ConnectionParameters();
-        ///<summary>Retrieve the parameters this factory uses to
-        ///construct IConnection instances.</summary>
-        public ConnectionParameters Parameters
-        {
-            get
-            {
-                return m_parameters;
-            }
+        /// <summary>Default user name (value: "guest")</summary>
+        public const string DefaultUser = "guest"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary>Default password (value: "guest")</summary>
+        public const string DefaultPass = "guest"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary>Default virtual host (value: "/")</summary>
+        public const string DefaultVHost = "/"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary> Default value for the desired maximum channel
+        /// number, with zero meaning unlimited (value: 0)</summary>
+        public const ushort DefaultChannelMax = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary>Default value for the desired maximum frame size,
+        /// with zero meaning unlimited (value: 0)</summary>
+        public const uint DefaultFrameMax = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary>Default value for desired heartbeat interval, in
+        /// seconds, with zero meaning none (value: 0)</summary>
+        public const ushort DefaultHeartbeat = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
+
+        /// <summary>Username to use when authenticating to the server</summary>
+        public string UserName = DefaultUser;
+
+        /// <summary>Password to use when authenticating to the server</summary>
+        public string Password = DefaultPass;
+
+        /// <summary>Virtual host to access during this connection</summary>
+        public string VirtualHost = DefaultVHost;
+
+        /// <summary>Maximum channel number to ask for</summary>
+        public ushort RequestedChannelMax = DefaultChannelMax;
+
+        /// <summary>Frame-max parameter to ask for (in bytes)</summary>
+        public uint RequestedFrameMax = DefaultFrameMax;
+
+        /// <summary>Heartbeat setting to request (in seconds)</summary>
+        public ushort RequestedHeartbeat = DefaultHeartbeat;
+
+        /// <summary>Dictionary of client properties to be sent to the
+        /// server</summary>
+        public IDictionary ClientProperties = ConnectionBase.DefaultClientProperties();
+
+        ///<summary>Ssl options setting</summary>
+        public SslOption Ssl = new SslOption();
+
+        ///<summary>The host to connect to</summary>
+        public String HostName = "localhost";
+
+        ///<summary>The port to connect on. AmqpTcpEndpoint.UseDefaultPort indicates the 
+        /// default for the protocol should be used.</summary>
+        public int Port = AmqpTcpEndpoint.UseDefaultPort;
+
+        ///<summary>The AMQP protocol to be used</summary>
+        public IProtocol Protocol = Protocols.FromEnvironment();
+
+        public AmqpTcpEndpoint Endpoint
+        { 
+          get
+          { 
+              return new AmqpTcpEndpoint(Protocol, HostName, Port); 
+          }
+          set
+          {
+              Protocol = value.Protocol;
+              Port = value.Port;
+              HostName = value.HostName;
+          }
         }
 
-        ///<summary>Constructs a ConnectionFactory with default values
-        ///for Parameters.</summary>
-        public ConnectionFactory()
+        public String Address
         {
+          get
+          { 
+              String result = HostName;
+              if(Port != AmqpTcpEndpoint.UseDefaultPort)
+              {
+                  result += (":" + Port);
+              }
+              return result;
+          }
+          set
+          {
+              Endpoint = AmqpTcpEndpoint.Parse(Protocol, value);
+          }      
         }
 
+        ///<summary>Construct a fresh instance, with all fields set to
+        ///their respective defaults.</summary>
+        public ConnectionFactory() { }
+
         protected virtual IConnection FollowRedirectChain
             (int maxRedirects,
              IDictionary connectionAttempts,
@@ -144,7 +220,7 @@ namespace RabbitMQ.Client
                         // and fully open a successful connection,
                         // in which case we're done, and the
                         // connection should be returned.
-                        return p.CreateConnection(m_parameters, insist, fh);
+                        return p.CreateConnection(this, insist, fh);
                     } catch (RedirectException re) {
                         if (insist) {
                             // We've been redirected, but we insisted that
@@ -230,78 +306,25 @@ namespace RabbitMQ.Client
         ///endpoint in the list provided. Up to a maximum of
         ///maxRedirects broker-originated redirects are permitted for
         ///each endpoint tried.</summary>
-        public virtual IConnection CreateConnection(int maxRedirects,
-                                                    params AmqpTcpEndpoint[] endpoints)
+        public virtual IConnection CreateConnection(int maxRedirects)
         {
             IDictionary connectionAttempts = new Hashtable();
             IDictionary connectionErrors = new Hashtable();
             IConnection conn = CreateConnection(maxRedirects,
                                                 connectionAttempts,
                                                 connectionErrors,
-                                                endpoints);
+                                                new AmqpTcpEndpoint[]{Endpoint});
             if (conn != null) {
                 return conn;
             }
             throw new BrokerUnreachableException(connectionAttempts, connectionErrors);
         }
 
-        ///<summary>Create a connection to the first available
-        ///endpoint in the list provided. No broker-originated
-        ///redirects are permitted.</summary>
-        public virtual IConnection CreateConnection(params AmqpTcpEndpoint[] endpoints)
-        {
-            return CreateConnection(0, endpoints);
-        }
-
-        ///<summary>Create a connection to the endpoint specified.</summary>
-        ///<exception cref="ArgumentException"/>
-        public IConnection CreateConnection(IProtocol version,
-                                            string hostName,
-                                            int portNumber)
-        {
-            return CreateConnection(new AmqpTcpEndpoint[] {
-                                        new AmqpTcpEndpoint(version, hostName, portNumber)
-                                    });
-        }
-
-        ///<summary>Create a connection to the endpoint specified. The
-        ///port used is the default for the protocol.</summary>
-        ///<exception cref="ArgumentException"/>
-        public IConnection CreateConnection(IProtocol version, string hostName)
+        ///<summary>Create a connection to the specified endpoint
+        ///No broker-originated redirects are permitted.</summary>
+        public virtual IConnection CreateConnection()
         {
-            return CreateConnection(version, hostName, -1);
-        }
-
-        ///<summary>Create a connection to the endpoint specified.</summary>
-        ///<remarks>
-        /// Please see the class overview documentation for
-        /// information about the Uri format in use.
-        ///</remarks>
-        ///<exception cref="ArgumentException"/>
-        public IConnection CreateConnection(IProtocol version, Uri uri)
-        {
-            return CreateConnection(version, uri.Host, uri.Port);
-        }
-
-        ///<summary>Create a connection to the endpoint specified,
-        ///with the IProtocol from
-        ///Protocols.FromEnvironment().</summary>
-        ///<remarks>
-        /// Please see the class overview documentation for
-        /// information about the Uri format in use.
-        ///</remarks>
-        public IConnection CreateConnection(Uri uri)
-        {
-            return CreateConnection(Protocols.FromEnvironment(), uri.Host, uri.Port);
-        }
-
-        ///<summary>Create a connection to the host (and optional
-        ///port) specified, with the IProtocol from
-        ///Protocols.FromEnvironment(). The format of the address
-        ///string is the same as that accepted by
-        ///AmqpTcpEndpoint.Parse().</summary>
-        public IConnection CreateConnection(string address) {
-            return CreateConnection(AmqpTcpEndpoint.Parse(Protocols.FromEnvironment(), address));
+            return CreateConnection(0);
         }
     }
 }
diff --git a/mcs/class/RabbitMQ.Client/src/client/api/ConnectionParameters.cs b/mcs/class/RabbitMQ.Client/src/client/api/ConnectionParameters.cs
deleted file mode 100644 (file)
index 4c64711..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-// This source code is dual-licensed under the Apache License, version
-// 2.0, and the Mozilla Public License, version 1.1.
-//
-// The APL v2.0:
-//
-//---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
-//   Technologies LLC., and Rabbit Technologies Ltd.
-//
-//   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.
-//---------------------------------------------------------------------------
-//
-// The MPL v1.1:
-//
-//---------------------------------------------------------------------------
-//   The contents of this file are subject to the Mozilla Public License
-//   Version 1.1 (the "License"); you may not use this file except in
-//   compliance with the License. You may obtain a copy of the License at
-//   http://www.rabbitmq.com/mpl.html
-//
-//   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 RabbitMQ .NET Client.
-//
-//   The Initial Developers of the Original Code are LShift Ltd,
-//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
-//
-//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
-//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
-//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
-//   Technologies LLC, and Rabbit Technologies Ltd.
-//
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
-//   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
-//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
-//
-//   All Rights Reserved.
-//
-//   Contributor(s): ______________________________________.
-//
-//---------------------------------------------------------------------------
-using System;
-
-namespace RabbitMQ.Client
-{
-    ///<summary>Supplies values to ConnectionFactory for use in
-    ///constructing IConnection instances.</summary>
-    public class ConnectionParameters : ICloneable
-    {
-        /// <summary>Default user name (value: "guest")</summary>
-        public const string DefaultUser = "guest"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        /// <summary>Default password (value: "guest")</summary>
-        public const string DefaultPass = "guest"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        /// <summary>Default virtual host (value: "/")</summary>
-        public const string DefaultVHost = "/"; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        /// <summary> Default value for the desired maximum channel
-        /// number, with zero meaning unlimited (value: 0)</summary>
-        public const ushort DefaultChannelMax = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        /// <summary>Default value for the desired maximum frame size,
-        /// with zero meaning unlimited (value: 0)</summary>
-        public const uint DefaultFrameMax = 0; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        /// <summary>Default value for desired heartbeat interval, in
-        /// seconds, with zero meaning none (value: 3)</summary>
-        public const ushort DefaultHeartbeat = 3; // PLEASE KEEP THIS MATCHING THE DOC ABOVE
-
-        private string m_userName = DefaultUser;
-        private string m_password = DefaultPass;
-        private string m_virtualHost = DefaultVHost;
-        private ushort m_requestedChannelMax = DefaultChannelMax;
-        private uint m_requestedFrameMax = DefaultFrameMax;
-        private ushort m_requestedHeartbeat = DefaultHeartbeat;
-
-        ///<summary>Construct a fresh instance, with all fields set to
-        ///their respective defaults.</summary>
-        public ConnectionParameters() { }
-
-        /// <summary>Username to use when authenticating to the server</summary>
-        public string UserName
-        {
-            get { return m_userName; }
-            set { m_userName = value; }
-        }
-
-        /// <summary>Password to use when authenticating to the server</summary>
-        public string Password
-        {
-            get { return m_password; }
-            set { m_password = value; }
-        }
-
-        /// <summary>Virtual host to access during this connection</summary>
-        public string VirtualHost
-        {
-            get { return m_virtualHost; }
-            set { m_virtualHost = value; }
-        }
-
-        /// <summary>Maximum channel number to ask for</summary>
-        public ushort RequestedChannelMax
-        {
-            get { return m_requestedChannelMax; }
-            set { m_requestedChannelMax = value; }
-        }
-
-        /// <summary>Frame-max parameter to ask for (in bytes)</summary>
-        public uint RequestedFrameMax
-        {
-            get { return m_requestedFrameMax; }
-            set { m_requestedFrameMax = value; }
-        }
-
-        /// <summary>Heartbeat setting to request (in seconds)</summary>
-        public ushort RequestedHeartbeat
-        {
-            get { return m_requestedHeartbeat; }
-            set { m_requestedHeartbeat = value; }
-        }
-
-        ///<summary>Implement ICloneable.Clone by delegating to our type-safe variant.</summary>
-        object ICloneable.Clone()
-        {
-            return ((ConnectionParameters)this).Clone();
-        }
-
-        ///<summary>Returns a fresh ConnectionParameters with the same values as this.</summary>
-        public ConnectionParameters Clone()
-        {
-            ConnectionParameters n = this.MemberwiseClone() as ConnectionParameters;
-            return n;
-        }
-    }
-}
index 74ab8ca8a94dfb8be0c3d11e422c0bb59d7f0087..7ee981fabb5a594117c5d23c1ae50e58374371b5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 4422beaf772ff508290c8c31ec4cc4986d04230a..253dd393c3797a7b2257827518bcf8952e17572c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 2be582a6e11796a6d02fd2df5c312cdc22fa4264..6d8871fb3951ff0791c7cd1bd18314d4d660cec9 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1784c0f02ed0f5efb35d1f96b65ff5cb52f60563..0f3fbd149e5ceba0e18dc84cb09a19bb781b6317 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -162,6 +162,48 @@ namespace RabbitMQ.Client
         ///<summary> Clear the ClusterId property. </summary>
         void ClearClusterId();
 
+        ///<summary> Returns true iff the ContentType property is present. </summary>
+        bool IsContentTypePresent();
+
+        ///<summary> Returns true iff the ContentEncoding property is present. </summary>
+        bool IsContentEncodingPresent();
+
+        ///<summary> Returns true iff the Headers property is present. </summary>
+        bool IsHeadersPresent();
+
+        ///<summary> Returns true iff the DeliveryMode property is present. </summary>
+        bool IsDeliveryModePresent();
+
+        ///<summary> Returns true iff the Priority property is present. </summary>
+        bool IsPriorityPresent();
+
+        ///<summary> Returns true iff the CorrelationId property is present. </summary>
+        bool IsCorrelationIdPresent();
+
+        ///<summary> Returns true iff the ReplyTo property is present. </summary>
+        bool IsReplyToPresent();
+
+        ///<summary> Returns true iff the Expiration property is present. </summary>
+        bool IsExpirationPresent();
+
+        ///<summary> Returns true iff the MessageId property is present. </summary>
+        bool IsMessageIdPresent();
+
+        ///<summary> Returns true iff the Timestamp property is present. </summary>
+        bool IsTimestampPresent();
+
+        ///<summary> Returns true iff the Type property is present. </summary>
+        bool IsTypePresent();
+
+        ///<summary> Returns true iff the UserId property is present. </summary>
+        bool IsUserIdPresent();
+
+        ///<summary> Returns true iff the AppId property is present. </summary>
+        bool IsAppIdPresent();
+
+        ///<summary> Returns true iff the ClusterId property is present. </summary>
+        bool IsClusterIdPresent();
+
         ///<summary>Convenience property; parses ReplyTo property
         ///using PublicationAddress.Parse, and serializes it using
         ///PublicationAddress.ToString. Returns null if ReplyTo property
index 2d1c2c1ef1257b1a3aff59dda5f27e72b4fe431e..013de61dc433e07d7d2d13a80b9ecabf4e917885 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -103,10 +103,6 @@ namespace RabbitMQ.Client
         ///communicate with its peer.</summary>
         IProtocol Protocol { get; }
 
-        ///<summary>The connection parameters used during construction
-        ///of this connection.</summary>
-        ConnectionParameters Parameters { get; }
-
         ///<summary>The maximum channel number this connection
         ///supports (0 if unlimited). Usable channel numbers
         ///range from 1 to this number, inclusive.</summary>
@@ -120,6 +116,15 @@ namespace RabbitMQ.Client
         ///(0 for disabled), in seconds.</summary>
         ushort Heartbeat { get; }
 
+        ///<summary>A copy of the client properties that has been sent to the
+        ///server.</summary>
+        IDictionary ClientProperties { get; }
+
+        ///<summary>A dictionary of the server properties sent by the server
+        ///while establishing the connection. This typically includes
+        ///the product name and version of the server.</summary>
+        IDictionary ServerProperties { get; }
+
         ///<summary>Returns the known hosts that came back from the
         ///broker in the connection.open-ok method at connection
         ///startup time. Null until the connection is completely open
index d301e456e43a258a105cbd3806819838e47c27ca..a1e0e893695c08ee8e81eab2cff5aec4784beba5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
 //   Contributor(s): ______________________________________.
 //
 //---------------------------------------------------------------------------
+using System;
+
 namespace RabbitMQ.Client
 {
     ///<summary>A decoded AMQP content header frame.</summary>
-    public interface IContentHeader
+    public interface IContentHeader : ICloneable
     {
         ///<summary>Retrieve the AMQP class ID of this content header.</summary>
         int ProtocolClassId { get; }
index ea7132b6b2f78a7dc869a3e6a46159d41cdd1640..4404a4667cb61aa66d60b60f6eecb3657c6f3457 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -131,5 +131,32 @@ namespace RabbitMQ.Client
 
         ///<summary> Clear the ClusterId property. </summary>
         void ClearClusterId();
+
+        ///<summary> Returns true iff the ContentType property is present. </summary>
+        bool IsContentTypePresent();
+
+        ///<summary> Returns true iff the ContentEncoding property is present. </summary>
+        bool IsContentEncodingPresent();
+
+        ///<summary> Returns true iff the Headers property is present. </summary>
+        bool IsHeadersPresent();
+
+        ///<summary> Returns true iff the Priority property is present. </summary>
+        bool IsPriorityPresent();
+
+        ///<summary> Returns true iff the ReplyTo property is present. </summary>
+        bool IsReplyToPresent();
+
+        ///<summary> Returns true iff the MessageId property is present. </summary>
+        bool IsMessageIdPresent();
+
+        ///<summary> Returns true iff the Filename property is present. </summary>
+        bool IsFilenamePresent();
+
+        ///<summary> Returns true iff the Timestamp property is present. </summary>
+        bool IsTimestampPresent();
+
+        ///<summary> Returns true iff the ClusterId property is present. </summary>
+        bool IsClusterIdPresent();
     }
 }
\ No newline at end of file
index 30d347106cb439330d569df53883099979165e04..9344175ff1170fb1521899a7351daf415097f80d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 22080dcae1d4c71a8f583c408919fd8eb5f9c2df..fa7211666b42604ccff47cbb5b431b786ee384d3 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index c1f41a8dfc5794c5d77ec8e08ee74ef72832c65f..42e13a46b6e306923d141f1a0b6f90be9696a6ed 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -78,7 +78,7 @@ namespace RabbitMQ.Client
         ///<summary>Construct a connection from a given set of
         ///parameters and a frame handler. The "insist" parameter is
         ///passed on to the AMQP connection.open method.</summary>
-        IConnection CreateConnection(ConnectionParameters parameters,
+        IConnection CreateConnection(ConnectionFactory factory,
                                      bool insist,
                                      IFrameHandler frameHandler);
         ///<summary>Construct a protocol model atop a given session.</summary>
index fd783319e392679fdca9d26b6a2ae9bef7141ad9..23d949dd2f02f9fcc40f40d7675af493a7151bfb 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -107,5 +107,20 @@ namespace RabbitMQ.Client
 
         ///<summary> Clear the Timestamp property. </summary>
         void ClearTimestamp();
+
+        ///<summary> Returns true iff the ContentType property is present. </summary>
+        bool IsContentTypePresent();
+
+        ///<summary> Returns true iff the ContentEncoding property is present. </summary>
+        bool IsContentEncodingPresent();
+
+        ///<summary> Returns true iff the Headers property is present. </summary>
+        bool IsHeadersPresent();
+
+        ///<summary> Returns true iff the Priority property is present. </summary>
+        bool IsPriorityPresent();
+
+        ///<summary> Returns true iff the Timestamp property is present. </summary>
+        bool IsTimestampPresent();
     }
 }
index 69c5f3d741c715564fa6ba8e146c179da7d2210f..ad13b3adcb7d245b9ed68668e1c4fadf8d8661d4 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index f4f3d900418b9a8c5f4e931e3389d3bd4d45b485..6b3a91cd89026e4ff1dcc56bf343174498989927 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index a5c0347998616ec13c73538fa0128f4249da6245..b86003b8bce2b98fffbd11f5bede84cb9c1b72b6 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -76,8 +76,8 @@ namespace RabbitMQ.Client
     /// When the consumer is closed, through BasicCancel or through
     /// the shutdown of the underlying IModel or IConnection, the
     /// SharedQueue's Close() method is called, which causes any
-    /// threads blocked on the queue's Enqueue() or Dequeue()
-    /// operations to throw EndOfStreamException (see the comment for
+    /// Enqueue() operations, and Dequeue() operations when the queue
+    /// is empty, to throw EndOfStreamException (see the comment for
     /// SharedQueue.Close()).
     ///</para>
     ///<para>
index f9aec2029c76a7800997771a8c380b18fb0a8d37..7a0e0ace91fdc1be5f5604e453a38c7e968aa07f 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index f6c904573203cb5a9ad09b3e5b7585dacb2e7a7c..c925c64e9bfdafd92896538095eea188f917f26c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 420a794fdb3ff94aa765015a0ed927ffdc38812d..9641475f72e82158717ae98f416bdc2501767952 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
diff --git a/mcs/class/RabbitMQ.Client/src/client/api/SslHelper.cs b/mcs/class/RabbitMQ.Client/src/client/api/SslHelper.cs
new file mode 100644 (file)
index 0000000..9ec3c32
--- /dev/null
@@ -0,0 +1,128 @@
+// This source code is dual-licensed under the Apache License, version
+// 2.0, and the Mozilla Public License, version 1.1.
+//
+// The APL v2.0:
+//
+//---------------------------------------------------------------------------
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
+//   Technologies LLC., and Rabbit Technologies Ltd.
+//
+//   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.
+//---------------------------------------------------------------------------
+//
+// The MPL v1.1:
+//
+//---------------------------------------------------------------------------
+//   The contents of this file are subject to the Mozilla Public License
+//   Version 1.1 (the "License"); you may not use this file except in
+//   compliance with the License. You may obtain a copy of the License at
+//   http://www.rabbitmq.com/mpl.html
+//
+//   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 RabbitMQ .NET Client.
+//
+//   The Initial Developers of the Original Code are LShift Ltd,
+//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+//   Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
+//   Ltd. Portions created by Cohesive Financial Technologies LLC are
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
+//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
+//   (C) 2007-2010 Rabbit Technologies Ltd.
+//
+//   All Rights Reserved.
+//
+//   Contributor(s): ______________________________________.
+//
+//---------------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.IO;
+using System.Net.Security;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using RabbitMQ.Client.Impl;
+
+namespace RabbitMQ.Client
+{
+
+    ///<summary>Represents an SslHelper which does the actual heavy lifting
+    ///to set up an SSL connection, using the config options in an SslOption
+    ///to make things cleaner</summary>
+    public class SslHelper
+    {
+
+        private SslOption m_sslOption;
+
+        private X509Certificate CertificateSelectionCallback(object sender,
+                                                             string targetHost,
+                                                             X509CertificateCollection localCertificates,
+                                                             X509Certificate remoteCertificate,
+                                                             string[] acceptableIssuers)
+        {
+            if (acceptableIssuers != null && acceptableIssuers.Length > 0 &&
+                localCertificates != null && localCertificates.Count > 0)
+                {
+                    foreach (X509Certificate certificate in localCertificates)
+                        {
+                            if (Array.IndexOf(acceptableIssuers, certificate.Issuer) != -1)
+                                return certificate;
+                        }
+                }
+            if (localCertificates != null && localCertificates.Count > 0)
+                return localCertificates[0];
+
+            return null;
+        }
+
+        private bool CertificateValidationCallback(object sender,
+                                                   X509Certificate certificate,
+                                                   X509Chain chain,
+                                                   SslPolicyErrors sslPolicyErrors)
+        {
+            return (sslPolicyErrors & ~m_sslOption.AcceptablePolicyErrors) == SslPolicyErrors.None;
+        }
+
+        ///<summary>Upgrade a Tcp stream to an Ssl stream using the SSL options
+        ///provided</summary>
+        public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption)
+        {
+            SslHelper helper = new SslHelper(sslOption);
+            SslStream sslStream = new SslStream(tcpStream, false,
+                                                new RemoteCertificateValidationCallback(helper.CertificateValidationCallback),
+                                                new LocalCertificateSelectionCallback(helper.CertificateSelectionCallback));
+            
+            sslStream.AuthenticateAsClient(sslOption.ServerName,
+                                           sslOption.Certs,
+                                           sslOption.Version,
+                                           false);
+
+            return sslStream;
+        }
+
+        private SslHelper(SslOption sslOption)
+        {
+            m_sslOption = sslOption;
+        }
+
+    }
+}
diff --git a/mcs/class/RabbitMQ.Client/src/client/api/SslOption.cs b/mcs/class/RabbitMQ.Client/src/client/api/SslOption.cs
new file mode 100644 (file)
index 0000000..8e2a08c
--- /dev/null
@@ -0,0 +1,172 @@
+// This source code is dual-licensed under the Apache License, version
+// 2.0, and the Mozilla Public License, version 1.1.
+//
+// The APL v2.0:
+//
+//---------------------------------------------------------------------------
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
+//   Technologies LLC., and Rabbit Technologies Ltd.
+//
+//   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.
+//---------------------------------------------------------------------------
+//
+// The MPL v1.1:
+//
+//---------------------------------------------------------------------------
+//   The contents of this file are subject to the Mozilla Public License
+//   Version 1.1 (the "License"); you may not use this file except in
+//   compliance with the License. You may obtain a copy of the License at
+//   http://www.rabbitmq.com/mpl.html
+//
+//   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 RabbitMQ .NET Client.
+//
+//   The Initial Developers of the Original Code are LShift Ltd,
+//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+//   Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
+//   Ltd. Portions created by Cohesive Financial Technologies LLC are
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
+//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
+//   (C) 2007-2010 Rabbit Technologies Ltd.
+//
+//   All Rights Reserved.
+//
+//   Contributor(s): ______________________________________.
+//
+//---------------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Net.Security;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using RabbitMQ.Client.Impl;
+
+namespace RabbitMQ.Client
+{
+    ///<summary>Represents a configurable SSL option, used
+    ///in setting up an SSL connection.</summary>
+    public class SslOption
+    {
+
+        private bool m_enabled;
+
+        ///<summary>Flag specifying if Ssl should indeed be
+        ///used</summary>
+        public bool Enabled
+        {
+            get { return m_enabled; }
+            set { m_enabled = value; }
+        }
+
+
+        private SslProtocols m_version = SslProtocols.Ssl3;
+
+        ///<summary>Retrieve or set the Ssl protocol version
+        ///</summary>
+        public SslProtocols Version
+        {
+            get { return m_version; }
+            set { m_version = value; }
+        }
+
+        private string m_certPath;
+
+        ///<summary>Retrieve or set the path to client certificate.
+        ///</summary>
+        public string CertPath
+        {
+            get { return m_certPath; }
+            set { m_certPath = value; }
+        }
+
+        private string m_certPass;
+
+        ///<summary>Retrieve or set the path to client certificate.
+        ///</summary>
+        public string CertPassphrase
+        {
+            get { return m_certPass; }
+            set { m_certPass = value; }
+        }
+
+
+        ///<summary>Convenience read-only property to retrieve an X509CertificateCollection
+        ///containing the client certificate</summary>
+        public X509CertificateCollection Certs
+        {
+            get { 
+                if(m_certPath == "") {
+                    return null;
+                } else {
+                    X509CertificateCollection c = new X509CertificateCollection();
+                    c.Add(new X509Certificate2(m_certPath, m_certPass));
+                    return c;
+                }
+            }
+        }
+
+        private string m_serverName;
+
+        ///<summary>Retrieve or set server's Canonical Name. This MUST match the CN
+        ///on the Certificate else the SSL connection will fail</summary>
+        public string ServerName
+        {
+            get { return m_serverName; }
+            set { m_serverName = value; }
+        }
+
+        private SslPolicyErrors m_acceptablePolicyErrors = SslPolicyErrors.None;
+
+        ///<summary>Retrieve or set the set of ssl policy errors that
+        ///are deemed acceptable</summary>
+        public SslPolicyErrors AcceptablePolicyErrors
+        {
+            get { return m_acceptablePolicyErrors; }
+            set { m_acceptablePolicyErrors = value; }
+        }
+
+
+        ///<summary>Construct an SslOption specifying both the server cannonical name
+        ///and the client's certificate path.
+        ///</summary>
+        public SslOption(string serverName, string certPath, bool enabled)
+        {
+            m_serverName= serverName;
+            m_certPath = certPath;
+            m_enabled = enabled;
+        }
+
+        ///<summary>Construct an SslOption with just the server cannonical name.
+        ///The Certificate path is set to an empty string
+        ///</summary>
+        public SslOption(string serverName): this(serverName, "", false)
+        {
+        }
+
+        ///<summary>Construct an SslOption with no parameters set</summary>
+        public SslOption(): this("", "", false)
+        {
+        }
+
+    }
+}
index 72574172d5deaac717904288f94ef1139dbab192..360c8dd2ecbaf1fb4eaa4aafea5b1d61af1cfb80 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 474961948348f865973da9be03c9bce1026e2df7..65c13d53289b304d9294906df161f32f369fe031 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 7cd757483ec2fe0967e8879d734792924308414a..dfd6e33529e3f8169aee5e980d505833019364b8 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 2ce790fe9fd611f87533f8cd5ea0db7c7795756b..b3606dca1123e70a5e5a3f9db8702b92210dd98a 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 7e051d0fb7059b14731e6b84afc4dd6dee26f19e..0f9ff83da247148eb2b071b4d5570ecbbd3321c8 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index fcd62ffb531ad98f8ea6984ccf7e81a78c0413bd..ffd2e4c76862396152fd4171833f04bb8c6d8b65 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 74816f8816d058b1901fb29f240b5f4b60b76fd8..2acc0abf2eaf41bfe28b6ef1c52992c73647f03e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 42b7a9b91eef30f840eb24d3e28630a306266bf9..2988c96685af06838cee7bdd573e24d7a5f8f270 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1dc14ccab7e8475e6c08e012b55e696f58953423..5a2fbbd0927a7d0042c9cd2d99c1086e29984bde 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 93a362a0c5434ba7c4f88e522f41dd7d9795866a..9290113d094777c253e908cb68c770b17c0170fd 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index cda25b7c3daca9600c0447ced7e60814f0594ccf..d77e4f707bdc93d2827d27edada1b78adcf4343d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 509491d4cbb5450ec31b174c442a3ffce4003270..9ce98227ccead9a4c37af0e1f80baee5a34f297c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1c71ee983cf2f45f2498af11c923958319f5ba8f..e4b63150a8681b0e714f6cf9ae6532485742b0cf 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index e2243beff757416b07229d5784ee0cd33cbaca20..5577dd666ad51030a8298ca2da9b2279ec69cc6a 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 68cfcaa8f822556b43f7b55840a79807abc59d34..2f74a1c9ce635eca1c914c72d4e61b3296858d11 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 0f04d72acef9ee8b95820d0e20ef351528c9217d..e02f0176381bbe4deeefe2c53119591ab18396f5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 71df96139d99fa804b054d2fd0109ce2ec53a604..84dbecdf7c9940e2ce26135cd394493dfbd3aa15 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 7fd985d23a1c85610206667e21f042b2d029f959..df20010217defe587c0916a0577a8554d3ed6951 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index ed16e2af2ad9a8e2533a889aca6834f6120a0694..348812b9ef03fc667d67cd3f55546532c16bc5ed 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 824378f65b05f9ebfa5ff8ad81768f4aa2a55f93..09546db1bf768dd57c55735d8e964fe499d2b2f1 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 13c0215261d3110e4e69c0817d00f99aa53c3976..cc1ea2d45804cdd28e99d5426e1af2ae181f254e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1af5bfcc4a9961ff6899d68fa2cbf6a61044e5cc..810f17cc512919d3b87c72e8b95cc7501a9532e9 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 531cfc124594f68717823b97b7ac97f38ad11ea1..c1ff386b21f4ff39f4541c70da2e44691adaeb2e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index a9681e9dae522ef237da4026f880d8aa922670d6..0b7522cb14e8f6ad116e160c9415d70f95873770 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index f3b1b614198f1e9d1fd646085a7dc52d6e90a7a5..462cef255f7386e33425d0ee193b4b95dcd5aa48 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index b12acc4c9e29903a5a692678b20ea33dbe6a068a..a3d40fba6cd363ad292d4efc486b7a966cffe83d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index e20bf90271c13f21efc9217ae01755647ec13e81..30cec70443e5f12dc18e3002763ca1237e9ff274 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 995fbcd86658189ac3802d97b87e1716c86cc89f..92b5e70c581a48b71556f5a583cf8f9342ec9715 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index c232e8ba235e11861057bb7c8285a47b2431f19b..273e242e82b733629ad87a109c0dbfc3ab18b817 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index d4bbce34a25b3a83cfc5341f14826f32ffda537c..d7e64bb5e01441fc4c1a46dd64c0651125ae0de8 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 8ada4f5a682b1cb9088c0af88cdd06a967c2a8d5..d6cf6358abc0be3ad658d2cd68d71202a6c78253 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index f37c8979975d287678f1e0837a5abac3c5f973eb..e0ffb987eba4a92aff1b60ccc9ca96b8caa55698 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 995506f2fd7ba6fd9425ec423d47cbf9c70188f3..4c3c7f2fcd58ec306ac3d1080d87eb5c0ef93b39 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 4b939a9292f21a8985b48b26e0dad79dac03de68..a0f9fc83bc40fa77fdf6b1408ac37fec9acc5a13 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -85,6 +85,9 @@ namespace RabbitMQ.Client.Exceptions {
         ///each endpoint.</summary>
         public IDictionary ConnectionErrors { get { return m_connectionErrors; } }
 
+        ///<summary>same as ConnectionErrors property</summary>
+        public override IDictionary Data { get { return m_connectionErrors; } }
+
         ///<summary>Construct a BrokerUnreachableException. Expects
         ///maps as per the description of the ConnectionAttempts and
         ///ConnectionErrors properties.</summary>
@@ -103,19 +106,12 @@ namespace RabbitMQ.Client.Exceptions {
             StringBuilder sb = new StringBuilder(base.Message);
             sb.Append("\nEndpoints attempted:\n");
             foreach (DictionaryEntry entry in m_connectionAttempts) {
-                sb.Append("  endpoint=");
-                sb.Append(entry.Key);
-                sb.Append(", attempts=");
-                sb.Append(entry.Value);
-                sb.Append(", outcome=");
-                Exception e = m_connectionErrors[entry.Key] as Exception;
-                if (e == null) {
-                    sb.Append("(null)");
-                } else {
-                    sb.Append(e.Message);
-                }
-                sb.Append("\n");
+                sb.Append("------------------------------------------------\n");
+                sb.Append("endpoint=").Append(entry.Key);
+                sb.Append(", attempts=").Append(entry.Value).Append("\n");
+                sb.Append(m_connectionErrors[entry.Key] as Exception);
             }
+            sb.Append("\n================================================\n");
             sb.Append("Stack trace:\n");
             sb.Append(base.StackTrace);
             return sb.ToString();
index a0c32ec9b9ee3dca75726bdb5bebc300f98e9d31..472d8560ee01fea730e35d63ca14cc7f0eff70fa 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 11801d57e4a5572dd4cef0718e2d85b72480cf18..7ea29fe24d34f29f410aa9d36b2e62237b00630a 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 6cf85759a7a28ac878cf0860010b699f5d651f00..61dd60ada3f6734c8c2401affd82ac24dee6529d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
diff --git a/mcs/class/RabbitMQ.Client/src/client/exceptions/PossibleAuthenticationFailureException.cs b/mcs/class/RabbitMQ.Client/src/client/exceptions/PossibleAuthenticationFailureException.cs
new file mode 100644 (file)
index 0000000..88b2b08
--- /dev/null
@@ -0,0 +1,70 @@
+// This source code is dual-licensed under the Apache License, version\r
+// 2.0, and the Mozilla Public License, version 1.1.\r
+//\r
+// The APL v2.0:\r
+//\r
+//---------------------------------------------------------------------------\r
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial\r
+//   Technologies LLC., and Rabbit Technologies Ltd.\r
+//\r
+//   Licensed under the Apache License, Version 2.0 (the "License");\r
+//   you may not use this file except in compliance with the License.\r
+//   You may obtain a copy of the License at\r
+//\r
+//       http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+//   Unless required by applicable law or agreed to in writing, software\r
+//   distributed under the License is distributed on an "AS IS" BASIS,\r
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+//   See the License for the specific language governing permissions and\r
+//   limitations under the License.\r
+//---------------------------------------------------------------------------\r
+//\r
+// The MPL v1.1:\r
+//\r
+//---------------------------------------------------------------------------\r
+//   The contents of this file are subject to the Mozilla Public License\r
+//   Version 1.1 (the "License"); you may not use this file except in\r
+//   compliance with the License. You may obtain a copy of the License at\r
+//   http://www.rabbitmq.com/mpl.html\r
+//\r
+//   Software distributed under the License is distributed on an "AS IS"\r
+//   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the\r
+//   License for the specific language governing rights and limitations\r
+//   under the License.\r
+//\r
+//   The Original Code is The RabbitMQ .NET Client.\r
+//\r
+//   The Initial Developers of the Original Code are LShift Ltd,\r
+//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.\r
+//\r
+//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,\r
+//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd\r
+//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial\r
+//   Technologies LLC, and Rabbit Technologies Ltd.\r
+//\r
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift\r
+//   Ltd. Portions created by Cohesive Financial Technologies LLC are\r
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies\r
+//   LLC. Portions created by Rabbit Technologies Ltd are Copyright\r
+//   (C) 2007-2010 Rabbit Technologies Ltd.\r
+//\r
+//   All Rights Reserved.\r
+//\r
+//   Contributor(s): ______________________________________.\r
+//\r
+//---------------------------------------------------------------------------\r
+using System;\r
+\r
+namespace RabbitMQ.Client.Exceptions\r
+{\r
+    /// <summary> Thrown when the likely cause is  an \r
+    /// authentication failure. </summary>\r
+    public class PossibleAuthenticationFailureException : Exception\r
+    {\r
+        public PossibleAuthenticationFailureException(String msg, Exception inner) \r
+            : base(msg, inner)\r
+        {\r
+        }\r
+    }\r
+}\r
index 7e60b8d6a3c5467ee1934c8254e1bf09a55c80c7..d2947913f7ade499e0a0ad1b04796aefb3a68b1c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 9799b39bec6fd71fd3300bd517e1e1ddcf4d6583..15b67507c0058b3eb35310c279d9e092f7c3aba9 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 9d5df4af150c7db67f2679bb5ce345943176a476..4899805a73d58d9cad46c4706a0930d3e0d56a7f 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 78db98bd3649e382dd954dcee42801d51f6f175f..c6259029fa68b1372deab1174217c76bb569dbbd 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 75c44708bc6e20b58bbf43a5b70d7a999c638331..1673654ba420d97593781d55183620d8ce98a287 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 9d2c14976b53cacee340b656161d3688beb718e4..c6fd0f17eca42b1a88324f4269cdedada499ea7c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -66,7 +66,7 @@ namespace RabbitMQ.Client.Impl {
         public abstract int DefaultPort { get; }
 
         public abstract IFrameHandler CreateFrameHandler(AmqpTcpEndpoint endpoint);
-        public abstract IConnection CreateConnection(ConnectionParameters parameters,
+        public abstract IConnection CreateConnection(ConnectionFactory factory,
                                                      bool insist,
                                                      IFrameHandler frameHandler);
         public abstract IModel CreateModel(ISession session);
index a1a0f6567f66591f5c4db78e21a79d786405d2a9..5c4b2df7836e5ec7fa9deae53bb5caee1d584141 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
 using System;
 using System.Collections;
 
-namespace RabbitMQ.Client.Impl {
-    public abstract class BasicProperties: ContentHeaderBase, IBasicProperties {
-       public abstract string ContentType { get; set; }
-       public abstract string ContentEncoding { get; set; }
-       public abstract IDictionary Headers { get; set; }
-       public abstract byte DeliveryMode { get; set; }
-       public abstract byte Priority { get; set; }
-       public abstract string CorrelationId { get; set; }
-       public abstract string ReplyTo { get; set; }
-       public abstract string Expiration { get; set; }
-       public abstract string MessageId { get; set; }
-       public abstract AmqpTimestamp Timestamp { get; set; }
-       public abstract string Type { get; set; }
-       public abstract string UserId { get; set; }
-       public abstract string AppId { get; set; }
-       public abstract string ClusterId { get; set; }
+namespace RabbitMQ.Client.Impl
+{
+    public abstract class BasicProperties: ContentHeaderBase, IBasicProperties
+    {
+        public abstract string ContentType { get; set; }
+        public abstract string ContentEncoding { get; set; }
+        public abstract IDictionary Headers { get; set; }
+        public abstract byte DeliveryMode { get; set; }
+        public abstract byte Priority { get; set; }
+        public abstract string CorrelationId { get; set; }
+        public abstract string ReplyTo { get; set; }
+        public abstract string Expiration { get; set; }
+        public abstract string MessageId { get; set; }
+        public abstract AmqpTimestamp Timestamp { get; set; }
+        public abstract string Type { get; set; }
+        public abstract string UserId { get; set; }
+        public abstract string AppId { get; set; }
+        public abstract string ClusterId { get; set; }
 
-       public abstract void ClearContentType();
-       public abstract void ClearContentEncoding();
-       public abstract void ClearHeaders();
-       public abstract void ClearDeliveryMode();
-       public abstract void ClearPriority();
-       public abstract void ClearCorrelationId();
-       public abstract void ClearReplyTo();
-       public abstract void ClearExpiration();
-       public abstract void ClearMessageId();
-       public abstract void ClearTimestamp();
-       public abstract void ClearType();
-       public abstract void ClearUserId();
-       public abstract void ClearAppId();
-       public abstract void ClearClusterId();
+        public abstract void ClearContentType();
+        public abstract void ClearContentEncoding();
+        public abstract void ClearHeaders();
+        public abstract void ClearDeliveryMode();
+        public abstract void ClearPriority();
+        public abstract void ClearCorrelationId();
+        public abstract void ClearReplyTo();
+        public abstract void ClearExpiration();
+        public abstract void ClearMessageId();
+        public abstract void ClearTimestamp();
+        public abstract void ClearType();
+        public abstract void ClearUserId();
+        public abstract void ClearAppId();
+        public abstract void ClearClusterId();
 
-        public PublicationAddress ReplyToAddress {
-            get {
+        public abstract bool IsContentTypePresent();
+        public abstract bool IsContentEncodingPresent();
+        public abstract bool IsHeadersPresent();
+        public abstract bool IsDeliveryModePresent();
+        public abstract bool IsPriorityPresent();
+        public abstract bool IsCorrelationIdPresent();
+        public abstract bool IsReplyToPresent();
+        public abstract bool IsExpirationPresent();
+        public abstract bool IsMessageIdPresent();
+        public abstract bool IsTimestampPresent();
+        public abstract bool IsTypePresent();
+        public abstract bool IsUserIdPresent();
+        public abstract bool IsAppIdPresent();
+        public abstract bool IsClusterIdPresent();
+
+        public PublicationAddress ReplyToAddress
+        {
+            get
+            {
                 return PublicationAddress.Parse(ReplyTo);
             }
-            set {
+            set
+            {
                 ReplyTo = value.ToString();
             }
         }
 
-       public void SetPersistent(bool persistent) {
-           if (persistent) {
-               DeliveryMode = 2;
-           } else {
-               DeliveryMode = 1;
-           }
-       }
+        public void SetPersistent(bool persistent)
+        {
+            if (persistent)
+                DeliveryMode = 2;
+            else
+                DeliveryMode = 1;
+        }
+
+        public override object Clone()
+        {
+            BasicProperties clone = MemberwiseClone() as BasicProperties;
+            if (IsHeadersPresent())
+            {
+                clone.Headers = new Hashtable();
+                foreach (DictionaryEntry entry in Headers)
+                    clone.Headers[entry.Key] = entry.Value;
+            }
+
+            return clone;
+        }
     }
 }
diff --git a/mcs/class/RabbitMQ.Client/src/client/impl/BodyTooLongException.cs b/mcs/class/RabbitMQ.Client/src/client/impl/BodyTooLongException.cs
deleted file mode 100644 (file)
index 59d8a6a..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// This source code is dual-licensed under the Apache License, version
-// 2.0, and the Mozilla Public License, version 1.1.
-//
-// The APL v2.0:
-//
-//---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
-//   Technologies LLC., and Rabbit Technologies Ltd.
-//
-//   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.
-//---------------------------------------------------------------------------
-//
-// The MPL v1.1:
-//
-//---------------------------------------------------------------------------
-//   The contents of this file are subject to the Mozilla Public License
-//   Version 1.1 (the "License"); you may not use this file except in
-//   compliance with the License. You may obtain a copy of the License at
-//   http://www.rabbitmq.com/mpl.html
-//
-//   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 RabbitMQ .NET Client.
-//
-//   The Initial Developers of the Original Code are LShift Ltd,
-//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
-//
-//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
-//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
-//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
-//   Technologies LLC, and Rabbit Technologies Ltd.
-//
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
-//   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
-//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
-//
-//   All Rights Reserved.
-//
-//   Contributor(s): ______________________________________.
-//
-//---------------------------------------------------------------------------
-using System;
-
-// We use spec version 0-9 for common constants such as frame types,
-// error codes, and the frame end byte, since they don't vary *within
-// the versions we support*. Obviously we may need to revisit this if
-// that ever changes.
-using CommonFraming = RabbitMQ.Client.Framing.v0_9;
-
-namespace RabbitMQ.Client.Impl {
-    /// <summary>
-    /// Thrown when the connection receives a body that exceeds the permissible maximum.
-    /// FIXME: document the permissible maximum, and how to query and configure it
-    /// </summary>
-    public class BodyTooLongException: SoftProtocolException {
-        private readonly ulong m_requestedLength;
-
-        public BodyTooLongException(int channelNumber, ulong requestedLength)
-            : base(channelNumber,
-                   string.Format("The body of a message ({0} bytes) was too long.",
-                                 requestedLength))
-        {
-            m_requestedLength = requestedLength;
-        }
-
-        public ulong RequestedLength { get { return m_requestedLength; } }
-
-        public override ushort ReplyCode { get { return CommonFraming.Constants.ContentTooLarge; } }
-    }
-}
index a6a9e378e1c96c03e2d13ff684111569bc8d9020..ece631c4176543e5079a08cc9ceca8b4930468fa 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index dd08f84a8daf490c7a21e9a01de8be5eafbd0b38..580bafdbc691349f58880e3d5356db6344e872db 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index d0e6fa717c75d5ef151ef13cabee036cd5b98cde..fbbb2ce731cee9c1ba74e908212106f394d90253 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -142,7 +142,7 @@ namespace RabbitMQ.Client.Impl
                         }
                         NetworkBinaryReader reader = f.GetReader();
                         m_command.m_header = m_protocol.DecodeContentHeaderFrom(reader);
-                        m_remainingBodyBytes = m_command.m_header.ReadFrom(f.Channel, reader);
+                        m_remainingBodyBytes = m_command.m_header.ReadFrom(reader);
                         UpdateContentBodyState();
                         return CompletedCommand();
                     }
index b72ef072a8b098388296e527e93918f590102014..9b621175d38a1cc795fb441a6be0e6df7853842f 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -56,6 +56,7 @@
 //---------------------------------------------------------------------------
 using System;
 using System.IO;
+using System.Net.Sockets;
 using System.Text;
 using System.Threading;
 using System.Collections;
@@ -89,16 +90,18 @@ namespace RabbitMQ.Client.Impl
         ///(milliseconds)</summary>
         public static int ConnectionCloseTimeout = 10000;
 
-        public ConnectionParameters m_parameters;
+        public ConnectionFactory m_factory;
         public IFrameHandler m_frameHandler;
         public uint m_frameMax = 0;
         public ushort m_heartbeat = 0;
+        public IDictionary m_clientProperties;
+        public IDictionary m_serverProperties;
         public AmqpTcpEndpoint[] m_knownHosts = null;
 
         public MainSession m_session0;
         public ModelBase m_model0;
 
-        public readonly SessionManager m_sessionManager;
+        public SessionManager m_sessionManager;
 
         public volatile bool m_running = true;
 
@@ -119,14 +122,14 @@ namespace RabbitMQ.Client.Impl
         
         public IList m_shutdownReport = ArrayList.Synchronized(new ArrayList());
 
-        public ConnectionBase(ConnectionParameters parameters,
+        public ConnectionBase(ConnectionFactory factory,
                               bool insist,
                               IFrameHandler frameHandler)
         {
-            m_parameters = parameters;
+            m_factory = factory;
             m_frameHandler = frameHandler;
 
-            m_sessionManager = new SessionManager(this);
+            m_sessionManager = new SessionManager(this, 0);
             m_session0 = new MainSession(this);
             m_session0.Handler = new MainSession.SessionCloseDelegate(NotifyReceivedCloseOk);
             m_model0 = (ModelBase)Protocol.CreateModel(m_session0);
@@ -134,6 +137,7 @@ namespace RabbitMQ.Client.Impl
             StartMainLoop();
             Open(insist);
             StartHeartbeatLoops();
+            AppDomain.CurrentDomain.DomainUnload += HandleDomainUnload;
         }
 
         public event ConnectionShutdownEventHandler ConnectionShutdown
@@ -214,24 +218,12 @@ namespace RabbitMQ.Client.Impl
             m_heartbeatWrite.Set();
         }
 
-        public ConnectionParameters Parameters
-        {
-            get
-            {
-                return m_parameters;
-            }
-        }
-
         public ushort ChannelMax
         {
             get
             {
                 return m_sessionManager.ChannelMax;
             }
-            set
-            {
-                m_sessionManager.ChannelMax = value;
-            }
         }
 
         public uint FrameMax
@@ -262,6 +254,30 @@ namespace RabbitMQ.Client.Impl
             }
         }
 
+        public IDictionary ClientProperties
+        {
+            get
+            {
+                return new Hashtable(m_clientProperties);
+            }
+            set
+            {
+                m_clientProperties = value;
+            }
+        }
+
+        public IDictionary ServerProperties
+        {
+            get
+            {
+                return m_serverProperties;
+            }
+            set
+            {
+                m_serverProperties = value;
+            }
+        }
+
         public AmqpTcpEndpoint[] KnownHosts
         {
             get { return m_knownHosts; }
@@ -355,7 +371,7 @@ namespace RabbitMQ.Client.Impl
         ///<summary>API-side invocation of connection close.</summary>
         public void Close()
         {
-            Close(200, "Goodbye", Timeout.Infinite);
+            Close(CommonFraming.Constants.ReplySuccess, "Goodbye", Timeout.Infinite);
         }
         
         ///<summary>API-side invocation of connection close.</summary>
@@ -367,7 +383,7 @@ namespace RabbitMQ.Client.Impl
         ///<summary>API-side invocation of connection close with timeout.</summary>
         public void Close(int timeout)
         {
-            Close(200, "Goodbye", timeout);
+            Close(CommonFraming.Constants.ReplySuccess, "Goodbye", timeout);
         }
         
         ///<summary>API-side invocation of connection close with timeout.</summary>
@@ -396,7 +412,7 @@ namespace RabbitMQ.Client.Impl
         ///<summary>API-side invocation of connection abort with timeout.</summary>
         public void Abort(int timeout)
         {
-            Abort(200, "Connection close forced", timeout);
+            Abort(CommonFraming.Constants.ReplySuccess, "Connection close forced", timeout);
         }
         
         ///<summary>API-side invocation of connection abort with timeout.</summary>
@@ -496,9 +512,9 @@ namespace RabbitMQ.Client.Impl
 
         public void StartMainLoop()
         {
-            Thread mainloopThread = new Thread(new ThreadStart(MainLoop));
-            mainloopThread.Name = "AMQP Connection " + Endpoint.ToString();
-            mainloopThread.Start();
+            Thread mainLoopThread = new Thread(new ThreadStart(MainLoop));
+            mainLoopThread.Name = "AMQP Connection " + Endpoint.ToString();
+            mainLoopThread.Start();
         }
         
         public void StartHeartbeatLoops()
@@ -604,6 +620,14 @@ namespace RabbitMQ.Client.Impl
             {
                 shutdownCleanly = HardProtocolExceptionHandler(hpe);
             }
+            catch (SocketException se)
+            {
+                // Possibly due to handshake timeout
+                HandleMainLoopException(new ShutdownEventArgs(ShutdownInitiator.Library,
+                                                          0,
+                                                          "Socket exception",
+                                                          se));
+            }
             catch (Exception ex)
             {
                 HandleMainLoopException(new ShutdownEventArgs(ShutdownInitiator.Library,
@@ -635,7 +659,7 @@ namespace RabbitMQ.Client.Impl
                 // counter.
                 return;
             }
-
+            
             if (frame.Channel == 0) {
                 // In theory, we could get non-connection.close-ok
                 // frames here while we're quiescing (m_closeReason !=
@@ -682,7 +706,16 @@ namespace RabbitMQ.Client.Impl
             m_model0.SetCloseReason(m_closeReason);
             m_model0.FinishClose();
         }
-            
+
+        /// <remarks>
+        /// We need to close the socket, otherwise attempting to unload the domain
+        /// could cause a CannotUnloadAppDomainException
+        /// </remarks>
+        public void HandleDomainUnload(object sender, EventArgs ea)
+        {
+            Abort(CommonFraming.Constants.InternalError, "Domain Unload");
+        }
+
         public bool HardProtocolExceptionHandler(HardProtocolException hpe)
         {
             if (SetCloseReason(hpe.ShutdownReason))
@@ -875,6 +908,7 @@ namespace RabbitMQ.Client.Impl
                     }
                 }
             }
+            AppDomain.CurrentDomain.DomainUnload -= HandleDomainUnload;
         }
 
         public void OnCallbackException(CallbackExceptionEventArgs args)
@@ -897,9 +931,11 @@ namespace RabbitMQ.Client.Impl
             }
         }
 
-        public IDictionary BuildClientPropertiesTable()
+        public static IDictionary DefaultClientProperties()
         {
-            string version = this.GetType().Assembly.GetName().Version.ToString();
+            System.Reflection.Assembly assembly =
+                    System.Reflection.Assembly.GetAssembly(typeof(ConnectionBase));
+            string version = assembly.GetName().Version.ToString();
             //TODO: Get the rest of this data from the Assembly Attributes
             Hashtable table = new Hashtable();
             table["product"] = Encoding.UTF8.GetBytes("RabbitMQ");
@@ -942,6 +978,8 @@ namespace RabbitMQ.Client.Impl
             ConnectionStartDetails connectionStart = (ConnectionStartDetails)
                 connectionStartCell.Value;
 
+            ServerProperties = connectionStart.m_serverProperties;
+
             AmqpVersion serverVersion = new AmqpVersion(connectionStart.m_versionMajor,
                                                         connectionStart.m_versionMinor);
             if (!serverVersion.Equals(Protocol.Version))
@@ -954,24 +992,36 @@ namespace RabbitMQ.Client.Impl
                                                            serverVersion.Minor);
             }
 
+            m_clientProperties = new Hashtable(m_factory.ClientProperties);
+
             // FIXME: check that PLAIN is supported.
             // FIXME: parse out locales properly!
-            ConnectionTuneDetails connectionTune =
-                m_model0.ConnectionStartOk(BuildClientPropertiesTable(),
+            ConnectionTuneDetails connectionTune = default(ConnectionTuneDetails);
+            try
+            {
+                connectionTune = 
+                m_model0.ConnectionStartOk(m_clientProperties,
                                            "PLAIN",
-                                           Encoding.UTF8.GetBytes("\0" + m_parameters.UserName +
-                                                                  "\0" + m_parameters.Password),
+                                           Encoding.UTF8.GetBytes(
+                                               "\0" + m_factory.UserName +
+                                               "\0" + m_factory.Password),
                                            "en_US");
+            }
+            catch (OperationInterruptedException e)
+            {
+                throw new PossibleAuthenticationFailureException(
+                    "Possibly caused by authentication failure", e);
+            }
 
-            ushort channelMax = (ushort) NegotiatedMaxValue(m_parameters.RequestedChannelMax,
+            ushort channelMax = (ushort) NegotiatedMaxValue(m_factory.RequestedChannelMax,
                                                             connectionTune.m_channelMax);
-            ChannelMax = channelMax;
+            m_sessionManager = new SessionManager(this, channelMax);
 
-            uint frameMax = NegotiatedMaxValue(m_parameters.RequestedFrameMax,
+            uint frameMax = NegotiatedMaxValue(m_factory.RequestedFrameMax,
                                                connectionTune.m_frameMax);
             FrameMax = frameMax;
 
-            ushort heartbeat = (ushort) NegotiatedMaxValue(m_parameters.RequestedHeartbeat,
+            ushort heartbeat = (ushort) NegotiatedMaxValue(m_factory.RequestedHeartbeat,
                                                            connectionTune.m_heartbeat);
             Heartbeat = heartbeat;
 
@@ -979,7 +1029,7 @@ namespace RabbitMQ.Client.Impl
                                       frameMax,
                                       heartbeat);
 
-            string knownHosts = m_model0.ConnectionOpen(m_parameters.VirtualHost,
+            string knownHosts = m_model0.ConnectionOpen(m_factory.VirtualHost,
                                                         "", // FIXME: make configurable?
                                                         insist);
             KnownHosts = AmqpTcpEndpoint.ParseMultiple(Protocol, knownHosts);
index a7e7199e915e7dcbd709c0a512f2d79d2c4adbc2..53e9c3ede1eb0db0115edbd832efdb87f53e16a4 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 0ddbffb4ad199aaba243c1d67e7ac841d2ca298c..7ac076cd8c5f48a3951cdf051757b13e08065e02 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -62,33 +62,18 @@ namespace RabbitMQ.Client.Impl
 {
     public abstract class ContentHeaderBase : IContentHeader
     {
-        public static uint MaximumPermittedReceivableBodySize = 32 * 1048576; // FIXME: configurable
-
         public abstract int ProtocolClassId { get; }
         public abstract string ProtocolClassName { get; }
         public abstract void ReadPropertiesFrom(ContentHeaderPropertyReader reader);
         public abstract void WritePropertiesTo(ContentHeaderPropertyWriter writer);
         public abstract void AppendPropertyDebugStringTo(System.Text.StringBuilder sb);
 
-        ///<summary>Fill this instance from the given byte buffer
-        ///stream. Throws BodyTooLongException, which is the reason
-        ///for the channelNumber parameter.</summary>
-        ///<remarks>
-        ///<para>
-        /// It might be better to do the body length check in our
-        /// caller, currently CommandAssembler, which would avoid
-        /// passing in the otherwise unrequired channelNumber
-        /// parameter.
-        ///</para>
-        ///</remarks>
-        public ulong ReadFrom(int channelNumber, NetworkBinaryReader reader)
+        ///<summary>Fill this instance from the given byte buffer stream.
+        ///</summary>
+        public ulong ReadFrom(NetworkBinaryReader reader)
         {
             reader.ReadUInt16(); // weight - not currently used
             ulong bodySize = reader.ReadUInt64();
-            if (bodySize > MaximumPermittedReceivableBodySize)
-            {
-                throw new BodyTooLongException(channelNumber, bodySize);
-            }
             ReadPropertiesFrom(new ContentHeaderPropertyReader(reader));
             return bodySize;
         }
@@ -99,5 +84,10 @@ namespace RabbitMQ.Client.Impl
             writer.Write((ulong)bodySize);
             WritePropertiesTo(new ContentHeaderPropertyWriter(writer));
         }
+
+        public virtual object Clone()
+        {
+            throw new NotImplementedException();
+        }
     }
 }
index d887a46148ac222cdd7b046ead4f53e7d04f1078..9ecb748618e037fc592843018b212473c11d27d6 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 003fdb01735e12d0c45e056f2b7f998aaa703c34..0cd48b7668a326dbbc95a72fe40a681053896b52 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index af879d66a5ad4c58f143a420b80b64858e60b671..2b92b2318b4ff74d52013c9c13d9b390ee09ef2c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -80,5 +80,28 @@ namespace RabbitMQ.Client.Impl
         public abstract void ClearFilename();
         public abstract void ClearTimestamp();
         public abstract void ClearClusterId();
+
+        public abstract bool IsContentTypePresent();
+        public abstract bool IsContentEncodingPresent();
+        public abstract bool IsHeadersPresent();
+        public abstract bool IsPriorityPresent();
+        public abstract bool IsReplyToPresent();
+        public abstract bool IsMessageIdPresent();
+        public abstract bool IsFilenamePresent();
+        public abstract bool IsTimestampPresent();
+        public abstract bool IsClusterIdPresent();
+
+        public override object Clone()
+        {
+            FileProperties clone = MemberwiseClone() as FileProperties;
+            if (IsHeadersPresent())
+            {
+                clone.Headers = new Hashtable();
+                foreach (DictionaryEntry entry in Headers)
+                    clone.Headers[entry.Key] = entry.Value;
+            }
+
+            return clone;
+        }
     }
 }
index 9168f057530d6d85840ad9f1436ae50e74bd69a4..ea8cbbc5844df3f528eb6cb1cc140f8be3b87c6d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -56,6 +56,7 @@
 //---------------------------------------------------------------------------
 using System;
 using System.IO;
+using System.Net.Sockets;
 
 using RabbitMQ.Util;
 using RabbitMQ.Client.Exceptions;
@@ -103,7 +104,21 @@ namespace RabbitMQ.Client.Impl
             int type;
             int channel;
 
-            type = reader.ReadByte();
+            try
+            {
+                type = reader.ReadByte();
+            }
+            catch (IOException ioe)
+            {
+                // If it's a WSAETIMEDOUT SocketException, unwrap it.
+                // This might happen when the limit of half-open connections is
+                // reached.
+                if (ioe.InnerException == null ||
+                    !(ioe.InnerException is SocketException) ||
+                    ((SocketException)ioe.InnerException).SocketErrorCode != SocketError.TimedOut)
+                    throw ioe;
+                throw ioe.InnerException;
+            }
 
             if (type == 'A')
             {
@@ -177,11 +192,11 @@ namespace RabbitMQ.Client.Impl
         public void WriteTo(NetworkBinaryWriter writer)
         {
             FinishWriting();
-            writer.Write((byte)m_type);
-            writer.Write((ushort)m_channel);
-            writer.Write((uint)m_payload.Length);
-            writer.Write((byte[])m_payload);
-            writer.Write((byte)CommonFraming.Constants.FrameEnd);
+            writer.Write((byte) m_type);
+            writer.Write((ushort) m_channel);
+            writer.Write((uint) m_payload.Length);
+            writer.Write((byte[]) m_payload);
+            writer.Write((byte) CommonFraming.Constants.FrameEnd);
         }
 
         public NetworkBinaryReader GetReader()
index 20a3c9b959283613e2fe1ac845c7cc87048dcf20..e94d784a704d3c9336c1cf5cb46e3e8b850fa150 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 2da37714e69e9dcb14f645a50f207ce5b2b8bf80..be26c652817c83d76c5725f7a6ac79dd3bc50b35 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index b535d7787c1461096f5496eac234b3ca9023221d..217aa169cd60a8d2daf19d4c1f126ae02426ddad 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 0a393107c5ab87f60626d26ad56f88d3c1bde18a..65fc4fdcd0f5b4f2cec970cfb84956f2866498b2 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 9c185978060ea629fff261e82a409fcd13af8d8c..7898e17fd859badf96ab233a65c0963e474c674f 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 98ee60583784cd13a8a603c539a61500e5213b8b..a5e031dd2a66ccf374bc1fc7947906a825be8012 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1be72847c3a60e099db11cb6bbd90af5b2581aeb..3a10e28472377729cb984892ed669a9a2a04519c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index e36a38281c6e3ccd8b64a8bb8486c9337327addc..1c7c8aa580a269ce8679b84c3975adfbf8fc1621 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index fac81aeb85e2457e86b0b93bc1149d0b4eb937e6..ba4ab0092433a5f8e8509fc8c21fa313f78b357e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 055b51e80a0c50b49ffe7ff4131168999a2caa50..78b8cdc2e1738d20d99e2ca574ae92555a0a0462 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -57,6 +57,7 @@
 using System;
 using System.IO;
 using System.Collections;
+using System.Diagnostics;
 using System.Threading;
 
 using RabbitMQ.Client;
@@ -69,7 +70,6 @@ using RabbitMQ.Util;
 // we support*. Obviously we may need to revisit this if that ever
 // changes.
 using CommonFraming = RabbitMQ.Client.Framing.v0_9;
-using System.Diagnostics;
 
 namespace RabbitMQ.Client.Impl
 {
@@ -808,7 +808,7 @@ namespace RabbitMQ.Client.Impl
         
         public void Close()
         {
-               Close(200, "Goodbye");
+               Close(CommonFraming.Constants.ReplySuccess, "Goodbye");
         }
 
                public void Close(ushort replyCode, string replyText)
@@ -818,7 +818,7 @@ namespace RabbitMQ.Client.Impl
         
         public void Abort() 
         {
-            Abort(200, "Goodbye");
+            Abort(CommonFraming.Constants.ReplySuccess, "Goodbye");
         }
         
         public void Abort(ushort replyCode, string replyText)
index df688b237ff862ff89c780d0a33ce6aed0aeaedd..d202b8db0041402c2d8b87868249f2cb3e2dbbe2 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 889a2fa1f9b57bc873635c4b6effcb6db98799fd..8d8152db47e04cc8a6cb8d6f447b5808d070ebe9 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 74b28c1a4a818b33f7cfe0d5739649a8dcbf9ad5..db402d8ef6b8ae01498bf0d2c230efa871a4799b 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 2263536b6f4f360824447058cb65ab843428878a..c69344bfb5f87a9fcb56414373753e679223a22e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index fdc280851fc078c0c1c7ed84d643eba32dd2f448..6766c919ab47700d8f8f9c7eb99bd4b8176231c5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index b30d33ecd109cec2ac0c351d767062ef25e196d1..9df784aefbb8151ae91c07ad494be3dfb720973e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 4ace62ae63f375de0e46cc6bf21072251579d84a..9ccf1caeb809b198c49b2af7c4b8a7e201971bd2 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -62,30 +62,27 @@ using RabbitMQ.Client;
 using RabbitMQ.Client.Exceptions;
 using RabbitMQ.Util;
 
+// We use spec version 0-9 for common constants such as frame types,
+// error codes, and the frame end byte, since they don't vary *within
+// the versions we support*. Obviously we may need to revisit this if
+// that ever changes.
+using CommonFraming = RabbitMQ.Client.Framing.v0_9;
+
 namespace RabbitMQ.Client.Impl
 {
     public class SessionManager
     {
         private readonly Hashtable m_sessionMap = new Hashtable();
         private readonly ConnectionBase m_connection;
-        private ushort m_channelMax = 0;
+        private readonly IntAllocator Ints;
+        public readonly ushort ChannelMax;
         private bool m_autoClose = false;
 
-        public SessionManager(ConnectionBase connection)
+        public SessionManager(ConnectionBase connection, ushort channelMax)
         {
             m_connection = connection;
-        }
-
-        public ushort ChannelMax
-        {
-            get
-            {
-                return m_channelMax;
-            }
-            set
-            {
-                m_channelMax = value;
-            }
+            ChannelMax = (channelMax == 0) ? ushort.MaxValue : channelMax;
+            Ints = new IntAllocator(1, ChannelMax);
         }
 
         public bool AutoClose
@@ -121,30 +118,36 @@ namespace RabbitMQ.Client.Impl
         {
             lock (m_sessionMap)
             {
-                int channelNumber = Allocate();
+                int channelNumber = Ints.Allocate();
                 if (channelNumber == -1)
                 {
                     throw new ChannelAllocationException();
                 }
-                return Create(channelNumber);
+                return CreateInternal(channelNumber);
             }
         }
 
         public ISession Create(int channelNumber)
         {
-            ISession session;
             lock (m_sessionMap)
             {
-                if (m_sessionMap.ContainsKey(channelNumber))
+                if (!Ints.Reserve(channelNumber))
                 {
                     throw new ChannelAllocationException(channelNumber);
                 }
-                session = new Session(m_connection, channelNumber);
+                return CreateInternal(channelNumber);
+            }
+        }
+
+        public ISession CreateInternal(int channelNumber)
+        {
+            lock(m_sessionMap)
+            {
+                ISession session = new Session(m_connection, channelNumber);
                 session.SessionShutdown += new SessionShutdownEventHandler(HandleSessionShutdown);
-                //Console.WriteLine("SessionManager adding session "+session);
                 m_sessionMap[channelNumber] = session;
+                return session;
             }
-            return session;
         }
 
         ///<summary>Replace an active session slot with a new ISession
@@ -165,30 +168,13 @@ namespace RabbitMQ.Client.Impl
             }
         }
 
-        ///<summary>Find an unused channel number. Must be called
-        ///while holding m_sessionMap lock!</summary>
-        ///<remarks>
-        /// Returns -1 if no unused channel numbers are available.
-        ///</remarks>
-        public int Allocate()
-        {
-            ushort maxChannels = (m_channelMax == 0) ? ushort.MaxValue : m_channelMax;
-            for (int candidate = 1; candidate <= maxChannels; candidate++)
-            {
-                if (!m_sessionMap.ContainsKey(candidate))
-                {
-                    return candidate;
-                }
-            }
-            return -1;
-        }
-
         public void HandleSessionShutdown(ISession session, ShutdownEventArgs reason)
         {
             //Console.WriteLine("SessionManager removing session "+session);
             lock (m_sessionMap)
             {
                 m_sessionMap.Remove(session.ChannelNumber);
+                Ints.Free(session.ChannelNumber);
                 CheckAutoClose();
             }
         }
@@ -223,7 +209,7 @@ namespace RabbitMQ.Client.Impl
         ///when we decide to close the connection.</summary>
         public void AutoCloseConnection()
         {
-            m_connection.Abort(200, "AutoClose", ShutdownInitiator.Library, Timeout.Infinite);
+            m_connection.Abort(CommonFraming.Constants.ReplySuccess, "AutoClose", ShutdownInitiator.Library, Timeout.Infinite);
         }
     }
 }
index f17e28955e4c0cc07b3e23c9746d73754b0817a2..593f582060b5327ca5f1973c0a23f0e997c789aa 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index c760f1b24f80e3867897b08943f5d6db8527a01f..173d4dcf7555abbb90c6ef46e3d9a811c6e8de1d 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 9d37bc7c772d263683e574f182b8a1181951ef6e..cd5d439191284cbaa5752151d806fe3d24555319 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -82,8 +82,16 @@ namespace RabbitMQ.Client.Impl
             m_socket.NoDelay = true;
 
             Stream netstream = m_socket.GetStream();
-            m_reader = new NetworkBinaryReader(netstream);
-            m_writer = new NetworkBinaryWriter(netstream);
+            if (endpoint.Ssl.Enabled) {
+                try {
+                    netstream = SslHelper.TcpUpgrade(netstream, endpoint.Ssl);
+                } catch (Exception) {
+                    Close();
+                    throw;
+                }
+            }
+            m_reader = new NetworkBinaryReader(new BufferedStream(netstream));
+            m_writer = new NetworkBinaryWriter(new BufferedStream(netstream));
         }
 
         public AmqpTcpEndpoint Endpoint
@@ -115,6 +123,7 @@ namespace RabbitMQ.Client.Impl
                 m_writer.Write((byte)1);
                 m_writer.Write((byte)m_endpoint.Protocol.MajorVersion);
                 m_writer.Write((byte)m_endpoint.Protocol.MinorVersion);
+                m_writer.Flush();
             }
         }
 
@@ -122,7 +131,7 @@ namespace RabbitMQ.Client.Impl
         {
             lock (m_reader)
             {
-                    return Frame.ReadFrom(m_reader);
+                return Frame.ReadFrom(m_reader);
             }
         }
 
@@ -131,6 +140,7 @@ namespace RabbitMQ.Client.Impl
             lock (m_writer)
             {
                 frame.WriteTo(m_writer);
+                m_writer.Flush();
                 //Console.WriteLine("OUTBOUND:");
                 //DebugUtil.DumpProperties(frame, Console.Out, 2);
             }
index 88f2ad4159090846191dc7e5f0a6ad91d2c22b5f..1569fa4fed40d0a798594bc6a3b1c738785e4841 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 5bb70bf28137c5a700f7629e5d2e1125e26f915d..75dfa38d2c06e033e37af5541e315a8475946267 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -72,5 +72,24 @@ namespace RabbitMQ.Client.Impl
         public abstract void ClearHeaders();
         public abstract void ClearPriority();
         public abstract void ClearTimestamp();
+
+        public abstract bool IsContentTypePresent();
+        public abstract bool IsContentEncodingPresent();
+        public abstract bool IsHeadersPresent();
+        public abstract bool IsPriorityPresent();
+        public abstract bool IsTimestampPresent();
+
+        public override object Clone()
+        {
+            StreamProperties clone = MemberwiseClone() as StreamProperties;
+            if (IsHeadersPresent())
+            {
+                clone.Headers = new Hashtable();
+                foreach (DictionaryEntry entry in Headers)
+                    clone.Headers[entry.Key] = entry.Value;
+            }
+
+            return clone;
+        }
     }
 }
index ebcac39153f92eece02162f45823701024723f8d..1905ccfc99c711678b9d43c4201a5dad88767cde 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 86bbb6a0446f7daf676b1630325ff85124cfb7ae..2a2b7bfd18d3e0c3d1e381ce2e6c1611ecae1b1e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index e7507d0cdef4afefbddfe09bee87ea3ddbf5e67d..452f5fbce1943f96658c3aec248b422431f92205 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 0defc4ea62c252f79fa10b497e05fbc79a5ba86d..3da500699623c9f5dc129c462e5023c05e948c6e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -128,7 +128,7 @@ namespace RabbitMQ.Client.Impl
         ///<remarks>
         /// Supports the AMQP 0-8/0-9 standard entry types S, I, D, T
         /// and F, as well as the QPid-0-8 specific b, d, f, l, s, t,
-        /// x and V types.
+        /// x and V types and the AMQP 0-9-1 A type.
         ///</remarks>
         public static IDictionary ReadTable(NetworkBinaryReader reader)
         {
@@ -140,10 +140,36 @@ namespace RabbitMQ.Client.Impl
             while ((backingStream.Position - startPosition) < tableLength)
             {
                 string key = ReadShortstr(reader);
-                object value = null;
+                object value = ReadFieldValue(reader);
+                
+                if (!table.ContainsKey(key))
+                {
+                    table[key] = value;
+                }
+            }
 
-                byte discriminator = reader.ReadByte();
-                switch ((char)discriminator)
+            return table;
+        }
+
+        public static IList ReadArray(NetworkBinaryReader reader)
+        {
+            IList array = new ArrayList();
+            long arrayLength = reader.ReadUInt32();
+            Stream backingStream = reader.BaseStream;
+            long startPosition = backingStream.Position;
+            while ((backingStream.Position - startPosition) < arrayLength)
+            {
+                object value = ReadFieldValue(reader);
+                array.Add(value);
+            }
+            return array;
+        }
+
+        public static object ReadFieldValue(NetworkBinaryReader reader)
+        {
+            object value = null;
+            byte discriminator = reader.ReadByte();
+            switch ((char)discriminator)
                 {
                   case 'S':
                       value = ReadLongstr(reader);
@@ -161,6 +187,9 @@ namespace RabbitMQ.Client.Impl
                       value = ReadTable(reader);
                       break;
 
+                  case 'A':
+                      value = ReadArray(reader);
+                      break;
                   case 'b':
                       value = ReadOctet(reader);
                       break;
@@ -190,16 +219,9 @@ namespace RabbitMQ.Client.Impl
                       throw new SyntaxError("Unrecognised type in table: " +
                                             (char) discriminator);
                 }
-
-                if (!table.ContainsKey(key))
-                {
-                    table[key] = value;
-                }
-            }
-
-            return table;
+            return value;
         }
-
+      
         public static AmqpTimestamp ReadTimestamp(NetworkBinaryReader reader)
         {
             ulong stamp = ReadLonglong(reader);
@@ -290,7 +312,7 @@ namespace RabbitMQ.Client.Impl
         ///<para>
         /// Supports the AMQP 0-8/0-9 standard entry types S, I, D, T
         /// and F, as well as the QPid-0-8 specific b, d, f, l, s, t
-        /// x and V types.
+        /// x and V types and the AMQP 0-9-1 A type.
         ///</para>
         ///</remarks>
         public static void WriteTable(NetworkBinaryWriter writer, IDictionary val)
@@ -309,81 +331,7 @@ namespace RabbitMQ.Client.Impl
                 {
                     WriteShortstr(writer, (string)entry.Key);
                     object value = entry.Value;
-
-                    if (value == null)
-                    {
-                        WriteOctet(writer, (byte)'V');
-                    }
-                    else if (value is string)
-                    {
-                        WriteOctet(writer, (byte)'S');
-                        WriteLongstr(writer, Encoding.UTF8.GetBytes((string)value));
-                    }
-                    else if (value is byte[])
-                    {
-                        WriteOctet(writer, (byte)'S');
-                        WriteLongstr(writer, (byte[])value);
-                    }
-                    else if (value is int)
-                    {
-                        WriteOctet(writer, (byte)'I');
-                        writer.Write((int)value);
-                    }
-                    else if (value is decimal)
-                    {
-                        WriteOctet(writer, (byte)'D');
-                        WriteDecimal(writer, (decimal)value);
-                    }
-                    else if (value is AmqpTimestamp)
-                    {
-                        WriteOctet(writer, (byte)'T');
-                        WriteTimestamp(writer, (AmqpTimestamp)value);
-                    }
-                    else if (value is IDictionary)
-                    {
-                        WriteOctet(writer, (byte)'F');
-                        WriteTable(writer, (IDictionary)value);
-                    }
-                    else if (value is byte)
-                    {
-                        WriteOctet(writer, (byte)'b');
-                        WriteOctet(writer, (byte)value);
-                    }
-                    else if (value is double)
-                    {
-                        WriteOctet(writer, (byte)'d');
-                        writer.Write((double)value);
-                    }
-                    else if (value is float)
-                    {
-                        WriteOctet(writer, (byte)'f');
-                        writer.Write((float)value);
-                    }
-                    else if (value is long)
-                    {
-                        WriteOctet(writer, (byte)'l');
-                        writer.Write((long)value);
-                    }
-                    else if (value is short)
-                    {
-                        WriteOctet(writer, (byte)'s');
-                        writer.Write((short)value);
-                    }
-                    else if (value is bool)
-                    {
-                        WriteOctet(writer, (byte)'t');
-                        WriteOctet(writer, (byte)(((bool)value) ? 1 : 0));
-                    }
-                    else if (value is BinaryTableValue)
-                    {
-                        WriteOctet(writer, (byte)'x');
-                        WriteLongstr(writer, ((BinaryTableValue)value).Bytes);
-                    }
-                    else
-                    {
-                        throw new WireFormattingException("Value cannot appear as table value",
-                                                          value);
-                    }
+                    WriteFieldValue(writer, value);
                 }
 
                 // Now, backpatch the table length.
@@ -395,6 +343,112 @@ namespace RabbitMQ.Client.Impl
             }
         }
 
+        public static void WriteArray(NetworkBinaryWriter writer, IList val)
+        {
+            if (val == null)
+            {
+                writer.Write((uint)0);
+            }
+            else
+            {
+                Stream backingStream = writer.BaseStream;
+                long patchPosition = backingStream.Position;
+                writer.Write((uint)0); // length of table - will be backpatched
+                foreach (object entry in val)
+                {
+                    WriteFieldValue(writer, entry);
+                }
+                long savedPosition = backingStream.Position;
+                long tableLength = savedPosition - patchPosition - 4; // offset for length word
+                backingStream.Seek(patchPosition, SeekOrigin.Begin);
+                writer.Write((uint)tableLength);
+                backingStream.Seek(savedPosition, SeekOrigin.Begin);
+            }
+        }
+
+        public static void WriteFieldValue(NetworkBinaryWriter writer, object value)
+        {
+            if (value == null)
+            {
+                WriteOctet(writer, (byte)'V');
+            }
+            else if (value is string)
+            {
+                WriteOctet(writer, (byte)'S');
+                WriteLongstr(writer, Encoding.UTF8.GetBytes((string)value));
+            }
+            else if (value is byte[])
+            {
+                WriteOctet(writer, (byte)'S');
+                WriteLongstr(writer, (byte[])value);
+            }
+            else if (value is int)
+            {
+                WriteOctet(writer, (byte)'I');
+                writer.Write((int)value);
+            }
+            else if (value is decimal)
+            {
+                WriteOctet(writer, (byte)'D');
+                WriteDecimal(writer, (decimal)value);
+            }
+            else if (value is AmqpTimestamp)
+            {
+                WriteOctet(writer, (byte)'T');
+                WriteTimestamp(writer, (AmqpTimestamp)value);
+            }
+            else if (value is IDictionary)
+            {
+                WriteOctet(writer, (byte)'F');
+                WriteTable(writer, (IDictionary)value);
+            }
+            else if (value is IList)
+            {
+                WriteOctet(writer, (byte)'A');
+                WriteArray(writer, (IList)value);
+            }
+            else if (value is byte)
+            {
+                WriteOctet(writer, (byte)'b');
+                WriteOctet(writer, (byte)value);
+            }
+            else if (value is double)
+            {
+                WriteOctet(writer, (byte)'d');
+                writer.Write((double)value);
+            }
+            else if (value is float)
+            {
+                WriteOctet(writer, (byte)'f');
+                writer.Write((float)value);
+            }
+            else if (value is long)
+            {
+                WriteOctet(writer, (byte)'l');
+                writer.Write((long)value);
+            }
+            else if (value is short)
+            {
+                WriteOctet(writer, (byte)'s');
+                writer.Write((short)value);
+            }
+            else if (value is bool)
+            {
+                WriteOctet(writer, (byte)'t');
+                WriteOctet(writer, (byte)(((bool)value) ? 1 : 0));
+            }
+            else if (value is BinaryTableValue)
+            {
+                WriteOctet(writer, (byte)'x');
+                WriteLongstr(writer, ((BinaryTableValue)value).Bytes);
+            }
+            else
+            {
+                throw new WireFormattingException("Value cannot appear as table value",
+                                                  value);
+            }
+        }
+        
         public static void WriteTimestamp(NetworkBinaryWriter writer, AmqpTimestamp val)
         {
             // 0-9 is afaict silent on the signedness of the timestamp.
index 1fdbe83fe816a4fd564bdd97767852fd48a1a4f4..2fcbc45bbf0bd6b7a56b3f2efde608819dd3dd81 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -59,7 +59,7 @@ using RabbitMQ.Client.Impl;
 
 namespace RabbitMQ.Client.Framing.Impl.v0_8 {
     public class Connection: ConnectionBase {
-        public Connection(ConnectionParameters parameters, bool insist, IFrameHandler frameHandler)
-            : base(parameters, insist, frameHandler) {}
+        public Connection(ConnectionFactory factory, bool insist, IFrameHandler frameHandler)
+            : base(factory, insist, frameHandler) {}
     }
 }
index 71a1e977abab7f2d7c84bce03b0913441c3112ae..43bbb56570f0084ac07a1bc9427730257ea78c47 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -69,11 +69,11 @@ namespace RabbitMQ.Client.Framing.Impl.v0_8 {
             return new Model(session);
         }
 
-        public override IConnection CreateConnection(ConnectionParameters parameters,
+        public override IConnection CreateConnection(ConnectionFactory factory,
                                                      bool insist,
                                                      IFrameHandler frameHandler)
         {
-            return new Connection(parameters, insist, frameHandler);
+            return new Connection(factory, insist, frameHandler);
         }
 
         public override void CreateConnectionClose(ushort reasonCode,
index 22280b26bad50bce8a37414a26740bb95ca7381b..5cdaeb1bc49c6d801ab93fb53d96ca8100047ff2 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -59,7 +59,7 @@ using RabbitMQ.Client.Impl;
 
 namespace RabbitMQ.Client.Framing.Impl.v0_8qpid {
     public class Connection: ConnectionBase {
-        public Connection(ConnectionParameters parameters, bool insist, IFrameHandler frameHandler)
-            : base(parameters, insist, frameHandler) {}
+        public Connection(ConnectionFactory factory , bool insist, IFrameHandler frameHandler)
+            : base(factory, insist, frameHandler) {}
     }
 }
index 550951a559d9d7f1c7a613c5330fecff1d568633..b756929b5ff3ddd622c21d02550b337bf5a2b4d6 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -69,11 +69,11 @@ namespace RabbitMQ.Client.Framing.Impl.v0_8qpid {
             return new Model(session);
         }
 
-        public override IConnection CreateConnection(ConnectionParameters parameters,
+        public override IConnection CreateConnection(ConnectionFactory factory,
                                                      bool insist,
                                                      IFrameHandler frameHandler)
         {
-            return new Connection(parameters, insist, frameHandler);
+            return new Connection(factory, insist, frameHandler);
         }
 
         public override void CreateConnectionClose(ushort reasonCode,
index b30b01f94c5dffa3c1661ad608f7039d37637688..c83e067b394be0e34befade429353105af3da200 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -59,7 +59,7 @@ using RabbitMQ.Client.Impl;
 
 namespace RabbitMQ.Client.Framing.Impl.v0_9 {
     public class Connection: ConnectionBase {
-        public Connection(ConnectionParameters parameters, bool insist, IFrameHandler frameHandler)
-            : base(parameters, insist, frameHandler) {}
+        public Connection(ConnectionFactory factory, bool insist, IFrameHandler frameHandler)
+            : base(factory, insist, frameHandler) {}
     }
 }
index bc6a01049da8a51bd90f9adcac000c7e7c2dd0bb..3c62c475f30ec04d6b5240b8ee512e13a6fab725 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -69,11 +69,11 @@ namespace RabbitMQ.Client.Framing.Impl.v0_9 {
             return new Model(session);
         }
 
-        public override IConnection CreateConnection(ConnectionParameters parameters,
+        public override IConnection CreateConnection(ConnectionFactory factory,
                                                      bool insist,
                                                      IFrameHandler frameHandler)
         {
-            return new Connection(parameters, insist, frameHandler);
+            return new Connection(factory, insist, frameHandler);
         }
 
         public override void CreateConnectionClose(ushort reasonCode,
index c1cb54fa9a18197e4c8f86e0aa28f06ece082e71..e0c0513bb8be1cd32e7ecee8ed53d96e7551c81c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index baaf8fb8455b4f0295d4c89286332917be220496..0e4d3d620e8aaef63ca7fce0947725ccf47ff6ed 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 956fb360ecd2ff647846c2341ac13575c1351256..4635a7276b9528daccf84317be945944f9c206c5 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -98,10 +98,12 @@ namespace RabbitMQ.Client.MessagePatterns {
         public IModel Model { get { return m_model; } }
 
         protected string m_queueName;
-        protected QueueingBasicConsumer m_consumer;
-        protected string m_consumerTag;
         protected bool m_noAck;
-        protected bool m_shouldDelete;
+
+        protected readonly object m_consumerLock = new object();
+        protected volatile QueueingBasicConsumer m_consumer;
+        protected string m_consumerTag;
+        protected volatile bool m_shouldDelete;
 
         ///<summary>Retrieve the queue name we have subscribed to. May
         ///be a server-generated name, depending on how the
@@ -127,17 +129,18 @@ namespace RabbitMQ.Client.MessagePatterns {
         protected BasicDeliverEventArgs m_latestEvent;
 
         ///<summary>Returns the most recent value returned by Next(),
-        ///or null when either no values have been retrieved yet, or
-        ///the most recent value has already been Ack()ed. See also
-        ///the documentation for Ack().</summary>
+        ///or null when either no values have been retrieved yet, the
+        ///end of the subscription has been reached, or the most
+        ///recent value has already been Ack()ed. See also the
+        ///documentation for Ack().</summary>
         public BasicDeliverEventArgs LatestEvent { get { return m_latestEvent; } }
 
         ///<summary>Creates a new Subscription in "noAck" mode,
-        ///consuming from a fresh, autodelete, anonymous queue. The
-        ///name of the queue can be retrieved using the QueueName
-        ///property of the Subscription. After creating the queue, the
-        ///queue is bound to the named exchange, using Bind() with the
-        ///given routingKey bind parameter.</summary>
+        ///consuming from a fresh, exclusive, autodelete, anonymous
+        ///queue. The name of the queue can be retrieved using the
+        ///QueueName property of the Subscription. After creating the
+        ///queue, the queue is bound to the named exchange, using
+        ///Bind() with the given routingKey bind parameter.</summary>
         public Subscription(IModel model, string exchangeName,
                             string exchangeType, string routingKey)
             : this(model)
@@ -146,20 +149,21 @@ namespace RabbitMQ.Client.MessagePatterns {
         }
 
         ///<summary>Creates a new Subscription in "noAck" mode,
-        ///consuming from a fresh, autodelete, anonymous queue. The
-        ///name of the queue can be retrieved using the QueueName
-        ///property of the Subscription.</summary>
+        ///consuming from a fresh, exclusive, autodelete, anonymous
+        ///queue. The name of the queue can be retrieved using the
+        ///QueueName property of the Subscription.</summary>
         public Subscription(IModel model)
             : this(model, null) {}
 
         ///<summary>Creates a new Subscription in "noAck" mode,
         ///consuming from a named queue. If the queueName parameter is
-        ///null or the empty-string, creates a fresh, autodelete,
-        ///anonymous queue; otherwise, the queue is declared using
-        ///IModel.QueueDeclare() before IModel.BasicConsume() is
-        ///called. After declaring the queue and starting the
-        ///consumer, the queue is bound to the named exchange, using
-        ///Bind() with the given routingKey bind parameter.</summary>
+        ///null or the empty-string, creates a fresh, exclusive,
+        ///autodelete, anonymous queue; otherwise, the queue is
+        ///declared using IModel.QueueDeclare() before
+        ///IModel.BasicConsume() is called. After declaring the queue
+        ///and starting the consumer, the queue is bound to the named
+        ///exchange, using Bind() with the given routingKey bind
+        ///parameter.</summary>
         public Subscription(IModel model, string queueName, string exchangeName,
                             string exchangeType, string routingKey)
             : this(model, queueName)
@@ -169,20 +173,20 @@ namespace RabbitMQ.Client.MessagePatterns {
 
         ///<summary>Creates a new Subscription in "noAck" mode,
         ///consuming from a named queue. If the queueName parameter is
-        ///null or the empty-string, creates a fresh, autodelete,
-        ///anonymous queue; otherwise, the queue is declared using
-        ///IModel.QueueDeclare() before IModel.BasicConsume() is
-        ///called.</summary>
+        ///null or the empty-string, creates a fresh, exclusive,
+        ///autodelete, anonymous queue; otherwise, the queue is
+        ///declared using IModel.QueueDeclare() before
+        ///IModel.BasicConsume() is called.</summary>
         public Subscription(IModel model, string queueName)
             : this(model, queueName, true) {}
 
         ///<summary>Creates a new Subscription, with full control over
         ///both "noAck" mode and the name of the queue (which, if null
-        ///or the empty-string, will be a fresh autodelete queue, as
-        ///for the other constructor overloads). After declaring the
-        ///queue and starting the consumer, the queue is bound to the
-        ///named exchange, using Bind() with the given routingKey bind
-        ///parameter.</summary>
+        ///or the empty-string, will be a fresh, exclusive,
+        ///autodelete, anonymous queue, as for the other constructor
+        ///overloads). After declaring the queue and starting the
+        ///consumer, the queue is bound to the named exchange, using
+        ///Bind() with the given routingKey bind parameter.</summary>
         public Subscription(IModel model, string queueName, bool noAck,
                             string exchangeName, string exchangeType, string routingKey)
             : this(model, queueName, noAck)
@@ -192,8 +196,9 @@ namespace RabbitMQ.Client.MessagePatterns {
 
         ///<summary>Creates a new Subscription, with full control over
         ///both "noAck" mode and the name of the queue (which, if null
-        ///or the empty-string, will be a fresh autodelete queue, as
-        ///for the other constructor overloads).</summary>
+        ///or the empty-string, will be a fresh, exclusive,
+        ///autodelete, anonymous queue, as for the other constructor
+        ///overloads).</summary>
         public Subscription(IModel model, string queueName, bool noAck)
         {
             m_model = model;
@@ -210,30 +215,42 @@ namespace RabbitMQ.Client.MessagePatterns {
         }
 
         ///<summary>Closes this Subscription, cancelling the consumer
-        ///record in the server. If an anonymous, autodelete queue
-        ///(i.e., one with a server-generated name) was created during
-        ///construction of the Subscription, this method also deletes
-        ///the created queue (which is an optimisation: autodelete
-        ///queues will be deleted when the IModel closes in any
-        ///case).</summary>
+        ///record in the server. If an anonymous, exclusive,
+        ///autodelete queue (i.e., one with a server-generated name)
+        ///was created during construction of the Subscription, this
+        ///method also deletes the created queue (which is an
+        ///optimisation: autodelete queues will be deleted when the
+        ///IModel closes in any case).</summary>
         public void Close()
         {
             try {
-                if (m_consumer != null) {
-                    m_model.BasicCancel(m_consumerTag);
-                }
-                if (m_shouldDelete) {
-                    m_shouldDelete = false;
+                bool shouldCancelConsumer = false;
+                bool shouldDelete = false;
+
+                lock (m_consumerLock) {
+                    if (m_consumer != null) {
+                        shouldCancelConsumer = true;
+                        m_consumer = null;
+                    }
+
+                    shouldDelete = m_shouldDelete;
                     // We set m_shouldDelete false before attempting
                     // the delete, because trying twice is worse than
                     // trying once and failing.
+                    m_shouldDelete = false;
+                }
+
+                if (shouldCancelConsumer) {
+                    m_model.BasicCancel(m_consumerTag);
+                    m_consumerTag = null;
+                }
+
+                if (shouldDelete) {
                     m_model.QueueDelete(m_queueName, false, false, false);
                 }
             } catch (OperationInterruptedException) {
                 // We don't mind, here.
             }
-            m_consumer = null;
-            m_consumerTag = null;
         }
 
         ///<summary>Causes the queue to which we have subscribed to be
@@ -317,11 +334,16 @@ namespace RabbitMQ.Client.MessagePatterns {
         public BasicDeliverEventArgs Next()
         {
             try {
-                if (m_consumer == null) {
+                // Alias the pointer as otherwise it may change out
+                // from under us by the operation of Close() from
+                // another thread.
+                QueueingBasicConsumer consumer = m_consumer;
+                if (consumer == null) {
                     // Closed!
-                    throw new InvalidOperationException();
+                    m_latestEvent = null;
+                } else {
+                    m_latestEvent = (BasicDeliverEventArgs) consumer.Queue.Dequeue();
                 }
-                m_latestEvent = (BasicDeliverEventArgs) m_consumer.Queue.Dequeue();
             } catch (EndOfStreamException) {
                 m_latestEvent = null;
             }
@@ -375,16 +397,21 @@ namespace RabbitMQ.Client.MessagePatterns {
         public bool Next(int millisecondsTimeout, out BasicDeliverEventArgs result)
         {
             try {
-                if (m_consumer == null) {
+                // Alias the pointer as otherwise it may change out
+                // from under us by the operation of Close() from
+                // another thread.
+                QueueingBasicConsumer consumer = m_consumer;
+                if (consumer == null) {
                     // Closed!
-                    throw new InvalidOperationException();
-                }
-                object qValue;
-                if (!m_consumer.Queue.Dequeue(millisecondsTimeout, out qValue)) {
-                    result = null;
-                    return false;
+                    m_latestEvent = null;
+                } else {
+                    object qValue;
+                    if (!consumer.Queue.Dequeue(millisecondsTimeout, out qValue)) {
+                        result = null;
+                        return false;
+                    }
+                    m_latestEvent = (BasicDeliverEventArgs) qValue;
                 }
-                m_latestEvent = (BasicDeliverEventArgs) qValue;
             } catch (EndOfStreamException) {
                 m_latestEvent = null;
             }
index be2b64c93007c3365c713bfc8bebdaebf88faf46..d0c379d4010a16f5f0a301efc6c0a244b317fe3e 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 56b495658858f24659666260e56501f58f8bad63..b1e1a44f6e928214a0c131f603099a22cf96438c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 492fb30dd4ba9d364606a6f33698e17c8714308e..96b29117f096e4e58777feb2d5602d28755e76e0 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
diff --git a/mcs/class/RabbitMQ.Client/src/util/IntAllocator.cs b/mcs/class/RabbitMQ.Client/src/util/IntAllocator.cs
new file mode 100644 (file)
index 0000000..c63d21d
--- /dev/null
@@ -0,0 +1,255 @@
+// This source code is dual-licensed under the Apache License, version
+// 2.0, and the Mozilla Public License, version 1.1.
+//
+// The APL v2.0:
+//
+//---------------------------------------------------------------------------
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
+//   Technologies LLC., and Rabbit Technologies Ltd.
+//
+//   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.
+//---------------------------------------------------------------------------
+//
+// The MPL v1.1:
+//
+//---------------------------------------------------------------------------
+//   The contents of this file are subject to the Mozilla Public License
+//   Version 1.1 (the "License"); you may not use this file except in
+//   compliance with the License. You may obtain a copy of the License at
+//   http://www.Rabbitmq.Com/mpl.Html
+//
+//   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 RabbitMQ .NET Client.
+//
+//   The Initial Developers of the Original Code are LShift Ltd,
+//   Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
+//   Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
+//   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
+//   Technologies LLC, and Rabbit Technologies Ltd.
+//
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
+//   Ltd. Portions created by Cohesive Financial Technologies LLC are
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
+//   LLC. Portions created by Rabbit Technologies Ltd are Copyright
+//   (C) 2007-2010 Rabbit Technologies Ltd.
+//
+//   All Rights Reserved.
+//
+//   Contributor(s): ______________________________________.
+//
+//---------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Diagnostics;
+
+namespace RabbitMQ.Util
+{
+
+
+  /**
+   * A class for allocating integer IDs in a given range.
+   */
+  public class IntAllocator{
+
+    private IntervalList Base;
+
+    private readonly int[] unsorted;
+    private int unsortedCount = 0;
+
+    /**
+     * A class representing a list of inclusive intervals
+     */
+    public class IntervalList{
+      public IntervalList(int start, int end){
+        this.Start = start;
+        this.End = end;
+      }
+
+      public int Start;
+      public int End;
+
+      // Invariant: If Next != Null then Next.Start > this.End + 1
+      public IntervalList Next;
+
+      // Destructively merge two IntervalLists.
+      // Invariant: None of the Intervals in the two lists may overlap
+      // intervals in this list.
+      public static IntervalList Merge(IntervalList x, IntervalList y)
+      {
+        if(x == null) return y;
+        if(y == null) return x;
+
+        if(x.End > y.Start) return Merge(y, x);
+
+        Debug.Assert(x.End != y.Start);
+
+        // We now have x, y non-null and x.End < y.Start.
+
+        if(y.Start == x.End + 1)
+        {
+          // The two intervals adjoin. Merge them into one and then
+          // merge the tails.
+          x.End = y.End;
+          x.Next = Merge(x.Next, y.Next);
+          return x;
+        }
+
+        // y belongs in the tail of x.
+
+        x.Next = Merge(y, x.Next);
+        return x;
+      }
+
+      public static IntervalList FromArray(int[] xs, int length)
+      {
+        Array.Sort(xs, 0, length);
+
+        IntervalList result = null;
+        IntervalList current = null;
+
+        int i = 0;
+        while(i < length){
+          int start = i;
+          while((i < length - 1) && (xs[i + 1] == xs[i] + 1))
+            i++;
+
+          IntervalList interval = new IntervalList(xs[start], xs[i]);
+
+          if(result == null)
+          {
+            result = interval;
+            current = interval;
+          }
+          else
+          {
+            current.Next = interval;
+            current = interval;
+          }
+          i++;
+        }
+        return result;
+      }
+    }
+
+    /**
+     * Creates an IntAllocator allocating integer IDs within the inclusive range [start, end]
+     */
+    public IntAllocator(int start, int end)
+    {
+      if(start > end) throw new ArgumentException("illegal range [" + start  +", " + end + "]");
+
+      // Fairly arbitrary heuristic for a good size for the unsorted set.
+      unsorted = new int[Math.Max(32, (int)Math.Sqrt(end - start))];
+      Base = new IntervalList(start, end);
+    }
+
+    /**
+     * Allocate a fresh integer from the range, or return -1 if no more integers
+     * are available. This operation is guaranteed to run in O(1)
+     */
+    public int Allocate()
+    {
+      if(unsortedCount > 0){
+        return unsorted[--unsortedCount];
+      } else if (Base != null) {
+        int result = Base.Start++;
+        if(Base.Start == Base.End) Base = Base.Next;
+        return result;
+      } else {
+        return -1;
+      }
+    }
+
+    private void Flush()
+    {
+        if(unsortedCount > 0)
+        {
+            Base = IntervalList.Merge(Base, IntervalList.FromArray(unsorted, unsortedCount));
+            unsortedCount = 0;
+        }
+    }
+
+
+    /**
+     * Make the provided integer available for allocation again. This operation
+     * runs in amortized O(sqrt(range size)) time: About every sqrt(range size)
+     * operations  will take O(range_size + number of intervals) to complete and
+     * the rest run in constant time.
+     *
+     * No error checking is performed, so if you double Free or Free an integer
+     * that was not originally Allocated the results are undefined. Sorry.
+     */
+    public void Free(int id)
+    {
+      if(unsortedCount >= unsorted.Length)
+      {
+        Flush();
+      }
+      unsorted[unsortedCount++] = id;
+    }
+
+    public bool Reserve(int id)
+    {
+      // We always flush before reserving because the only way to determine
+      // if an ID is in the unsorted array is through a linear scan. This leads
+      // us to the potentially expensive situation where there is a large unsorted
+      // array and we reserve several IDs, incurring the cost of the scan each time.
+      // Flushing makes sure the array is always empty and does no additional work if
+      // reserve is called twice.
+      Flush();
+
+      IntervalList current = Base;
+
+      while(current != null)
+      {
+        if(current.End < id)
+        {
+          current = current.Next;
+          continue;
+        }
+        else if(current.Start > id)
+        {
+          return false;
+        }
+        else if(current.End == id)
+        {
+          current.End--;
+        }
+        else if(current.Start == id)
+        {
+          current.Start++;
+        }
+        else
+        {
+          // The ID is in the middle of this interval.
+          // We need to split the interval into two.
+          IntervalList rest = new IntervalList(id + 1, current.End);
+          current.End = id - 1;
+          rest.Next = current.Next;
+          current.Next = rest;
+        }
+        return true;
+      }
+      return false;
+    }
+
+  }
+}
index 5d247a06119becb6fbbfbc92d3d3939f71a508c7..5776f53c90de7a2e1f718a72cc68bd6b66c9fa0a 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 2e1399142a84cfddcaf5b59c90109d8e59ba71b3..e3dd13680ade830c74600b617b3aa3e0033982ea 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
index 1d45d968bc35edc75c444b5a30ccbc57605e99e0..aba76ad549470cd409a9fcdda84e56fbdb2bc64c 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //
@@ -61,7 +61,7 @@ using System.Threading;
 
 namespace RabbitMQ.Util {
     ///<summary>A thread-safe shared queue implementation.</summary>
-    public class SharedQueue: IDisposable {
+    public class SharedQueue : IEnumerable {
         ///<summary>The shared queue.</summary>
         ///<remarks>
         ///Subclasses must ensure appropriate locking discipline when
@@ -77,10 +77,10 @@ namespace RabbitMQ.Util {
         public SharedQueue() {
         }
 
-        ///<summary>Close the queue. Causes all waiting threads to be
-        ///interrupted (with EndOfStreamException) and all further
-        ///Enqueue() and Dequeue() operations to throw
-        ///EndOfStreamException.</summary>
+        ///<summary>Close the queue. Causes all further Enqueue()
+        ///operations to throw EndOfStreamException, and all pending
+        ///or subsequent Dequeue() operations to throw an
+        ///EndOfStreamException once the queue is empty.</summary>
         public void Close() {
             lock (m_queue) {
                 m_isOpen = false;
@@ -88,12 +88,6 @@ namespace RabbitMQ.Util {
             }
         }
 
-        ///<summary>Implement IDisposable.Dispose. Delegates directly
-        ///to Close().</summary>
-        public void Dispose() {
-            Close();
-        }
-
         ///<summary>Call only when the lock on m_queue is held.</summary>
         /// <exception cref="EndOfStreamException" />
         private void EnsureIsOpen() {
@@ -121,12 +115,11 @@ namespace RabbitMQ.Util {
         ///<remarks>
         ///Callers of Dequeue() will block if no items are available
         ///until some other thread calls Enqueue() or the queue is
-        ///closed. If the queue is closed (by a call to Close()), this
-        ///method will throw EndOfStreamException.
+        ///closed. In the latter case this method will throw
+        ///EndOfStreamException.
         ///</remarks>
         public object Dequeue() {
             lock (m_queue) {
-                EnsureIsOpen();
                 while (m_queue.Count == 0) {
                     EnsureIsOpen();
                     Monitor.Wait(m_queue);
@@ -151,15 +144,15 @@ namespace RabbitMQ.Util {
         /// whereas Dequeue() will.
         ///</para>
         ///<para>
-        /// If, at the time of call, the queue is in a closed state
-        /// (by a call to Close()), this method will throw
-        /// EndOfStreamException.
+        /// If at the time of call the queue is empty and in a
+        /// closed state (following a call to Close()), then this
+        /// method will throw EndOfStreamException.
         ///</para>
         ///</remarks>
         public object DequeueNoWait(object defaultValue) {
             lock (m_queue) {
-                EnsureIsOpen();
                 if (m_queue.Count == 0) {
+                    EnsureIsOpen();
                     return defaultValue;
                 } else {
                     return m_queue.Dequeue();
@@ -197,7 +190,8 @@ namespace RabbitMQ.Util {
        /// System.Threading.Monitor.Wait(object,int).
         ///</para>
         ///<para>
-        /// If, at any time during the call, the queue is in or
+        /// If no items are present and the queue is in a closed
+        /// state, or if at any time while waiting the queue
         /// transitions to a closed state (by a call to Close()), this
         /// method will throw EndOfStreamException.
         ///</para>
@@ -210,8 +204,8 @@ namespace RabbitMQ.Util {
 
            DateTime startTime = DateTime.Now;
            lock (m_queue) {
-                EnsureIsOpen();
                 while (m_queue.Count == 0) {
+                    EnsureIsOpen();
                    int elapsedTime = (int) ((DateTime.Now - startTime).TotalMilliseconds);
                    int remainingTime = millisecondsTimeout - elapsedTime;
                    if (remainingTime <= 0) {
@@ -220,12 +214,61 @@ namespace RabbitMQ.Util {
                    }
 
                     Monitor.Wait(m_queue, remainingTime);
-                    EnsureIsOpen();
                 }
 
                 result = m_queue.Dequeue();
                return true;
             }
        }
+
+        ///<summary>Implementation of the IEnumerable interface, for
+        ///permitting SharedQueue to be used in foreach
+        ///loops.</summary>
+        IEnumerator IEnumerable.GetEnumerator() {
+            return new SharedQueueEnumerator(this);
+        }
+
+    }
+
+    ///<summary>Implementation of the IEnumerator interface, for
+    ///permitting SharedQueue to be used in foreach loops.</summary>
+    public class SharedQueueEnumerator : IEnumerator {
+
+        protected SharedQueue m_queue;
+        protected object m_current;
+
+        ///<summary>Construct an enumerator for the given
+        ///SharedQueue.</summary>
+        public SharedQueueEnumerator(SharedQueue queue) {
+            m_queue = queue;
+        }
+
+        object IEnumerator.Current {
+            get {
+                if (m_current == null) {
+                    throw new InvalidOperationException();
+                }
+                return m_current;
+            }
+        }
+
+        bool IEnumerator.MoveNext() {
+            try {
+                m_current = m_queue.Dequeue();
+                return true;
+            } catch (EndOfStreamException) {
+                m_current = null;
+                return false;
+            }
+        }
+
+        ///<summary>Reset()ting a SharedQueue doesn't make sense, so
+        ///this method always throws
+        ///InvalidOperationException.</summary>
+        void IEnumerator.Reset() {
+            throw new InvalidOperationException("SharedQueue.Reset() does not make sense");
+        }
+
     }
+
 }
index 576c2933a378c3209bce3ade3e2e972c8f51010b..a064f9797aa60911cd19c3f36dfb90516785f22b 100644 (file)
@@ -4,7 +4,7 @@
 // The APL v2.0:
 //
 //---------------------------------------------------------------------------
-//   Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial
+//   Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
 //   Technologies LLC., and Rabbit Technologies Ltd.
 //
 //   Licensed under the Apache License, Version 2.0 (the "License");
 //   are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
 //   Technologies LLC, and Rabbit Technologies Ltd.
 //
-//   Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
+//   Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
 //   Ltd. Portions created by Cohesive Financial Technologies LLC are
-//   Copyright (C) 2007-2009 Cohesive Financial Technologies
+//   Copyright (C) 2007-2010 Cohesive Financial Technologies
 //   LLC. Portions created by Rabbit Technologies Ltd are Copyright
-//   (C) 2007-2009 Rabbit Technologies Ltd.
+//   (C) 2007-2010 Rabbit Technologies Ltd.
 //
 //   All Rights Reserved.
 //