Skip to content

Commit 75a72ce

Browse files
authored
Merge pull request #763 from bording/public-api-cleanup-round-2
Public api cleanup round 2
2 parents c0178a2 + a801c45 commit 75a72ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+149
-170
lines changed

projects/client/Apigen/src/apigen/Apigen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ public void EmitMethodArgumentReader()
941941
EmitLine(" return result;");
942942
EmitLine(" }");
943943
EmitLine("");
944-
EmitLine(" throw new Client.Impl.UnknownClassOrMethodException(classId, methodId);");
944+
EmitLine(" throw new Client.Exceptions.UnknownClassOrMethodException(classId, methodId);");
945945
EmitLine(" }");
946946
EmitLine("");
947947
EmitLine(" internal Client.Impl.MethodBase DecodeMethodFrom(ushort classId, ushort methodId)");
@@ -974,7 +974,7 @@ public void EmitContentHeaderReader()
974974
EmitLine($" case {c.Index}: return new {MangleClass(c.Name)}Properties();");
975975
}
976976
}
977-
EmitLine(" default: throw new Client.Impl.UnknownClassOrMethodException(classId, 0);");
977+
EmitLine(" default: throw new Client.Exceptions.UnknownClassOrMethodException(classId, 0);");
978978
EmitLine(" }");
979979
EmitLine(" }");
980980
}

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ public sealed class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionF
147147
/// <summary>
148148
/// Default SASL auth mechanisms to use.
149149
/// </summary>
150-
public static readonly IList<AuthMechanismFactory> DefaultAuthMechanisms =
151-
new List<AuthMechanismFactory>() { new PlainMechanismFactory() };
150+
public static readonly IList<IAuthMechanismFactory> DefaultAuthMechanisms =
151+
new List<IAuthMechanismFactory>() { new PlainMechanismFactory() };
152152

153153
/// <summary>
154154
/// SASL auth mechanisms to use.
155155
/// </summary>
156-
public IList<AuthMechanismFactory> AuthMechanisms { get; set; } = DefaultAuthMechanisms;
156+
public IList<IAuthMechanismFactory> AuthMechanisms { get; set; } = DefaultAuthMechanisms;
157157

