Skip to content

Public api cleanup round 2 #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions projects/client/Apigen/src/apigen/Apigen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ public void EmitMethodArgumentReader()
EmitLine(" return result;");
EmitLine(" }");
EmitLine("");
EmitLine(" throw new Client.Impl.UnknownClassOrMethodException(classId, methodId);");
EmitLine(" throw new Client.Exceptions.UnknownClassOrMethodException(classId, methodId);");
EmitLine(" }");
EmitLine("");
EmitLine(" internal Client.Impl.MethodBase DecodeMethodFrom(ushort classId, ushort methodId)");
Expand Down Expand Up @@ -974,7 +974,7 @@ public void EmitContentHeaderReader()
EmitLine($" case {c.Index}: return new {MangleClass(c.Name)}Properties();");
}
}
EmitLine(" default: throw new Client.Impl.UnknownClassOrMethodException(classId, 0);");
EmitLine(" default: throw new Client.Exceptions.UnknownClassOrMethodException(classId, 0);");
EmitLine(" }");
EmitLine(" }");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ public sealed class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionF
/// <summary>
/// Default SASL auth mechanisms to use.
/// </summary>
public static readonly IList<AuthMechanismFactory> DefaultAuthMechanisms =
new List<AuthMechanismFactory>() { new PlainMechanismFactory() };
public static readonly IList<IAuthMechanismFactory> DefaultAuthMechanisms =
new List<IAuthMechanismFactory>() { new PlainMechanismFactory() };

/// <summary>
/// SASL auth mechanisms to use.
/// </summary>
public IList<AuthMechanismFactory> AuthMechanisms { get; set; } = DefaultAuthMechanisms;
public IList<IAuthMechanismFactory> AuthMechanisms { get; set; } = DefaultAuthMechanisms;

