summaryrefslogtreecommitdiff
path: root/qpid/dotnet
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-29 11:05:20 +0000
committerRobert Greig <rgreig@apache.org>2007-01-29 11:05:20 +0000
commite1677ad20766b7d31adc04decb76d44f3b9e0d96 (patch)
tree5d3cb62b2a3edf2d58cbfdde54dabfd5dfcfaf2a /qpid/dotnet
parente15264e1949f8e4ac41bda26fe2a5fc3478a1d1d (diff)
downloadqpid-python-e1677ad20766b7d31adc04decb76d44f3b9e0d96.tar.gz
(Patch supplied by Tomas Restrepo) QPID-312.diff applied. This converts Javadoc copied accross from the orignal Java code to .Net format. Renames some files/classes/methods to use .Net conventions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@501006 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet')
-rw-r--r--qpid/dotnet/Qpid.Buffer/BaseByteBuffer.cs35
-rw-r--r--qpid/dotnet/Qpid.Buffer/BufferDataException.cs8
-rw-r--r--qpid/dotnet/Qpid.Buffer/ByteBuffer.cs14
-rw-r--r--qpid/dotnet/Qpid.Buffer/ByteBufferAllocator.cs50
-rw-r--r--qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs29
-rw-r--r--qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj4
-rw-r--r--qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs16
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/Common/BaseMessagingTestFixture.cs4
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs8
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/failover/FailoverTest.cs4
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs6
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/url/ConnectionUrlTest.cs238
-rw-r--r--qpid/dotnet/Qpid.Client/Client/AMQConnection.cs30
-rw-r--r--qpid/dotnet/Qpid.Client/Client/AmqBrokerInfo.cs118
-rw-r--r--qpid/dotnet/Qpid.Client/Client/QpidConnectionInfo.cs92
-rw-r--r--qpid/dotnet/Qpid.Client/qms/BrokerInfo.cs31
-rw-r--r--qpid/dotnet/Qpid.Client/qms/ConnectionInfo.cs48
-rw-r--r--qpid/dotnet/Qpid.Client/qms/FailoverPolicy.cs50
-rw-r--r--qpid/dotnet/Qpid.Client/qms/UrlSyntaxException.cs2
-rw-r--r--qpid/dotnet/Qpid.Client/qms/failover/FailoverMethod.cs81
-rw-r--r--qpid/dotnet/Qpid.Client/qms/failover/FailoverRoundRobin.cs46
-rw-r--r--qpid/dotnet/Qpid.Client/qms/failover/FailoverSingleServer.cs40
22 files changed, 439 insertions, 515 deletions
diff --git a/qpid/dotnet/Qpid.Buffer/BaseByteBuffer.cs b/qpid/dotnet/Qpid.Buffer/BaseByteBuffer.cs
index 099c84d6fa..3a6beabae8 100644
--- a/qpid/dotnet/Qpid.Buffer/BaseByteBuffer.cs
+++ b/qpid/dotnet/Qpid.Buffer/BaseByteBuffer.cs
@@ -33,23 +33,21 @@
namespace Qpid.Buffer
{
- /**
- * A base implementation of {@link ByteBuffer}. This implementation
- * assumes that {@link ByteBuffer#buf()} always returns a correct NIO
- * {@link FixedByteBuffer} instance. Most implementations could
- * extend this class and implement their own buffer management mechanism.
- *
- * @noinspection StaticNonFinalField
- * @see ByteBufferAllocator
- */
+ /// <summary>
+ /// A base implementation of <see cref="ByteBuffer"/>. This implementation
+ /// assumes that <see cref="ByteBuffer.Buf"/> always returns a correct NIO
+ /// <see cref="FixedByteBuffer"/> instance. Most implementations could
+ /// extend this class and implement their own buffer management mechanism.
+ /// </summary>
+ /// <seealso cref="ByteBufferAllocator"/>
public abstract class BaseByteBuffer : ByteBuffer
{
private bool _autoExpand;
- /**
- * We don't have any access to Buffer.markValue(), so we need to track it down,
- * which will cause small extra overhead.
- */
+ /// <summary>
+ /// We don't have any access to Buffer.markValue(),
+ /// so we need to track it down, which will cause small extra overhead.
+ /// </summary>
private int _mark = -1;
protected BaseByteBuffer()
@@ -94,10 +92,11 @@ namespace Qpid.Buffer
return this;
}
- /**
- * Implement this method to increase the capacity of this buffer.
- * <tt>newCapacity</tt> is always greater than the current capacity.
- */
+
+ /// <summary>
+ /// Implement this method to increase the capacity of this buffer.
+ /// </summary>
+ /// <param name="newCapacity">is always greater than the current capacity.</param>
protected abstract void capacity0( int newCapacity );
public override bool isAutoExpand()
@@ -458,4 +457,4 @@ namespace Qpid.Buffer
// return buf().asDoubleBuffer();
// }
}
-} \ No newline at end of file
+}
diff --git a/qpid/dotnet/Qpid.Buffer/BufferDataException.cs b/qpid/dotnet/Qpid.Buffer/BufferDataException.cs
index bce2d7ef5a..c76441dde0 100644
--- a/qpid/dotnet/Qpid.Buffer/BufferDataException.cs
+++ b/qpid/dotnet/Qpid.Buffer/BufferDataException.cs
@@ -23,10 +23,10 @@ using System.Runtime.Serialization;
namespace Qpid.Buffer
{
- /**
- * A {@link RuntimeException} which is thrown when the data the {@link ByteBuffer}
- * contains is corrupt.
- */
+ /// <summary>
+ /// An exception thrown when the data the <see cref="ByteBuffer"/>
+ /// contains is corrupt
+ /// </summary>
[Serializable]
public class BufferDataException : Exception
{
diff --git a/qpid/dotnet/Qpid.Buffer/ByteBuffer.cs b/qpid/dotnet/Qpid.Buffer/ByteBuffer.cs
index d2941e8346..1a4f0072d6 100644
--- a/qpid/dotnet/Qpid.Buffer/ByteBuffer.cs
+++ b/qpid/dotnet/Qpid.Buffer/ByteBuffer.cs
@@ -604,7 +604,7 @@ namespace Qpid.Buffer
public abstract class ByteBuffer : IComparable
{
//private static ByteBufferAllocator allocator = new PooledByteBufferAllocator();
- private static ByteBufferAllocator allocator = new SimpleByteBufferAllocator();
+ private static IByteBufferAllocator allocator = new SimpleByteBufferAllocator();
private static bool _useDirectBuffers = false;
@@ -619,7 +619,7 @@ namespace Qpid.Buffer
/**
* Returns the current allocator which manages the allocated buffers.
*/
- public static ByteBufferAllocator getAllocator()
+ public static IByteBufferAllocator getAllocator()
{
return allocator;
}
@@ -628,20 +628,20 @@ namespace Qpid.Buffer
* Changes the current allocator with the specified one to manage
* the allocated buffers from now.
*/
- public static void setAllocator( ByteBufferAllocator newAllocator )
+ public static void setAllocator( IByteBufferAllocator newAllocator )
{
if( newAllocator == null )
{
throw new NullReferenceException("allocator cannot be null");
}
- ByteBufferAllocator oldAllocator = allocator;
+ IByteBufferAllocator oldAllocator = allocator;
allocator = newAllocator;
if( null != oldAllocator )
{
- oldAllocator.dispose();
+ oldAllocator.Dispose();
}
}
@@ -690,7 +690,7 @@ namespace Qpid.Buffer
*/
public static ByteBuffer allocate( int capacity, bool direct )
{
- return allocator.allocate( capacity, direct );
+ return allocator.Allocate( capacity, direct );
}
/**
@@ -698,7 +698,7 @@ namespace Qpid.Buffer
*/
public static ByteBuffer wrap( FixedByteBuffer nioBuffer )
{
- return allocator.wrap( nioBuffer );
+ return allocator.Wrap( nioBuffer );
}
/**
diff --git a/qpid/dotnet/Qpid.Buffer/ByteBufferAllocator.cs b/qpid/dotnet/Qpid.Buffer/ByteBufferAllocator.cs
deleted file mode 100644
index 2dabd0ef50..0000000000
--- a/qpid/dotnet/Qpid.Buffer/ByteBufferAllocator.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-using Qpid.Buffer;
-
-namespace Qpid.Buffer
-{
- /**
- * Allocates {@link ByteBuffer}s and manages them. Please implement this
- * interface if you need more advanced memory management scheme.
- */
- public interface ByteBufferAllocator
- {
- /**
- * Returns the buffer which is capable of the specified size.
- *
- * @param capacity the capacity of the buffer
- * @param direct <tt>true</tt> to get a direct buffer,
- * <tt>false</tt> to get a heap buffer.
- */
- ByteBuffer allocate(int capacity, bool direct);
-
- /**
- * Wraps the specified NIO {@link FixedByteBuffer} into MINA buffer.
- */
- ByteBuffer wrap(FixedByteBuffer nioBuffer);
-
- /**
- * Dispose of this allocator.
- */
- void dispose();
- }
-} \ No newline at end of file
diff --git a/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs b/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs
new file mode 100644
index 0000000000..215a9873fa
--- /dev/null
+++ b/qpid/dotnet/Qpid.Buffer/IByteBufferAllocator.cs
@@ -0,0 +1,29 @@
+namespace Qpid.Buffer
+{
+ /// <summary>
+ /// Allocates <see cref="ByteBuffer"/>'s and manages them. Please
+ /// implement this interface if you need more advanced memory management scheme
+ /// </summary>
+ public interface IByteBufferAllocator
+ {
+ /// <summary>
+ /// Returns the buffer which is capable of the specified size.
+ /// </summary>
+ /// <param name="capacity">The capacity of the buffer</param>
+ /// <param name="direct">true to get a direct buffer, false to get a heap buffer</param>
+ ByteBuffer Allocate(int capacity, bool direct);
+
+ /// <summary>
+ /// Wraps the specified buffer
+ /// </summary>
+ /// <param name="nioBuffer">fixed byte buffer</param>
+ /// <returns>The wrapped buffer</returns>
+ ByteBuffer Wrap(FixedByteBuffer nioBuffer);
+
+
+ /// <summary>
+ /// Dispose of this allocator.
+ /// </summary>
+ void Dispose();
+ }
+} \ No newline at end of file
diff --git a/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj b/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
index 7bca166fbc..3e4b302a3a 100644
--- a/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
+++ b/qpid/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
@@ -41,11 +41,11 @@
<Compile Include="BufferOverflowException.cs" />
<Compile Include="BufferUnderflowException.cs" />
<Compile Include="ByteBuffer.cs" />
- <Compile Include="ByteBufferAllocator.cs" />
<Compile Include="ByteBufferHexDumper.cs" />
<Compile Include="ByteBufferProxy.cs" />
<Compile Include="FixedByteBuffer.cs" />
<Compile Include="HeapByteBuffer.cs" />
+ <Compile Include="IByteBufferAllocator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimpleByteBufferAllocator.cs" />
</ItemGroup>
@@ -57,4 +57,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project> \ No newline at end of file
+</Project>
diff --git a/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs b/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
index b11d6b6b14..2de3a13560 100644
--- a/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
+++ b/qpid/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
@@ -23,11 +23,11 @@ using System.Runtime.CompilerServices;
namespace Qpid.Buffer
{
- /**
- * A simplistic {@link ByteBufferAllocator} which simply allocates a new
- * buffer every time.
- */
- public class SimpleByteBufferAllocator : ByteBufferAllocator
+ /// <summary>
+ /// A simplistic <see cref="ByteBufferAllocator"/> which simply allocates a new
+ /// buffer every time
+ /// </summary>
+ public class SimpleByteBufferAllocator : IByteBufferAllocator
{
private const int MINIMUM_CAPACITY = 1;
@@ -35,7 +35,7 @@ namespace Qpid.Buffer
{
}
- public ByteBuffer allocate( int capacity, bool direct )
+ public ByteBuffer Allocate( int capacity, bool direct )
{
FixedByteBuffer nioBuffer;
if( direct )
@@ -49,12 +49,12 @@ namespace Qpid.Buffer
return new SimpleByteBuffer( nioBuffer );
}
- public ByteBuffer wrap( FixedByteBuffer nioBuffer )
+ public ByteBuffer Wrap( FixedByteBuffer nioBuffer )
{
return new SimpleByteBuffer( nioBuffer );
}
- public void dispose()
+ public void Dispose()
{
}
diff --git a/qpid/dotnet/Qpid.Client.Tests/Common/BaseMessagingTestFixture.cs b/qpid/dotnet/Qpid.Client.Tests/Common/BaseMessagingTestFixture.cs
index fae610eb85..69f8cc1406 100644
--- a/qpid/dotnet/Qpid.Client.Tests/Common/BaseMessagingTestFixture.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/Common/BaseMessagingTestFixture.cs
@@ -22,7 +22,7 @@ using System;
using log4net;
using NUnit.Framework;
using Qpid.Messaging;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
namespace Qpid.Client.Tests
{
@@ -54,7 +54,7 @@ namespace Qpid.Client.Tests
try
{
- ConnectionInfo connectionInfo = QpidConnectionInfo.FromUrl(connectionUri);
+ IConnectionInfo connectionInfo = QpidConnectionInfo.FromUrl(connectionUri);
_connection = new AMQConnection(connectionInfo);
_channel = _connection.CreateChannel(false, AcknowledgeMode.NoAcknowledge, 1);
}
diff --git a/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs b/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
index d5330898a0..f03df903b2 100644
--- a/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
@@ -20,7 +20,7 @@
*/
using System;
using NUnit.Framework;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
using Qpid.Messaging;
namespace Qpid.Client.Tests.Connection
@@ -31,7 +31,7 @@ namespace Qpid.Client.Tests.Connection
[Test]
public void SimpleConnection()
{
- ConnectionInfo connectionInfo = new QpidConnectionInfo();
+ IConnectionInfo connectionInfo = new QpidConnectionInfo();
connectionInfo.AddBrokerInfo(new AmqBrokerInfo("amqp", "localhost", 5672, false));
using (IConnection connection = new AMQConnection(connectionInfo))
{
@@ -42,8 +42,8 @@ namespace Qpid.Client.Tests.Connection
[Test]
public void PasswordFailureConnection()
{
- ConnectionInfo connectionInfo = new QpidConnectionInfo();
- connectionInfo.SetPassword("rubbish");
+ IConnectionInfo connectionInfo = new QpidConnectionInfo();
+ connectionInfo.Password = "rubbish";
connectionInfo.AddBrokerInfo(new AmqBrokerInfo());
try
{
diff --git a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTest.cs b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTest.cs
index 52ef76c559..478d66b9da 100644
--- a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTest.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTest.cs
@@ -22,7 +22,7 @@ using System;
using System.Threading;
using log4net;
using NUnit.Framework;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
using Qpid.Messaging;
namespace Qpid.Client.Tests.failover
@@ -39,7 +39,7 @@ namespace Qpid.Client.Tests.failover
private IMessageConsumer _consumerOfResponse;
- void DoFailoverTest(ConnectionInfo info)
+ void DoFailoverTest(IConnectionInfo info)
{
DoFailoverTest(new AMQConnection(info));
}
diff --git a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs
index b2eecfc423..602f72762a 100644
--- a/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/failover/FailoverTxTest.cs
@@ -23,7 +23,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using log4net;
using NUnit.Framework;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
using Qpid.Messaging;
namespace Qpid.Client.Tests.failover
@@ -97,7 +97,7 @@ namespace Qpid.Client.Tests.failover
}
}
- void DoFailoverTxTest(ConnectionInfo connectionInfo)
+ void DoFailoverTxTest(IConnectionInfo connectionInfo)
{
_connection = new AMQConnection(connectionInfo);
_connection.ConnectionListener = this;
@@ -237,7 +237,7 @@ namespace Qpid.Client.Tests.failover
_log.Info("url = [" + defaultUrl + "]");
- ConnectionInfo connectionInfo = QpidConnectionInfo.FromUrl(defaultUrl);
+ IConnectionInfo connectionInfo = QpidConnectionInfo.FromUrl(defaultUrl);
_log.Info("connection url = [" + connectionInfo + "]");
diff --git a/qpid/dotnet/Qpid.Client.Tests/url/ConnectionUrlTest.cs b/qpid/dotnet/Qpid.Client.Tests/url/ConnectionUrlTest.cs
index 3e99c6f444..4ab6dd5736 100644
--- a/qpid/dotnet/Qpid.Client.Tests/url/ConnectionUrlTest.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/url/ConnectionUrlTest.cs
@@ -21,7 +21,7 @@
using System;
using System.Net;
using NUnit.Framework;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
namespace Qpid.Client.Tests.url
{
@@ -34,26 +34,26 @@ namespace Qpid.Client.Tests.url
//String url = "amqp://ritchiem:bob@/temp?brokerlist='tcp://localhost:5672;tcp://fancyserver:3000/',failover='roundrobin'";
String url = "amqp://ritchiem:bob@default/temp?brokerlist='tcp://localhost:5672;tcp://fancyserver:3000/',failover='roundrobin'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.AreEqual("roundrobin", connectionurl.GetFailoverMethod());
- Assert.IsTrue(connectionurl.GetUsername().Equals("ritchiem"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("bob"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.AreEqual("roundrobin", connectionurl.FailoverMethod);
+ Assert.IsTrue(connectionurl.Username.Equals("ritchiem"));
+ Assert.IsTrue(connectionurl.Password.Equals("bob"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 2);
+ Assert.IsTrue(connectionurl.BrokerCount == 2);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
service = connectionurl.GetBrokerInfo(1);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("fancyserver"));
- Assert.IsTrue(service.getPort() == 3000);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("fancyserver"));
+ Assert.IsTrue(service.Port == 3000);
}
@@ -62,20 +62,20 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://ritchiem:bob@default/temp?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("ritchiem"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("bob"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("ritchiem"));
+ Assert.IsTrue(connectionurl.Password.Equals("bob"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
}
[Test]
@@ -83,20 +83,20 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://ritchiem:@default/temp?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("ritchiem"));
- Assert.IsTrue(connectionurl.GetPassword().Equals(""));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("ritchiem"));
+ Assert.IsTrue(connectionurl.Password.Equals(""));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
}
[Test]
@@ -121,23 +121,23 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/test?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/test"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/test"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
}
[Test]
@@ -145,24 +145,24 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@clientname/temp?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
- Assert.IsTrue(connectionurl.GetClientName().Equals("clientname"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
+ Assert.IsTrue(connectionurl.ClientName.Equals("clientname"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Transport.Equals("tcp"));
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
}
[Test]
@@ -170,22 +170,22 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/temp?brokerlist='tcp://localhost:5672',routingkey='jim'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
+ Assert.IsTrue(service.Transport.Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
Assert.IsTrue(connectionurl.GetOption("routingkey").Equals("jim"));
}
@@ -194,22 +194,22 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/temp?brokerlist='localhost:'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
+ Assert.IsTrue(service.Transport.Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
}
[Test]
@@ -217,21 +217,21 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/temp?brokerlist='tcp://localhost:5672',routingkey='jim',timeout='200',immediatedelivery='true'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("tcp"));
+ Assert.IsTrue(service.Transport.Equals("tcp"));
- Assert.IsTrue(service.getHost().Equals("localhost"));
- Assert.IsTrue(service.getPort() == 5672);
+ Assert.IsTrue(service.Host.Equals("localhost"));
+ Assert.IsTrue(service.Port == 5672);
Assert.IsTrue(connectionurl.GetOption("routingkey").Equals("jim"));
Assert.IsTrue(connectionurl.GetOption("timeout").Equals("200"));
@@ -243,20 +243,20 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/messages?brokerlist='vm://default:2'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod() == null);
- Assert.IsTrue(connectionurl.GetUsername().Equals("guest"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("guest"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/messages"));
+ Assert.IsTrue(connectionurl.FailoverMethod == null);
+ Assert.IsTrue(connectionurl.Username.Equals("guest"));
+ Assert.IsTrue(connectionurl.Password.Equals("guest"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/messages"));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("vm"));
- Assert.AreEqual("localhost", service.getHost());
- Assert.AreEqual(2, service.getPort());
+ Assert.IsTrue(service.Transport.Equals("vm"));
+ Assert.AreEqual("localhost", service.Host);
+ Assert.AreEqual(2, service.Port);
}
[Test]
@@ -264,25 +264,25 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://ritchiem:bob@default/temp?brokerlist='vm://default:2;vm://default:3',failover='roundrobin'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetFailoverMethod().Equals("roundrobin"));
- Assert.IsTrue(connectionurl.GetUsername().Equals("ritchiem"));
- Assert.IsTrue(connectionurl.GetPassword().Equals("bob"));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/temp"));
+ Assert.IsTrue(connectionurl.FailoverMethod.Equals("roundrobin"));
+ Assert.IsTrue(connectionurl.Username.Equals("ritchiem"));
+ Assert.IsTrue(connectionurl.Password.Equals("bob"));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/temp"));
- Assert.AreEqual(2, connectionurl.GetBrokerCount());
+ Assert.AreEqual(2, connectionurl.BrokerCount);
- BrokerInfo service = connectionurl.GetBrokerInfo(0);
+ IBrokerInfo service = connectionurl.GetBrokerInfo(0);
- Assert.IsTrue(service.getTransport().Equals("vm"));
- Assert.AreEqual("localhost", service.getHost());
- Assert.IsTrue(service.getPort() == 2);
+ Assert.IsTrue(service.Transport.Equals("vm"));
+ Assert.AreEqual("localhost", service.Host);
+ Assert.IsTrue(service.Port == 2);
service = connectionurl.GetBrokerInfo(1);
- Assert.IsTrue(service.getTransport().Equals("vm"));
- Assert.AreEqual("localhost", service.getHost());
- Assert.IsTrue(service.getPort() == 3);
+ Assert.IsTrue(service.Transport.Equals("vm"));
+ Assert.AreEqual("localhost", service.Host);
+ Assert.IsTrue(service.Port == 3);
}
[Test]
@@ -306,14 +306,14 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://user:@default/test?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connectionurl = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connectionurl.GetUsername().Equals("user"));
- Assert.IsTrue(connectionurl.GetPassword().Equals(""));
- Assert.IsTrue(connectionurl.GetVirtualHost().Equals("/test"));
- Assert.IsTrue(connectionurl.GetClientName().StartsWith(Dns.GetHostName()));
+ Assert.IsTrue(connectionurl.Username.Equals("user"));
+ Assert.IsTrue(connectionurl.Password.Equals(""));
+ Assert.IsTrue(connectionurl.VirtualHost.Equals("/test"));
+ Assert.IsTrue(connectionurl.ClientName.StartsWith(Dns.GetHostName()));
- Assert.IsTrue(connectionurl.GetBrokerCount() == 1);
+ Assert.IsTrue(connectionurl.BrokerCount == 1);
}
[Test]
@@ -372,8 +372,8 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/t.-_+!=:?brokerlist='tcp://localhost:5672'";
- ConnectionInfo connection = QpidConnectionInfo.FromUrl(url);
- Assert.IsTrue(connection.GetVirtualHost().Equals("/t.-_+!=:"));
+ IConnectionInfo connection = QpidConnectionInfo.FromUrl(url);
+ Assert.IsTrue(connection.VirtualHost.Equals("/t.-_+!=:"));
}
[Test]
@@ -381,10 +381,10 @@ namespace Qpid.Client.Tests.url
{
String url = "amqp://guest:guest@default/test=:?brokerlist='tcp://localhost'";
- ConnectionInfo connection = QpidConnectionInfo.FromUrl(url);
+ IConnectionInfo connection = QpidConnectionInfo.FromUrl(url);
- BrokerInfo broker = connection.GetBrokerInfo(0);
- Assert.IsTrue(broker.getPort() == BrokerInfoConstants.DEFAULT_PORT);
+ IBrokerInfo broker = connection.GetBrokerInfo(0);
+ Assert.IsTrue(broker.Port == BrokerInfoConstants.DEFAULT_PORT);
}
diff --git a/qpid/dotnet/Qpid.Client/Client/AMQConnection.cs b/qpid/dotnet/Qpid.Client/Client/AMQConnection.cs
index 3192b0018d..1a342f0b15 100644
--- a/qpid/dotnet/Qpid.Client/Client/AMQConnection.cs
+++ b/qpid/dotnet/Qpid.Client/Client/AMQConnection.cs
@@ -26,7 +26,7 @@ using System.Threading;
using log4net;
using Qpid.Client.Failover;
using Qpid.Client.Protocol;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
using Qpid.Client.State;
using Qpid.Client.Transport;
using Qpid.Client.Transport.Socket.Blocking;
@@ -40,7 +40,7 @@ namespace Qpid.Client
{
private static readonly ILog _log = LogManager.GetLogger(typeof(AMQConnection));
- ConnectionInfo _connectionInfo;
+ IConnectionInfo _connectionInfo;
private int _nextChannelId = 0;
// _Connected should be refactored with a suitable wait object.
@@ -121,7 +121,7 @@ namespace Qpid.Client
get { return _protocolWriter; }
}
- public AMQConnection(ConnectionInfo connectionInfo)
+ public AMQConnection(IConnectionInfo connectionInfo)
{
if (connectionInfo == null)
{
@@ -129,7 +129,7 @@ namespace Qpid.Client
}
_log.Info("ConnectionInfo: " + connectionInfo);
_connectionInfo = connectionInfo;
- _log.Info("password = " + _connectionInfo.GetPassword());
+ _log.Info("password = " + _connectionInfo.Password);
_failoverPolicy = new FailoverPolicy(connectionInfo);
// We are not currently connected.
@@ -140,7 +140,7 @@ namespace Qpid.Client
{
try
{
- BrokerInfo brokerInfo = _failoverPolicy.GetNextBrokerInfo();
+ IBrokerInfo brokerInfo = _failoverPolicy.GetNextBrokerInfo();
_log.Info("Connecting to " + brokerInfo);
MakeBrokerConnection(brokerInfo);
break;
@@ -220,12 +220,12 @@ namespace Qpid.Client
get
{
CheckNotClosed();
- return _connectionInfo.GetClientName();
+ return _connectionInfo.ClientName;
}
set
{
CheckNotClosed();
- _connectionInfo.SetClientName(value);
+ _connectionInfo.ClientName = value;
}
}
@@ -505,7 +505,7 @@ namespace Qpid.Client
{
get
{
- return _failoverPolicy.GetCurrentBrokerInfo().getHost();
+ return _failoverPolicy.GetCurrentBrokerInfo().Host;
}
}
@@ -513,7 +513,7 @@ namespace Qpid.Client
{
get
{
- return _failoverPolicy.GetCurrentBrokerInfo().getPort();
+ return _failoverPolicy.GetCurrentBrokerInfo().Port;
}
}
@@ -521,7 +521,7 @@ namespace Qpid.Client
{
get
{
- return _connectionInfo.GetUsername();
+ return _connectionInfo.Username;
}
}
@@ -529,7 +529,7 @@ namespace Qpid.Client
{
get
{
- return _connectionInfo.GetPassword();
+ return _connectionInfo.Password;
}
}
@@ -537,7 +537,7 @@ namespace Qpid.Client
{
get
{
- return _connectionInfo.GetVirtualHost();
+ return _connectionInfo.VirtualHost;
}
}
@@ -674,7 +674,7 @@ namespace Qpid.Client
public bool AttemptReconnection(String host, int port, bool useSSL)
{
- BrokerInfo bd = new AmqBrokerInfo("amqp", host, port, useSSL);
+ IBrokerInfo bd = new AmqBrokerInfo("amqp", host, port, useSSL);
_failoverPolicy.setBroker(bd);
@@ -691,7 +691,7 @@ namespace Qpid.Client
return false;
}
- private void MakeBrokerConnection(BrokerInfo brokerDetail)
+ private void MakeBrokerConnection(IBrokerInfo brokerDetail)
{
try
{
@@ -708,7 +708,7 @@ namespace Qpid.Client
_transport = LoadTransportFromAssembly(brokerDetail.getHost(), brokerDetail.getPort(), assemblyName, transportType);
*/
- _transport = new BlockingSocketTransport(brokerDetail.getHost(), brokerDetail.getPort(), this);
+ _transport = new BlockingSocketTransport(brokerDetail.Host, brokerDetail.Port, this);
// Connect.
_transport.Open();
diff --git a/qpid/dotnet/Qpid.Client/Client/AmqBrokerInfo.cs b/qpid/dotnet/Qpid.Client/Client/AmqBrokerInfo.cs
index 81a5f10647..f26756ccad 100644
--- a/qpid/dotnet/Qpid.Client/Client/AmqBrokerInfo.cs
+++ b/qpid/dotnet/Qpid.Client/Client/AmqBrokerInfo.cs
@@ -21,11 +21,11 @@
using System;
using System.Collections;
using System.Text;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
namespace Qpid.Client
{
- public class AmqBrokerInfo : BrokerInfo
+ public class AmqBrokerInfo : IBrokerInfo
{
public readonly string URL_FORMAT_EXAMPLE =
"<transport>://<hostname>[:<port Default=\""+BrokerInfoConstants.DEFAULT_PORT+"\">][?<option>='<value>'[,<option>='<value>']]";
@@ -90,10 +90,10 @@ namespace Qpid.Client
" In broker URL:'" + url + "' Format: " + URL_FORMAT_EXAMPLE, "");
}
- setTransport(transport);
+ Transport = transport;
String host = connection.Host;
- if (!host.Equals("default")) setHost(host);
+ if (!host.Equals("default")) Host = host;
int port = connection.Port;
@@ -130,7 +130,7 @@ namespace Qpid.Client
}
if (found)
{
- setPort(int.Parse(auth.Substring(start, end-start+1)));
+ Port = int.Parse(auth.Substring(start, end-start+1));
}
else
{
@@ -140,12 +140,12 @@ namespace Qpid.Client
}
else
{
- setPort(BrokerInfoConstants.DEFAULT_PORT);
+ Port = BrokerInfoConstants.DEFAULT_PORT;
}
}
else
{
- setPort(port);
+ Port = port;
}
String queryString = connection.Query;
@@ -178,70 +178,58 @@ namespace Qpid.Client
if (useSSL)
{
- setOption(BrokerInfoConstants.OPTIONS_SSL, "true");
+ SetOption(BrokerInfoConstants.OPTIONS_SSL, "true");
}
}
- public string getHost()
+ public string Host
{
- return _host;
+ get { return _host; }
+ set { _host = value; }
}
- public void setHost(string _host)
+ public int Port
{
- this._host = _host;
+ get { return _port; }
+ set { _port = value; }
}
- public int getPort()
+ public string Transport
{
- return _port;
+ get { return _transport; }
+ set { _transport = value; }
}
- public void setPort(int _port)
- {
- this._port = _port;
- }
-
- public string getTransport()
- {
- return _transport;
- }
-
- public void setTransport(string _transport)
- {
- this._transport = _transport;
- }
-
- public string getOption(string key)
+ public string GetOption(string key)
{
return (string)_options[key];
}
- public void setOption(string key, string value)
+ public void SetOption(string key, string value)
{
_options[key] = value;
}
- public long getTimeout()
+ public long Timeout
{
- if (_options.ContainsKey(BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT))
+ get
{
- try
- {
- return long.Parse((string)_options[BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT]);
- }
- catch (FormatException)
+ if ( _options.ContainsKey(BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT) )
{
- //Do nothing as we will use the default below.
+ try
+ {
+ return long.Parse(GetOption(BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT));
+ } catch ( FormatException )
+ {
+ //Do nothing as we will use the default below.
+ }
}
+ return BrokerInfoConstants.DEFAULT_CONNECT_TIMEOUT;
+ }
+ set
+ {
+ SetOption(BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT, value.ToString());
}
-
- return BrokerInfoConstants.DEFAULT_CONNECT_TIMEOUT;
- }
-
- public void setTimeout(long timeout)
- {
- setOption(BrokerInfoConstants.OPTIONS_CONNECT_TIMEOUT, timeout.ToString());
}
public override string ToString()
@@ -267,15 +255,15 @@ namespace Qpid.Client
public override bool Equals(object obj)
{
- if (!(obj is BrokerInfo))
+ if (!(obj is IBrokerInfo))
{
return false;
}
- BrokerInfo bd = (BrokerInfo) obj;
- return StringEqualsIgnoreCase(_host, bd.getHost()) &&
- _port == bd.getPort() &&
- _transport == bd.getTransport();
+ IBrokerInfo bd = (IBrokerInfo) obj;
+ return StringEqualsIgnoreCase(_host, bd.Host) &&
+ _port == bd.Port &&
+ _transport == bd.Transport;
}
public override int GetHashCode()
@@ -318,23 +306,25 @@ namespace Qpid.Client
// return optionsURL.tostring();
// }
- public bool useSSL()
+ public bool UseSSL
{
- // To be friendly to users we should be case insensitive.
- // or simply force users to conform to OPTIONS_SSL
- // todo make case insensitive by trying ssl Ssl sSl ssL SSl SsL sSL SSL
-
- if (_options.ContainsKey(BrokerInfoConstants.OPTIONS_SSL))
+ get
{
- return StringEqualsIgnoreCase((string)_options[BrokerInfoConstants.OPTIONS_SSL], "true");
- }
+ // To be friendly to users we should be case insensitive.
+ // or simply force users to conform to OPTIONS_SSL
+ // todo make case insensitive by trying ssl Ssl sSl ssL SSl SsL sSL SSL
- return false;
- }
+ if ( _options.ContainsKey(BrokerInfoConstants.OPTIONS_SSL) )
+ {
+ return StringEqualsIgnoreCase(GetOption(BrokerInfoConstants.OPTIONS_SSL), "true");
+ }
- public void useSSL(bool ssl)
- {
- setOption(BrokerInfoConstants.OPTIONS_SSL, ssl.ToString());
+ return false;
+ }
+ set
+ {
+ SetOption(BrokerInfoConstants.OPTIONS_SSL, value.ToString());
+ }
}
}
}
diff --git a/qpid/dotnet/Qpid.Client/Client/QpidConnectionInfo.cs b/qpid/dotnet/Qpid.Client/Client/QpidConnectionInfo.cs
index 7207253603..66bb549779 100644
--- a/qpid/dotnet/Qpid.Client/Client/QpidConnectionInfo.cs
+++ b/qpid/dotnet/Qpid.Client/Client/QpidConnectionInfo.cs
@@ -24,7 +24,7 @@ using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using log4net;
-using Qpid.Client.qms;
+using Qpid.Client.Qms;
namespace Qpid.Client
{
@@ -192,10 +192,10 @@ namespace Qpid.Client
public class QpidConnectionUrl
{
- internal static ConnectionInfo FromUrl(string fullURL)
+ internal static IConnectionInfo FromUrl(string fullURL)
{
//_url = fullURL;
- ConnectionInfo connectionInfo = new QpidConnectionInfo();
+ IConnectionInfo connectionInfo = new QpidConnectionInfo();
// _options = new HashMap<String, String>();
@@ -216,7 +216,7 @@ namespace Qpid.Client
if (connection.Host != null && connection.Host.Length > 0 && !connection.Host.Equals("default"))
{
- connectionInfo.SetClientName(connection.Host);
+ connectionInfo.ClientName = connection.Host;
}
String userInfo = connection.UserInfo;
@@ -231,9 +231,9 @@ namespace Qpid.Client
}
String virtualHost = connection.AbsolutePath; // XXX: is AbsolutePath corrrect?
- if (virtualHost != null && (!virtualHost.Equals("")))
+ if (virtualHost != null && virtualHost.Length > 0)
{
- connectionInfo.SetVirtualHost(virtualHost);
+ connectionInfo.VirtualHost = virtualHost;
}
else
{
@@ -290,7 +290,7 @@ namespace Qpid.Client
}
}
- private static void parseUserInfo(String userinfo, string fullUrl, ConnectionInfo connectionInfo)
+ private static void parseUserInfo(String userinfo, string fullUrl, IConnectionInfo connectionInfo)
{
//user info = user:pass
@@ -303,12 +303,12 @@ namespace Qpid.Client
}
else
{
- connectionInfo.setUsername(userinfo.Substring(0, colonIndex));
- connectionInfo.SetPassword(userinfo.Substring(colonIndex + 1));
+ connectionInfo.Username = userinfo.Substring(0, colonIndex);
+ connectionInfo.Password = userinfo.Substring(colonIndex + 1);
}
}
- private static void processOptions(ConnectionInfo connectionInfo)
+ private static void processOptions(IConnectionInfo connectionInfo)
{
string brokerlist = connectionInfo.GetOption(ConnectionUrlConstants.OPTIONS_BROKERLIST);
if (brokerlist != null)
@@ -334,14 +334,14 @@ namespace Qpid.Client
if (methodIndex > -1)
{
- connectionInfo.SetFailoverMethod(failover.Substring(0, methodIndex));
+ connectionInfo.FailoverMethod = failover.Substring(0, methodIndex);
QpidConnectionInfo qpidConnectionInfo = (QpidConnectionInfo)connectionInfo;
URLHelper.parseOptions(qpidConnectionInfo.GetFailoverOptions(),
failover.Substring(methodIndex + 1));
}
else
{
- connectionInfo.SetFailoverMethod(failover);
+ connectionInfo.FailoverMethod = failover;
}
connectionInfo.SetOption(ConnectionUrlConstants.OPTIONS_FAILOVER, null);
@@ -349,14 +349,14 @@ namespace Qpid.Client
}
}
- internal static ConnectionInfo FromUri(Uri uri)
+ internal static IConnectionInfo FromUri(Uri uri)
{
return null; // FIXME
}
}
- public class QpidConnectionInfo : ConnectionInfo
+ public class QpidConnectionInfo : IConnectionInfo
{
string _username = "guest";
string _password = "guest";
@@ -378,7 +378,7 @@ namespace Qpid.Client
return _options;
}
- public static ConnectionInfo FromUrl(String url)
+ public static IConnectionInfo FromUrl(String url)
{
return QpidConnectionUrl.FromUrl(url);
}
@@ -386,7 +386,7 @@ namespace Qpid.Client
public string AsUrl()
{
string result = "amqp://";
- foreach (BrokerInfo info in _brokerInfos)
+ foreach (IBrokerInfo info in _brokerInfos)
{
result += info.ToString();
}
@@ -394,14 +394,10 @@ namespace Qpid.Client
}
- public string GetFailoverMethod()
+ public string FailoverMethod
{
- return _failoverMethod;
- }
-
- public void SetFailoverMethod(string failoverMethod)
- {
- _failoverMethod = failoverMethod;
+ get { return _failoverMethod; }
+ set { _failoverMethod = value; }
}
public string GetFailoverOption(string key)
@@ -409,17 +405,17 @@ namespace Qpid.Client
return (string)_failoverOptions[key];
}
- public int GetBrokerCount()
+ public int BrokerCount
{
- return _brokerInfos.Count;
+ get { return _brokerInfos.Count; }
}
- public BrokerInfo GetBrokerInfo(int index)
+ public IBrokerInfo GetBrokerInfo(int index)
{
- return (BrokerInfo)_brokerInfos[index];
+ return (IBrokerInfo)_brokerInfos[index];
}
- public void AddBrokerInfo(BrokerInfo brokerInfo)
+ public void AddBrokerInfo(IBrokerInfo brokerInfo)
{
if (!_brokerInfos.Contains(brokerInfo))
{
@@ -432,44 +428,28 @@ namespace Qpid.Client
return _brokerInfos;
}
- public string GetClientName()
- {
- return _clientName;
- }
-
- public void SetClientName(string clientName)
- {
- _clientName = clientName;
- }
-
- public string GetUsername()
- {
- return _username;
- }
-
- public void setUsername(string username)
- {
- _username = username;
- }
-
- public string GetPassword()
+ public string ClientName
{
- return _password;
+ get { return _clientName; }
+ set { _clientName = value; }
}
- public void SetPassword(string password)
+ public string Username
{
- _password = password;
+ get { return _username; }
+ set { _username = value; }
}
- public string GetVirtualHost()
+ public string Password
{
- return _virtualHost;
+ get { return _password; }
+ set { _password = value; }
}
- public void SetVirtualHost(string virtualHost)
+ public string VirtualHost
{
- _virtualHost = virtualHost;
+ get { return _virtualHost; }
+ set { _virtualHost = value; }
}
public string GetOption(string key)
diff --git a/qpid/dotnet/Qpid.Client/qms/BrokerInfo.cs b/qpid/dotnet/Qpid.Client/qms/BrokerInfo.cs
index 6fe02403b7..69cd1bdbf7 100644
--- a/qpid/dotnet/Qpid.Client/qms/BrokerInfo.cs
+++ b/qpid/dotnet/Qpid.Client/qms/BrokerInfo.cs
@@ -20,7 +20,7 @@
*/
using System;
-namespace Qpid.Client.qms
+namespace Qpid.Client.Qms
{
/// <summary>
/// Know URL option names.
@@ -40,24 +40,15 @@ namespace Qpid.Client.qms
public const long DEFAULT_CONNECT_TIMEOUT = 30000L;
}
- public interface BrokerInfo
+ public interface IBrokerInfo
{
- String getHost();
- void setHost(string host);
-
- int getPort();
- void setPort(int port);
-
- String getTransport();
- void setTransport(string transport);
-
- bool useSSL();
- void useSSL(bool ssl);
-
- String getOption(string key);
- void setOption(string key, string value);
-
- long getTimeout();
- void setTimeout(long timeout);
+ string Host { get; set; }
+ int Port { get; set; }
+ string Transport { get; set; }
+ bool UseSSL { get; set; }
+ long Timeout { get; set; }
+
+ String GetOption(string key);
+ void SetOption(string key, string value);
}
-} \ No newline at end of file
+}
diff --git a/qpid/dotnet/Qpid.Client/qms/ConnectionInfo.cs b/qpid/dotnet/Qpid.Client/qms/ConnectionInfo.cs
index 8ac11ec1ab..4bdf8f4d7c 100644
--- a/qpid/dotnet/Qpid.Client/qms/ConnectionInfo.cs
+++ b/qpid/dotnet/Qpid.Client/qms/ConnectionInfo.cs
@@ -20,7 +20,7 @@
*/
using System.Collections;
-namespace Qpid.Client.qms
+namespace Qpid.Client.Qms
{
class ConnectionUrlConstants
{
@@ -31,45 +31,31 @@ namespace Qpid.Client.qms
public const string OPTIONS_SSL = "ssl";
}
- /**
- Connection URL format
- amqp://[user:pass@][clientid]/virtualhost?brokerlist='tcp://host:port?option=\'value\'&option=\'value\';vm://:3/virtualpath?option=\'value\''&failover='method?option=\'value\'&option='value''"
- Options are of course optional except for requiring a single broker in the broker list.
- The option seperator is defined to be either '&' or ','
- */
- public interface ConnectionInfo
+ /// <summary>
+ /// Connection URL format
+ /// amqp://[user:pass@][clientid]/virtualhost?brokerlist='tcp://host:port?option=\'value\'&amp;option=\'value\';vm://:3/virtualpath?option=\'value\''&amp;failover='method?option=\'value\'&amp;option='value''"
+ /// Options are of course optional except for requiring a single broker in the broker list.
+ /// The option seperator is defined to be either '&amp;' or ','
+ /// </summary>
+ public interface IConnectionInfo
{
string AsUrl();
- string GetFailoverMethod();
- void SetFailoverMethod(string failoverMethod);
-
+ string FailoverMethod { get; set; }
+ string ClientName { get; set; }
+ string Username { get; set; }
+ string Password { get; set; }
+ string VirtualHost { get; set; }
string GetFailoverOption(string key);
+
+ int BrokerCount { get; }
- int GetBrokerCount();
-
- BrokerInfo GetBrokerInfo(int index);
+ IBrokerInfo GetBrokerInfo(int index);
- void AddBrokerInfo(BrokerInfo broker);
+ void AddBrokerInfo(IBrokerInfo broker);
IList GetAllBrokerInfos();
- string GetClientName();
-
- void SetClientName(string clientName);
-
- string GetUsername();
-
- void setUsername(string username);
-
- string GetPassword();
-
- void SetPassword(string password);
-
- string GetVirtualHost();
-
- void SetVirtualHost(string virtualHost);
-
string GetOption(string key);
void SetOption(string key, string value);
diff --git a/qpid/dotnet/Qpid.Client/qms/FailoverPolicy.cs b/qpid/dotnet/Qpid.Client/qms/FailoverPolicy.cs
index 5d3eceb58e..99ab3dc66e 100644
--- a/qpid/dotnet/Qpid.Client/qms/FailoverPolicy.cs
+++ b/qpid/dotnet/Qpid.Client/qms/FailoverPolicy.cs
@@ -21,9 +21,9 @@
using System;
using System.Text;
using log4net;
-using Qpid.Client.qms.failover;
+using Qpid.Client.Qms.Failover;
-namespace Qpid.Client.qms
+namespace Qpid.Client.Qms
{
public class FailoverPolicy
{
@@ -34,7 +34,7 @@ namespace Qpid.Client.qms
private const long DEFAULT_METHOD_TIMEOUT = 1 * MINUTE;
private const long DEFAULT_FAILOVER_TIMEOUT = 4 * MINUTE;
- private FailoverMethod[] _methods = new FailoverMethod[1];
+ private IFailoverMethod[] _methods = new IFailoverMethod[1];
private int _currentMethod;
@@ -47,18 +47,18 @@ namespace Qpid.Client.qms
private long _lastMethodTime;
private long _lastFailTime;
- public FailoverPolicy(ConnectionInfo connectionInfo)
+ public FailoverPolicy(IConnectionInfo connectionInfo)
{
- FailoverMethod method;
+ IFailoverMethod method;
//todo This should be integrated in to the connection url when it supports
// multiple strategies.
_methodsRetries = 0;
- if (connectionInfo.GetFailoverMethod() == null)
+ if (connectionInfo.FailoverMethod == null)
{
- if (connectionInfo.GetBrokerCount() > 1)
+ if (connectionInfo.BrokerCount > 1)
{
method = new FailoverRoundRobin(connectionInfo);
}
@@ -69,7 +69,7 @@ namespace Qpid.Client.qms
}
else
{
- string failoverMethod = connectionInfo.GetFailoverMethod();
+ string failoverMethod = connectionInfo.FailoverMethod;
/*
if (failoverMethod.equals(FailoverMethod.RANDOM))
@@ -110,11 +110,11 @@ namespace Qpid.Client.qms
_methods[_currentMethod] = method;
}
- public FailoverPolicy(FailoverMethod method) : this(method, 0)
+ public FailoverPolicy(IFailoverMethod method) : this(method, 0)
{
}
- public FailoverPolicy(FailoverMethod method, int retries)
+ public FailoverPolicy(IFailoverMethod method, int retries)
{
_methodsRetries = retries;
@@ -169,7 +169,7 @@ namespace Qpid.Client.qms
}
- if (_methods[_currentMethod].failoverAllowed())
+ if (_methods[_currentMethod].FailoverAllowed())
{
failoverAllowed = true;
}
@@ -178,7 +178,7 @@ namespace Qpid.Client.qms
if (_currentMethod < (_methods.Length - 1))
{
nextMethod();
- _logger.Info("Changing method to " + _methods[_currentMethod].methodName());
+ _logger.Info("Changing method to " + _methods[_currentMethod].MethodName);
return FailoverAllowed();
}
else
@@ -200,7 +200,7 @@ namespace Qpid.Client.qms
if (_currentMethod < (_methods.Length - 1))
{
_currentMethod++;
- _methods[_currentMethod].reset();
+ _methods[_currentMethod].Reset();
return true;
}
else
@@ -217,8 +217,8 @@ namespace Qpid.Client.qms
_currentMethod = 0;
- _logger.Info("Retrying methods starting with " + _methods[_currentMethod].methodName());
- _methods[_currentMethod].reset();
+ _logger.Info("Retrying methods starting with " + _methods[_currentMethod].MethodName);
+ _methods[_currentMethod].Reset();
return FailoverAllowed();
}
else
@@ -235,30 +235,30 @@ namespace Qpid.Client.qms
{
_currentRetry = 0;
- _methods[_currentMethod].attainedConnection();
+ _methods[_currentMethod].AttainedConnection();
_timing = false;
}
- public BrokerInfo GetCurrentBrokerInfo()
+ public IBrokerInfo GetCurrentBrokerInfo()
{
return _methods[_currentMethod].GetCurrentBrokerInfo();
}
- public BrokerInfo GetNextBrokerInfo()
+ public IBrokerInfo GetNextBrokerInfo()
{
- return _methods[_currentMethod].getNextBrokerDetails();
+ return _methods[_currentMethod].GetNextBrokerDetails();
}
- public void setBroker(BrokerInfo broker)
+ public void setBroker(IBrokerInfo broker)
{
- _methods[_currentMethod].setBroker(broker);
+ _methods[_currentMethod].SetBroker(broker);
}
- public void addMethod(FailoverMethod method)
+ public void addMethod(IFailoverMethod method)
{
int len = _methods.Length + 1;
- FailoverMethod[] newMethods = new FailoverMethod[len];
+ IFailoverMethod[] newMethods = new IFailoverMethod[len];
_methods.CopyTo(newMethods, 0);
// System.arraycopy(_methods, 0, newMethods, 0, _methods.length);
int index = len - 1;
@@ -271,7 +271,7 @@ namespace Qpid.Client.qms
_methodsRetries = retries;
}
- public FailoverMethod getCurrentMethod()
+ public IFailoverMethod getCurrentMethod()
{
if (_currentMethod >= 0 && _currentMethod < (_methods.Length - 1))
{
@@ -312,4 +312,4 @@ namespace Qpid.Client.qms
return sb.ToString();
}
}
-} \ No newline at end of file
+}
diff --git a/qpid/dotnet/Qpid.Client/qms/UrlSyntaxException.cs b/qpid/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
index e6da62a829..dc0c06c22f 100644
--- a/qpid/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
+++ b/qpid/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
@@ -22,7 +22,7 @@ using System;
using System.Runtime.Serialization;
using System.Text;
-namespace Qpid.Client.qms
+namespace Qpid.Client.Qms
{
[Serializable]
public class UrlSyntaxException : UriFormatException
diff --git a/qpid/dotnet/Qpid.Client/qms/failover/FailoverMethod.cs b/qpid/dotnet/Qpid.Client/qms/failover/FailoverMethod.cs
index 7db9ef32fa..076c62a6d6 100644
--- a/qpid/dotnet/Qpid.Client/qms/failover/FailoverMethod.cs
+++ b/qpid/dotnet/Qpid.Client/qms/failover/FailoverMethod.cs
@@ -20,7 +20,7 @@
*/
using System;
-namespace Qpid.Client.qms.failover
+namespace Qpid.Client.Qms.Failover
{
public class FailoverMethodConstants
{
@@ -28,52 +28,51 @@ namespace Qpid.Client.qms.failover
public const String RANDOM = "random";
}
- public interface FailoverMethod
+ public interface IFailoverMethod
{
- /**
- * Reset the Failover to initial conditions
- */
- void reset();
+ /// <summary>
+ /// The name of this method for display purposes.
+ /// </summary>
+ String MethodName { get; }
+
+ /// <summary>
+ /// Reset the Failover to initial conditions
+ /// </summary>
+ void Reset();
- /**
- * Check if failover is possible for this method
- *
- * @return true if failover is allowed
- */
- bool failoverAllowed();
+ /// <summary>
+ /// Check if failover is possible for this method
+ /// </summary>
+ /// <returns>true if failover is allowed</returns>
+ bool FailoverAllowed();
- /**
- * Notification to the Failover method that a connection has been attained.
- */
- void attainedConnection();
+ /// <summary>
+ /// Notification to the Failover method that a connection has been attained.
+ /// </summary>
+ void AttainedConnection();
- /**
- * If there is no current BrokerInfo the null will be returned.
- * @return The current BrokerDetail value to use
- */
- BrokerInfo GetCurrentBrokerInfo();
+ /// <summary>
+ /// If there is no current BrokerInfo the null will be returned.
+ /// </summary>
+ /// <returns>The current BrokerDetail value to use</returns>
+ IBrokerInfo GetCurrentBrokerInfo();
- /**
- * Move to the next BrokerInfo if one is available.
- * @return the next BrokerDetail or null if there is none.
- */
- BrokerInfo getNextBrokerDetails();
+ /// <summary>
+ /// Move to the next BrokerInfo if one is available.
+ /// </summary>
+ /// <returns>the next BrokerDetail or null if there is none.</returns>
+ IBrokerInfo GetNextBrokerDetails();
- /**
- * Set the currently active broker to be the new value.
- * @param broker The new BrokerDetail value
- */
- void setBroker(BrokerInfo broker);
+ /// <summary>
+ /// Set the currently active broker to be the new value.
+ /// </summary>
+ /// <param name="broker">The new BrokerDetail value</param>
+ void SetBroker(IBrokerInfo broker);
- /**
- * Set the retries for this method
- * @param maxRetries the maximum number of time to retry this Method
- */
- void setRetries(int maxRetries);
-
- /**
- * @return The name of this method for display purposes.
- */
- String methodName();
+ /// <summary>
+ /// Set the retries for this method
+ /// </summary>
+ /// <param name="maxRetries">the maximum number of time to retry this Method</param>
+ void SetRetries(int maxRetries);
}
}
diff --git a/qpid/dotnet/Qpid.Client/qms/failover/FailoverRoundRobin.cs b/qpid/dotnet/Qpid.Client/qms/failover/FailoverRoundRobin.cs
index aac16a40fa..4e6b23ce86 100644
--- a/qpid/dotnet/Qpid.Client/qms/failover/FailoverRoundRobin.cs
+++ b/qpid/dotnet/Qpid.Client/qms/failover/FailoverRoundRobin.cs
@@ -22,9 +22,9 @@ using System;
using System.Text;
using log4net;
-namespace Qpid.Client.qms.failover
+namespace Qpid.Client.Qms.Failover
{
- public class FailoverRoundRobin : FailoverMethod
+ public class FailoverRoundRobin : IFailoverMethod
{
private static readonly ILog _logger = LogManager.GetLogger(typeof(FailoverRoundRobin));
@@ -61,11 +61,11 @@ namespace Qpid.Client.qms.failover
/**
* Array of BrokerDetail used to make connections.
*/
- private ConnectionInfo _connectionDetails;
+ private IConnectionInfo _connectionDetails;
- public FailoverRoundRobin(ConnectionInfo connectionDetails)
+ public FailoverRoundRobin(IConnectionInfo connectionDetails)
{
- if (!(connectionDetails.GetBrokerCount() > 0))
+ if (!(connectionDetails.BrokerCount > 0))
{
throw new ArgumentException("At least one broker details must be specified.");
}
@@ -95,27 +95,27 @@ namespace Qpid.Client.qms.failover
_currentServerRetry = -1;
}
- public void reset()
+ public void Reset()
{
_currentBrokerIndex = 0;
_currentCycleRetries = 0;
_currentServerRetry = -1;
}
- public bool failoverAllowed()
+ public bool FailoverAllowed()
{
return ((_currentCycleRetries < _cycleRetries)
|| (_currentServerRetry < _serverRetries)
- || (_currentBrokerIndex < (_connectionDetails.GetBrokerCount() - 1)));
+ || (_currentBrokerIndex < (_connectionDetails.BrokerCount - 1)));
}
- public void attainedConnection()
+ public void AttainedConnection()
{
_currentCycleRetries = 0;
_currentServerRetry = -1;
}
- public BrokerInfo GetCurrentBrokerInfo()
+ public IBrokerInfo GetCurrentBrokerInfo()
{
if (_currentBrokerIndex == -1)
{
@@ -125,9 +125,9 @@ namespace Qpid.Client.qms.failover
return _connectionDetails.GetBrokerInfo(_currentBrokerIndex);
}
- public BrokerInfo getNextBrokerDetails()
+ public IBrokerInfo GetNextBrokerDetails()
{
- if (_currentBrokerIndex == (_connectionDetails.GetBrokerCount() - 1))
+ if (_currentBrokerIndex == (_connectionDetails.BrokerCount - 1))
{
if (_currentServerRetry < _serverRetries)
{
@@ -135,7 +135,7 @@ namespace Qpid.Client.qms.failover
{
_currentBrokerIndex = 0;
- setBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
+ SetBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
_logger.Info("First Run using " + _connectionDetails.GetBrokerInfo(_currentBrokerIndex));
}
@@ -152,7 +152,7 @@ namespace Qpid.Client.qms.failover
//failed to connect to first broker
_currentBrokerIndex = 0;
- setBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
+ SetBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
// This is zero rather than -1 as we are already retrieving the details.
_currentServerRetry = 0;
@@ -167,7 +167,7 @@ namespace Qpid.Client.qms.failover
{
_currentBrokerIndex = 0;
- setBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
+ SetBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
_logger.Info("First Run using " + _connectionDetails.GetBrokerInfo(_currentBrokerIndex));
}
@@ -181,7 +181,7 @@ namespace Qpid.Client.qms.failover
{
_currentBrokerIndex++;
- setBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
+ SetBroker(_connectionDetails.GetBrokerInfo(_currentBrokerIndex ));
// This is zero rather than -1 as we are already retrieving the details.
_currentServerRetry = 0;
}
@@ -190,13 +190,13 @@ namespace Qpid.Client.qms.failover
return _connectionDetails.GetBrokerInfo(_currentBrokerIndex);
}
- public void setBroker(BrokerInfo broker)
+ public void SetBroker(IBrokerInfo broker)
{
_connectionDetails.AddBrokerInfo(broker);
int index = _connectionDetails.GetAllBrokerInfos().IndexOf(broker);
- String serverRetries = broker.getOption(BrokerInfoConstants.OPTIONS_RETRY);
+ String serverRetries = broker.GetOption(BrokerInfoConstants.OPTIONS_RETRY);
if (serverRetries != null)
{
@@ -214,14 +214,14 @@ namespace Qpid.Client.qms.failover
_currentBrokerIndex = index;
}
- public void setRetries(int maxRetries)
+ public void SetRetries(int maxRetries)
{
_cycleRetries = maxRetries;
}
- public String methodName()
+ public String MethodName
{
- return "Cycle Servers";
+ get { return "Cycle Servers"; }
}
public override string ToString()
@@ -230,7 +230,7 @@ namespace Qpid.Client.qms.failover
sb.Append(GetType().Name).Append("\n");
- sb.Append("Broker count: ").Append(_connectionDetails.GetBrokerCount());
+ sb.Append("Broker count: ").Append(_connectionDetails.BrokerCount);
sb.Append("\ncurrent broker index: ").Append(_currentBrokerIndex);
sb.Append("\nCycle Retries: ").Append(_cycleRetries);
@@ -239,7 +239,7 @@ namespace Qpid.Client.qms.failover
sb.Append("\nCurrent Retry:").Append(_currentServerRetry);
sb.Append("\n");
- for(int i=0; i < _connectionDetails.GetBrokerCount() ; i++)
+ for(int i=0; i < _connectionDetails.BrokerCount ; i++)
{
if (i == _currentBrokerIndex)
{
diff --git a/qpid/dotnet/Qpid.Client/qms/failover/FailoverSingleServer.cs b/qpid/dotnet/Qpid.Client/qms/failover/FailoverSingleServer.cs
index be29429035..18907df3c2 100644
--- a/qpid/dotnet/Qpid.Client/qms/failover/FailoverSingleServer.cs
+++ b/qpid/dotnet/Qpid.Client/qms/failover/FailoverSingleServer.cs
@@ -20,9 +20,9 @@
*/
using System;
-namespace Qpid.Client.qms.failover
+namespace Qpid.Client.Qms.Failover
{
- public class FailoverSingleServer : FailoverMethod
+ public class FailoverSingleServer : IFailoverMethod
{
/** The default number of times to rety a conection to this server */
public const int DEFAULT_SERVER_RETRIES = 1;
@@ -30,7 +30,7 @@ namespace Qpid.Client.qms.failover
/**
* The details of the Single Server
*/
- private BrokerInfo _brokerDetail;
+ private IBrokerInfo _brokerDetail;
/**
* The number of times to retry connecting to the sever
@@ -43,11 +43,11 @@ namespace Qpid.Client.qms.failover
private int _currentRetries;
- public FailoverSingleServer(ConnectionInfo connectionDetails)
+ public FailoverSingleServer(IConnectionInfo connectionDetails)
{
- if (connectionDetails.GetBrokerCount() > 0)
+ if (connectionDetails.BrokerCount > 0)
{
- setBroker(connectionDetails.GetBrokerInfo(0));
+ SetBroker(connectionDetails.GetBrokerInfo(0));
}
else
{
@@ -55,32 +55,32 @@ namespace Qpid.Client.qms.failover
}
}
- public FailoverSingleServer(BrokerInfo brokerDetail)
+ public FailoverSingleServer(IBrokerInfo brokerDetail)
{
- setBroker(brokerDetail);
+ SetBroker(brokerDetail);
}
- public void reset()
+ public void Reset()
{
_currentRetries = -1;
}
- public bool failoverAllowed()
+ public bool FailoverAllowed()
{
return _currentRetries < _retries;
}
- public void attainedConnection()
+ public void AttainedConnection()
{
- reset();
+ Reset();
}
- public BrokerInfo GetCurrentBrokerInfo()
+ public IBrokerInfo GetCurrentBrokerInfo()
{
return _brokerDetail;
}
- public BrokerInfo getNextBrokerDetails()
+ public IBrokerInfo GetNextBrokerDetails()
{
if (_currentRetries == _retries)
{
@@ -97,7 +97,7 @@ namespace Qpid.Client.qms.failover
}
}
- public void setBroker(BrokerInfo broker)
+ public void SetBroker(IBrokerInfo broker)
{
if (broker == null)
{
@@ -105,7 +105,7 @@ namespace Qpid.Client.qms.failover
}
_brokerDetail = broker;
- String retries = broker.getOption(BrokerInfoConstants.OPTIONS_RETRY);
+ String retries = broker.GetOption(BrokerInfoConstants.OPTIONS_RETRY);
if (retries != null)
{
try
@@ -122,17 +122,17 @@ namespace Qpid.Client.qms.failover
_retries = DEFAULT_SERVER_RETRIES;
}
- reset();
+ Reset();
}
- public void setRetries(int retries)
+ public void SetRetries(int retries)
{
_retries = retries;
}
- public String methodName()
+ public String MethodName
{
- return "Single Server";
+ get { return "Single Server"; }
}
public String toString()