158158
/// <summary>
159159
/// Address family used by default.
@@ -331,10 +331,10 @@ public Uri Uri
331331
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
332332
/// or null if we have none in common.
333333
/// </summary>
334-
public AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames)
334+
public IAuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames)
335335
{
336336
// Our list is in order of preference, the server one is not.
337-
foreach (AuthMechanismFactory factory in AuthMechanisms)
337+
foreach (IAuthMechanismFactory factory in AuthMechanisms)
338338
{
339339
string factoryName = factory.Name;
340340
if (mechanismNames.Any<string>(x => string.Equals(x, factoryName, StringComparison.OrdinalIgnoreCase)))

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactoryBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
using System;
4242
using System.Net.Sockets;
43+
using RabbitMQ.Client.Impl;
4344

4445
namespace RabbitMQ.Client
4546
{

projects/client/RabbitMQ.Client/src/client/api/ExternalMechanism.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
namespace RabbitMQ.Client
4242
{
43-
public class ExternalMechanism : AuthMechanism
43+
public class ExternalMechanism : IAuthMechanism
4444
{
4545
/// <summary>
4646
/// Handle one round of challenge-response.

projects/client/RabbitMQ.Client/src/client/api/ExternalMechanismFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
namespace RabbitMQ.Client
4242
{
43-
public class ExternalMechanismFactory : AuthMechanismFactory
43+
public class ExternalMechanismFactory : IAuthMechanismFactory
4444
{
4545
/// <summary>
4646
/// The name of the authentication mechanism, as negotiated on the wire.
@@ -53,7 +53,7 @@ public string Name
5353
/// <summary>
5454
/// Return a new authentication mechanism implementation.
5555
/// </summary>
56-
public AuthMechanism GetInstance()
56+
public IAuthMechanism GetInstance()
5757
{
5858
return new ExternalMechanism();
5959
}

projects/client/RabbitMQ.Client/src/client/api/AuthMechanism.cs renamed to projects/client/RabbitMQ.Client/src/client/api/IAuthMechanism.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace RabbitMQ.Client
4343
/// <summary>
4444
/// A pluggable authentication mechanism.
4545
/// </summary>
46-
public interface AuthMechanism
46+
public interface IAuthMechanism
4747
{
4848
/// <summary>
4949
/// Handle one round of challenge-response.

projects/client/RabbitMQ.Client/src/client/api/AuthMechanismFactory.cs renamed to projects/client/RabbitMQ.Client/src/client/api/IAuthMechanismFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
namespace RabbitMQ.Client
4242
{
43-
public interface AuthMechanismFactory
43+
public interface IAuthMechanismFactory
4444
{
4545
/// <summary>
4646
/// The name of the authentication mechanism, as negotiated on the wire.
@@ -50,6 +50,6 @@ public interface AuthMechanismFactory
5050
/// <summary>
5151
/// Return a new authentication mechanism implementation.
5252
/// </summary>
53-
AuthMechanism GetInstance();
53+
IAuthMechanism GetInstance();
5454
}
5555
}

projects/client/RabbitMQ.Client/src/client/api/IConnection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
using RabbitMQ.Client.Events;
4747
using RabbitMQ.Client.Exceptions;
48+
using RabbitMQ.Client.Impl;
4849

4950
namespace RabbitMQ.Client
5051
{
@@ -65,7 +66,7 @@ namespace RabbitMQ.Client
6566
/// appropriate.
6667
/// </para>
6768
/// </remarks>
68-
public interface IConnection : NetworkConnection, IDisposable
69+
public interface IConnection : INetworkConnection, IDisposable
6970
{
7071
/// <summary>
7172
/// The maximum channel number this connection supports (0 if unlimited).

projects/client/RabbitMQ.Client/src/client/api/IConnectionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public interface IConnectionFactory
101101
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
102102
/// or null if we have none in common.
103103
/// </summary>
104-
AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames);
104+
IAuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames);
105105

106106
/// <summary>
107107
/// Create a connection to the specified endpoint.

projects/client/RabbitMQ.Client/src/client/api/NetworkConnection.cs renamed to projects/client/RabbitMQ.Client/src/client/api/INetworkConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace RabbitMQ.Client
4343
/// <summary>
4444
/// Common interface for network (TCP/IP) connection classes.
4545
/// </summary>
46-
public interface NetworkConnection
46+
public interface INetworkConnection
4747
{
4848
/// <summary>
4949
/// Local port.

projects/client/RabbitMQ.Client/src/client/api/PlainMechanism.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
namespace RabbitMQ.Client
4444
{
45-
public class PlainMechanism : AuthMechanism
45+
public class PlainMechanism : IAuthMechanism
4646
{
4747
public byte[] handleChallenge(byte[] challenge, IConnectionFactory factory)
4848
{

projects/client/RabbitMQ.Client/src/client/api/PlainMechanismFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
namespace RabbitMQ.Client
4242
{
43-
public class PlainMechanismFactory : AuthMechanismFactory
43+
public class PlainMechanismFactory : IAuthMechanismFactory
4444
{
4545
/// <summary>
4646
/// The name of the authentication mechanism, as negotiated on the wire.
@@ -53,7 +53,7 @@ public string Name
5353
/// <summary>
5454
/// Return a new authentication mechanism implementation.
5555
/// </summary>
56-
public AuthMechanism GetInstance()
56+
public IAuthMechanism GetInstance()
5757
{
5858
return new PlainMechanism();
5959
}

projects/client/RabbitMQ.Client/src/client/impl/ChannelErrorException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/ChannelErrorException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
using RabbitMQ.Client.Framing;
4242

43-
namespace RabbitMQ.Client.Impl
43+
namespace RabbitMQ.Client.Exceptions
4444
{
4545
/// <summary> Thrown when the server sends a frame along a channel
4646
/// that we do not currently have a Session entry in our

projects/client/RabbitMQ.Client/src/client/impl/HardProtocolException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/HardProtocolException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
namespace RabbitMQ.Client.Impl
41+
namespace RabbitMQ.Client.Exceptions
4242
{
4343
///<summary>Subclass of ProtocolException representing problems
4444
///requiring a connection.close.</summary>

projects/client/RabbitMQ.Client/src/client/impl/MalformedFrameException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/MalformedFrameException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
using RabbitMQ.Client.Framing;
4242

43-
namespace RabbitMQ.Client.Impl
43+
namespace RabbitMQ.Client.Exceptions
4444
{
4545
///<summary>Thrown when frame parsing code detects an error in the
4646
///wire-protocol encoding of a frame.</summary>

projects/client/RabbitMQ.Client/src/client/impl/ProtocolException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/ProtocolException.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
using RabbitMQ.Client.Exceptions;
42-
43-
namespace RabbitMQ.Client.Impl
41+
namespace RabbitMQ.Client.Exceptions
4442
{
4543
/// <summary> Instances of subclasses of subclasses
4644
/// HardProtocolException and SoftProtocolException are thrown in

projects/client/RabbitMQ.Client/src/client/exceptions/ProtocolViolationException.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040

4141
using System;
4242

43-
using RabbitMQ.Client.Exceptions;
44-
45-
namespace RabbitMQ.Client
43+
namespace RabbitMQ.Client.Exceptions
4644
{
4745
#if !NETSTANDARD1_5
4846
[Serializable]
@@ -55,9 +53,8 @@ public ProtocolViolationException(string message) : base(message)
5553
public ProtocolViolationException(string message, Exception inner) : base(message, inner)
5654
{
5755
}
58-
public ProtocolViolationException()
56+
public ProtocolViolationException()
5957
{
6058
}
61-
62-
}
59+
}
6360
}

projects/client/RabbitMQ.Client/src/client/impl/SoftProtocolException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/SoftProtocolException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
namespace RabbitMQ.Client.Impl
41+
namespace RabbitMQ.Client.Exceptions
4242
{
4343
///<summary>Subclass of ProtocolException representing problems
4444
///requiring a channel.close.</summary>

projects/client/RabbitMQ.Client/src/client/impl/SyntaxError.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/SyntaxErrorException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040

4141
using RabbitMQ.Client.Framing;
4242

43-
namespace RabbitMQ.Client.Impl
43+
namespace RabbitMQ.Client.Exceptions
4444
{
4545
/// <summary> Thrown when our peer sends a frame that contains
4646
/// illegal values for one or more fields. </summary>
47-
public class SyntaxError : HardProtocolException
47+
public class SyntaxErrorException : HardProtocolException
4848
{
49-
public SyntaxError(string message) : base(message)
49+
public SyntaxErrorException(string message) : base(message)
5050
{
5151
}
5252

projects/client/RabbitMQ.Client/src/client/api/TopologyRecoveryException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/TopologyRecoveryException.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040

4141
using System;
4242

43-
using RabbitMQ.Client.Exceptions;
44-
45-
namespace RabbitMQ.Client
43+
namespace RabbitMQ.Client.Exceptions
4644
{
4745
public class TopologyRecoveryException : RabbitMQClientException
4846
{

projects/client/RabbitMQ.Client/src/client/impl/UnexpectedFrameException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/UnexpectedFrameException.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
//---------------------------------------------------------------------------
4040

4141
using RabbitMQ.Client.Framing;
42+
using RabbitMQ.Client.Impl;
4243

43-
namespace RabbitMQ.Client.Impl
44+
namespace RabbitMQ.Client.Exceptions
4445
{
4546
/// <summary>
4647
/// Thrown when the connection receives a frame that it wasn't expecting.

projects/client/RabbitMQ.Client/src/client/impl/UnknownClassOrMethodException.cs renamed to projects/client/RabbitMQ.Client/src/client/exceptions/UnknownClassOrMethodException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
using RabbitMQ.Client.Framing;
4242

43-
namespace RabbitMQ.Client.Impl
43+
namespace RabbitMQ.Client.Exceptions
4444
{
4545
/// <summary>
4646
/// Thrown when the protocol handlers detect an unknown class

projects/client/RabbitMQ.Client/src/client/api/AmqpVersion.cs renamed to projects/client/RabbitMQ.Client/src/client/impl/AmqpVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
namespace RabbitMQ.Client
41+
namespace RabbitMQ.Client.Framing.Impl
4242
{
4343
/// <summary>Represents a version of the AMQP specification.</summary>
4444
/// <remarks>
@@ -54,7 +54,7 @@ namespace RabbitMQ.Client
5454
/// special-cases 8-0, rewriting it at construction time to be 0-8 instead.
5555
/// </para>
5656
/// </remarks>
57-
public class AmqpVersion
57+
class AmqpVersion
5858
{
5959
/// <summary>
6060
/// Construct an <see cref="AmqpVersion"/> from major and minor version numbers.

projects/client/RabbitMQ.Client/src/client/impl/AsyncConsumerWorkService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44

5-
using RabbitMQ.Client.Impl;
6-
7-
namespace RabbitMQ.Client
5+
namespace RabbitMQ.Client.Impl
86
{
97
internal sealed class AsyncConsumerWorkService : ConsumerWorkService
108
{

projects/client/RabbitMQ.Client/src/client/impl/AutorecoveringConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
using System.Threading.Tasks;
4747

4848
using RabbitMQ.Client.Events;
49+
using RabbitMQ.Client.Exceptions;
4950
using RabbitMQ.Client.Impl;
51+
using RabbitMQ.Client.Logging;
5052

5153
namespace RabbitMQ.Client.Framing.Impl
5254
{

projects/client/RabbitMQ.Client/src/client/api/BinaryTableValue.cs renamed to projects/client/RabbitMQ.Client/src/client/impl/BinaryTableValue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
namespace RabbitMQ.Client
41+
namespace RabbitMQ.Client.Impl
4242
{
4343
/// <summary>Wrapper for a byte[]. May appear as values read from
4444
///and written to AMQP field tables.</summary>
@@ -67,7 +67,7 @@ namespace RabbitMQ.Client
6767
/// of this class must be used.
6868
/// </para>
6969
/// </remarks>
70-
public class BinaryTableValue
70+
class BinaryTableValue
7171
{
7272
/// <summary>
7373
/// Creates a new instance of the <see cref="BinaryTableValue"/> with null for its Bytes property.

projects/client/RabbitMQ.Client/src/client/impl/Command.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
using System;
4242
using System.Buffers;
4343
using System.Collections.Generic;
44-
44+
using RabbitMQ.Client.Exceptions;
4545
using RabbitMQ.Client.Framing.Impl;
4646

4747
namespace RabbitMQ.Client.Impl

projects/client/RabbitMQ.Client/src/client/impl/CommandAssembler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
//---------------------------------------------------------------------------
4040

4141
using System.Buffers;
42-
42+
using RabbitMQ.Client.Exceptions;
4343
using RabbitMQ.Client.Framing.Impl;
4444
using RabbitMQ.Util;
4545

projects/client/RabbitMQ.Client/src/client/impl/Connection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
using RabbitMQ.Client.Events;
5252
using RabbitMQ.Client.Exceptions;
5353
using RabbitMQ.Client.Impl;
54+
using RabbitMQ.Client.Logging;
5455
using RabbitMQ.Util;
5556

5657
namespace RabbitMQ.Client.Framing.Impl
@@ -1092,13 +1093,13 @@ void StartAndTune()
10921093
{
10931094
string mechanismsString = Encoding.UTF8.GetString(connectionStart.m_mechanisms, 0, connectionStart.m_mechanisms.Length);
10941095
string[] mechanisms = mechanismsString.Split(' ');
1095-
AuthMechanismFactory mechanismFactory = _factory.AuthMechanismFactory(mechanisms);
1096+
IAuthMechanismFactory mechanismFactory = _factory.AuthMechanismFactory(mechanisms);
10961097
if (mechanismFactory == null)
10971098
{
10981099
throw new IOException("No compatible authentication mechanism found - " +
10991100
"server offered [" + mechanismsString + "]");
11001101
}
1101-
AuthMechanism mechanism = mechanismFactory.GetInstance();
1102+
IAuthMechanism mechanism = mechanismFactory.GetInstance();
11021103
byte[] challenge = null;
11031104
do
11041105
{

projects/client/RabbitMQ.Client/src/client/impl/ConsumerWorkService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Threading;
44
using System.Threading.Tasks;
55

6-
namespace RabbitMQ.Client
6+
namespace RabbitMQ.Client.Impl
77
{
88
public class ConsumerWorkService
99
{

0 commit comments

Comments
 (0)