/// <summary>
/// Address family used by default.
Expand Down Expand Up @@ -331,10 +331,10 @@ public Uri Uri
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
/// or null if we have none in common.
/// </summary>
public AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames)
public IAuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames)
{
// Our list is in order of preference, the server one is not.
foreach (AuthMechanismFactory factory in AuthMechanisms)
foreach (IAuthMechanismFactory factory in AuthMechanisms)
{
string factoryName = factory.Name;
if (mechanismNames.Any<string>(x => string.Equals(x, factoryName, StringComparison.OrdinalIgnoreCase)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

using System;
using System.Net.Sockets;
using RabbitMQ.Client.Impl;

namespace RabbitMQ.Client
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

namespace RabbitMQ.Client
{
public class ExternalMechanism : AuthMechanism
public class ExternalMechanism : IAuthMechanism
{
/// <summary>
/// Handle one round of challenge-response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

namespace RabbitMQ.Client
{
public class ExternalMechanismFactory : AuthMechanismFactory
public class ExternalMechanismFactory : IAuthMechanismFactory
{
/// <summary>
/// The name of the authentication mechanism, as negotiated on the wire.
Expand All @@ -53,7 +53,7 @@ public string Name
/// <summary>
/// Return a new authentication mechanism implementation.
/// </summary>
public AuthMechanism GetInstance()
public IAuthMechanism GetInstance()
{
return new ExternalMechanism();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace RabbitMQ.Client
/// <summary>
/// A pluggable authentication mechanism.
/// </summary>
public interface AuthMechanism
public interface IAuthMechanism
{
/// <summary>
/// Handle one round of challenge-response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

namespace RabbitMQ.Client
{
public interface AuthMechanismFactory
public interface IAuthMechanismFactory
{
/// <summary>
/// The name of the authentication mechanism, as negotiated on the wire.
Expand All @@ -50,6 +50,6 @@ public interface AuthMechanismFactory
/// <summary>
/// Return a new authentication mechanism implementation.
/// </summary>
AuthMechanism GetInstance();
IAuthMechanism GetInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions;
using RabbitMQ.Client.Impl;

namespace RabbitMQ.Client
{
Expand All @@ -65,7 +66,7 @@ namespace RabbitMQ.Client
/// appropriate.
/// </para>
/// </remarks>
public interface IConnection : NetworkConnection, IDisposable
public interface IConnection : INetworkConnection, IDisposable
{
/// <summary>
/// The maximum channel number this connection supports (0 if unlimited).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public interface IConnectionFactory
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
/// or null if we have none in common.
/// </summary>
AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames);
IAuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames);

/// <summary>
/// Create a connection to the specified endpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace RabbitMQ.Client
/// <summary>
/// Common interface for network (TCP/IP) connection classes.
/// </summary>
public interface NetworkConnection
public interface INetworkConnection
{
/// <summary>
/// Local port.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

namespace RabbitMQ.Client
{
public class PlainMechanism : AuthMechanism
public class PlainMechanism : IAuthMechanism
{
public byte[] handleChallenge(byte[] challenge, IConnectionFactory factory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

namespace RabbitMQ.Client
{
public class PlainMechanismFactory : AuthMechanismFactory
public class PlainMechanismFactory : IAuthMechanismFactory
{
/// <summary>
/// The name of the authentication mechanism, as negotiated on the wire.
Expand All @@ -53,7 +53,7 @@ public string Name
/// <summary>
/// Return a new authentication mechanism implementation.
/// </summary>
public AuthMechanism GetInstance()
public IAuthMechanism GetInstance()
{
return new PlainMechanism();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

using RabbitMQ.Client.Framing;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
/// <summary> Thrown when the server sends a frame along a channel
/// that we do not currently have a Session entry in our
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
///<summary>Subclass of ProtocolException representing problems
///requiring a connection.close.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

using RabbitMQ.Client.Framing;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
///<summary>Thrown when frame parsing code detects an error in the
///wire-protocol encoding of a frame.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

using RabbitMQ.Client.Exceptions;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
/// <summary> Instances of subclasses of subclasses
/// HardProtocolException and SoftProtocolException are thrown in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@

using System;

using RabbitMQ.Client.Exceptions;

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Exceptions
{
#if !NETSTANDARD1_5
[Serializable]
Expand All @@ -55,9 +53,8 @@ public ProtocolViolationException(string message) : base(message)
public ProtocolViolationException(string message, Exception inner) : base(message, inner)
{
}
public ProtocolViolationException()
public ProtocolViolationException()
{
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
///<summary>Subclass of ProtocolException representing problems
///requiring a channel.close.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@

using RabbitMQ.Client.Framing;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
/// <summary> Thrown when our peer sends a frame that contains
/// illegal values for one or more fields. </summary>
public class SyntaxError : HardProtocolException
public class SyntaxErrorException : HardProtocolException
{
public SyntaxError(string message) : base(message)
public SyntaxErrorException(string message) : base(message)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@

using System;

using RabbitMQ.Client.Exceptions;

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Exceptions
{
public class TopologyRecoveryException : RabbitMQClientException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
//---------------------------------------------------------------------------

using RabbitMQ.Client.Framing;
using RabbitMQ.Client.Impl;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
/// <summary>
/// Thrown when the connection receives a frame that it wasn't expecting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

using RabbitMQ.Client.Framing;

namespace RabbitMQ.Client.Impl
namespace RabbitMQ.Client.Exceptions
{
/// <summary>
/// Thrown when the protocol handlers detect an unknown class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Framing.Impl
{
/// <summary>Represents a version of the AMQP specification.</summary>
/// <remarks>
Expand All @@ -54,7 +54,7 @@ namespace RabbitMQ.Client
/// special-cases 8-0, rewriting it at construction time to be 0-8 instead.
/// </para>
/// </remarks>
public class AmqpVersion
class AmqpVersion
{
/// <summary>
/// Construct an <see cref="AmqpVersion"/> from major and minor version numbers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
using System.Threading;
using System.Threading.Tasks;

using RabbitMQ.Client.Impl;

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Impl
{
internal sealed class AsyncConsumerWorkService : ConsumerWorkService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
using System.Threading.Tasks;

using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions;
using RabbitMQ.Client.Impl;
using RabbitMQ.Client.Logging;

namespace RabbitMQ.Client.Framing.Impl
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Impl
{
/// <summary>Wrapper for a byte[]. May appear as values read from
///and written to AMQP field tables.</summary>
Expand Down Expand Up @@ -67,7 +67,7 @@ namespace RabbitMQ.Client
/// of this class must be used.
/// </para>
/// </remarks>
public class BinaryTableValue
class BinaryTableValue
{
/// <summary>
/// Creates a new instance of the <see cref="BinaryTableValue"/> with null for its Bytes property.
Expand Down
2 changes: 1 addition & 1 deletion projects/client/RabbitMQ.Client/src/client/impl/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
using System;
using System.Buffers;
using System.Collections.Generic;

using RabbitMQ.Client.Exceptions;
using RabbitMQ.Client.Framing.Impl;

namespace RabbitMQ.Client.Impl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//---------------------------------------------------------------------------

using System.Buffers;

using RabbitMQ.Client.Exceptions;
using RabbitMQ.Client.Framing.Impl;
using RabbitMQ.Util;

Expand Down
5 changes: 3 additions & 2 deletions projects/client/RabbitMQ.Client/src/client/impl/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions;
using RabbitMQ.Client.Impl;
using RabbitMQ.Client.Logging;
using RabbitMQ.Util;

namespace RabbitMQ.Client.Framing.Impl
Expand Down Expand Up @@ -1092,13 +1093,13 @@ void StartAndTune()
{
string mechanismsString = Encoding.UTF8.GetString(connectionStart.m_mechanisms, 0, connectionStart.m_mechanisms.Length);
string[] mechanisms = mechanismsString.Split(' ');
AuthMechanismFactory mechanismFactory = _factory.AuthMechanismFactory(mechanisms);
IAuthMechanismFactory mechanismFactory = _factory.AuthMechanismFactory(mechanisms);
if (mechanismFactory == null)
{
throw new IOException("No compatible authentication mechanism found - " +
"server offered [" + mechanismsString + "]");
}
AuthMechanism mechanism = mechanismFactory.GetInstance();
IAuthMechanism mechanism = mechanismFactory.GetInstance();
byte[] challenge = null;
do
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace RabbitMQ.Client
namespace RabbitMQ.Client.Impl
{
public class ConsumerWorkService
{
Expand Down
Loading