diff --git a/src/UniversalDashboard/Controllers/ComponentController.cs b/src/UniversalDashboard/Controllers/ComponentController.cs index 834ce1c3..d74c547f 100644 --- a/src/UniversalDashboard/Controllers/ComponentController.cs +++ b/src/UniversalDashboard/Controllers/ComponentController.cs @@ -44,7 +44,7 @@ public ComponentController(IExecutionService executionService, IDashboardService _connectionManager = connectionManager; } - private async Task RunScript(Endpoint endpoint, Dictionary parameters = null, bool noSerialization = false) + private async Task RunScript(AbstractEndpoint endpoint, Dictionary parameters = null, bool noSerialization = false) { try { var variables = new Dictionary { diff --git a/src/UniversalDashboard/Execution/EndpointService.cs b/src/UniversalDashboard/Execution/EndpointService.cs index 0ad1a231..c31b1f54 100644 --- a/src/UniversalDashboard/Execution/EndpointService.cs +++ b/src/UniversalDashboard/Execution/EndpointService.cs @@ -13,13 +13,13 @@ namespace UniversalDashboard.Execution { public class EndpointService : IEndpointService { - private readonly List _restEndpoints; - private readonly List _scheduledEndpoints; + private readonly List _restEndpoints; + private readonly List _scheduledEndpoints; private static readonly Logger logger = LogManager.GetLogger("EndpointService"); private static IEndpointService _instance; - public ConcurrentDictionary Endpoints { get; private set; } + public ConcurrentDictionary Endpoints { get; private set; } public ISessionManager SessionManager { get; private set; } public static IEndpointService Instance @@ -37,14 +37,14 @@ public static IEndpointService Instance private EndpointService() { - Endpoints = new ConcurrentDictionary(); + Endpoints = new ConcurrentDictionary(); SessionManager = new SessionManager(); - _restEndpoints = new List(); - _scheduledEndpoints = new List(); + _restEndpoints = new List(); + _scheduledEndpoints = new List(); } - public void Register(Endpoint callback) + public void Register(AbstractEndpoint callback) { if (!callback.HasCallback) { @@ -107,7 +107,7 @@ public void Unregister(string name, string sessionId) { if (Endpoints.ContainsKey(name)) { - Endpoints.TryRemove(name, out Endpoint endpoint); + Endpoints.TryRemove(name, out AbstractEndpoint endpoint); logger.Debug("Endpoint found. Removing endpoint."); } } @@ -119,13 +119,13 @@ public void Unregister(string name, string sessionId) if (session.Endpoints.ContainsKey(name)) { logger.Debug("Session endpoint found. Removing endpoint."); - session.Endpoints.TryRemove(name, out Endpoint value); + session.Endpoints.TryRemove(name, out AbstractEndpoint value); } } } } - public Endpoint Get(string name, string sessionId) + public AbstractEndpoint Get(string name, string sessionId) { logger.Debug($"Get() {name} {sessionId}"); if (sessionId != null) @@ -150,7 +150,7 @@ public Endpoint Get(string name, string sessionId) return null; } - public Endpoint GetByUrl(string url, string method, Dictionary matchedVariables) + public AbstractEndpoint GetByUrl(string url, string method, Dictionary matchedVariables) { foreach(var endpoint in _restEndpoints.Where(m => m.Method.Equals(method, StringComparison.OrdinalIgnoreCase))) { @@ -200,12 +200,12 @@ public Endpoint GetByUrl(string url, string method, Dictionary m return null; } - public IEnumerable GetScheduledEndpoints() + public IEnumerable GetScheduledEndpoints() { return _scheduledEndpoints; } - private bool IsMatch(Endpoint callback, string url, Dictionary matchedVariables) + private bool IsMatch(AbstractEndpoint callback, string url, Dictionary matchedVariables) { if (callback.Parts == null) return false; diff --git a/src/UniversalDashboard/Interfaces/IEndpointService.cs b/src/UniversalDashboard/Interfaces/IEndpointService.cs index 833526a2..e1ba4b5a 100644 --- a/src/UniversalDashboard/Interfaces/IEndpointService.cs +++ b/src/UniversalDashboard/Interfaces/IEndpointService.cs @@ -7,12 +7,12 @@ namespace UniversalDashboard.Interfaces { public interface IEndpointService { - Endpoint Get(string name, string sessionId); + AbstractEndpoint Get(string name, string sessionId); void Unregister(string name, string sessionId); - Endpoint GetByUrl(string url, string method, Dictionary matchedVariables); - IEnumerable GetScheduledEndpoints(); - void Register(Endpoint callback); - ConcurrentDictionary Endpoints { get; } + AbstractEndpoint GetByUrl(string url, string method, Dictionary matchedVariables); + IEnumerable GetScheduledEndpoints(); + void Register(AbstractEndpoint callback); + ConcurrentDictionary Endpoints { get; } ISessionManager SessionManager { get; } } } diff --git a/src/UniversalDashboard/Models/SessionState.cs b/src/UniversalDashboard/Models/SessionState.cs index 0dabeb6d..6633c5cf 100644 --- a/src/UniversalDashboard/Models/SessionState.cs +++ b/src/UniversalDashboard/Models/SessionState.cs @@ -9,7 +9,7 @@ public class SessionState public SessionState(string id) { Id = id; - Endpoints = new ConcurrentDictionary(); + Endpoints = new ConcurrentDictionary(); SessionVariables = new ConcurrentDictionary(); Connections = 1; LastTouched = DateTime.UtcNow; @@ -17,7 +17,7 @@ public SessionState(string id) public string Id { get; set; } public int Connections { get; set; } - public ConcurrentDictionary Endpoints { get; set; } + public ConcurrentDictionary Endpoints { get; set; } public ConcurrentDictionary SessionVariables { get; set; } public DateTime LastTouched { get; set; }