U4-7014 - merge IServerRegistrar2 into IServerRegistrar

This commit is contained in:
Stephan
2016-06-20 17:30:49 +02:00
parent a8975e6c41
commit 78ab9c087d
9 changed files with 38 additions and 48 deletions

View File

@@ -114,8 +114,8 @@ namespace Umbraco.Core.Sync
// - contain a scheme
// - end or not with a slash, it will be taken care of
// eg "http://www.mysite.com/umbraco"
var registrar = ServerRegistrarResolver.Current.Registrar as IServerRegistrar2;
url = registrar == null ? null : registrar.GetCurrentServerUmbracoApplicationUrl();
var registrar = ServerRegistrarResolver.Current.Registrar;
url = registrar.GetCurrentServerUmbracoApplicationUrl();
if (url.IsNullOrWhiteSpace() == false)
{
appContext._umbracoApplicationUrl = url.TrimEnd('/');

View File

@@ -11,7 +11,7 @@ namespace Umbraco.Core.Sync
/// Provides server registrations to the distributed cache by reading the legacy Xml configuration
/// in umbracoSettings to get the list of (manually) configured server nodes.
/// </summary>
internal class ConfigServerRegistrar : IServerRegistrar2
internal class ConfigServerRegistrar : IServerRegistrar
{
private readonly List<IServerAddress> _addresses;
private readonly ServerRole _serverRole;

View File

@@ -7,7 +7,7 @@ namespace Umbraco.Core.Sync
/// <summary>
/// A registrar that stores registered server nodes in the database.
/// </summary>
public sealed class DatabaseServerRegistrar : IServerRegistrar2
public sealed class DatabaseServerRegistrar : IServerRegistrar
{
private readonly Lazy<IServerRegistrationService> _registrationService;

View File

@@ -5,12 +5,25 @@ namespace Umbraco.Core.Sync
/// <summary>
/// Provides server registrations to the distributed cache.
/// </summary>
/// <remarks>You should implement IServerRegistrar2 instead.</remarks>
public interface IServerRegistrar
{
/// <summary>
/// Gets the server registrations.
/// </summary>
IEnumerable<IServerAddress> Registrations { get; }
/// <summary>
/// Gets the role of the current server in the application environment.
/// </summary>
ServerRole GetCurrentServerRole();
/// <summary>
/// Gets the current umbraco application url.
/// </summary>
/// <remarks>
/// <para>If the registrar does not provide the umbraco application url, should return null.</para>
/// <para>Must return null, or a url that ends with SystemDirectories.Umbraco, and contains a scheme, eg "http://www.mysite.com/umbraco".</para>
/// </remarks>
string GetCurrentServerUmbracoApplicationUrl();
}
}

View File

@@ -1,26 +0,0 @@
namespace Umbraco.Core.Sync
{
/// <summary>
/// Provides server registrations to the distributed cache.
/// </summary>
/// <remarks>This interface exists because IServerRegistrar could not be modified
/// for backward compatibility reasons - but IServerRegistrar is broken because it
/// does not support server role management. So ppl should really implement
/// IServerRegistrar2, and the two interfaces will get merged in v8.</remarks>
public interface IServerRegistrar2 : IServerRegistrar
{
/// <summary>
/// Gets the role of the current server in the application environment.
/// </summary>
ServerRole GetCurrentServerRole();
/// <summary>
/// Gets the current umbraco application url.
/// </summary>
/// <remarks>
/// <para>If the registrar does not provide the umbraco application url, should return null.</para>
/// <para>Must return null, or a url that ends with SystemDirectories.Umbraco, and contains a scheme, eg "http://www.mysite.com/umbraco".</para>
/// </remarks>
string GetCurrentServerUmbracoApplicationUrl();
}
}