Skip to content

Commit

Permalink
Use hosting independent APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Sep 27, 2021
1 parent 6bb8932 commit f7d7800
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2020, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0

using Moryx.Communication.Endpoints;
using Moryx.Tools.Wcf;

namespace Moryx.Runtime.Maintenance
Expand All @@ -12,7 +13,7 @@ namespace Moryx.Runtime.Maintenance
/// <typeparam name="TWcf">Type of Wcf service.</typeparam>
public abstract class MaintenancePluginBase<TConf, TWcf> : IMaintenancePlugin where TConf : MaintenancePluginConfig
{
private IConfiguredServiceHost _host;
private IEndpointHost _host;

/// <summary>
/// Configuration of type TConf.
Expand All @@ -22,7 +23,7 @@ public abstract class MaintenancePluginBase<TConf, TWcf> : IMaintenancePlugin wh
/// <summary>
/// Factory to create WCF services
/// </summary>
public IConfiguredHostFactory HostFactory { get; set; }
public IEndpointHostFactory HostFactory { get; set; }

/// <inheritdoc />
public virtual void Initialize(MaintenancePluginConfig config)
Expand All @@ -33,7 +34,7 @@ public virtual void Initialize(MaintenancePluginConfig config)
/// <inheritdoc />
public virtual void Start()
{
_host = HostFactory.CreateHost<TWcf>(Config.ProvidedEndpoint);
_host = HostFactory.CreateHost(typeof(TWcf), Config.ProvidedEndpoint);
_host.Start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
using System;
using System.ComponentModel;
using System.Linq;
using Moryx.Communication.Endpoints;
using Moryx.Logging;
using Moryx.Model;
using Moryx.Runtime.Configuration;
using Moryx.Runtime.Container;
using Moryx.Runtime.Maintenance.Plugins;
using Moryx.Runtime.Modules;
using Moryx.Runtime.Wcf;
using Moryx.Tools.Wcf;

namespace Moryx.Runtime.Maintenance
{
Expand Down Expand Up @@ -44,9 +42,9 @@ public class ModuleController : ServerModuleBase<ModuleConfig>, IPlatformModule
public IRuntimeConfigManager RuntimeConfigManager { get; set; }

/// <summary>
/// Factory to create wcf hosts
/// Endpoint hosting
/// </summary>
public IWcfHostFactory WcfHostFactory { get; set; }
public IEndpointHosting Hosting { get; set; }

/// <summary>
/// Set the module manager. Not injected by castle.
Expand All @@ -69,9 +67,10 @@ public void SetModuleManager(IModuleManager moduleManager)
/// </summary>
protected override void OnInitialize()
{
Container.RegisterWcf(WcfHostFactory)
Container
.ActivateHosting(Hosting)
.SetInstance(_moduleManager).SetInstance(RuntimeConfigManager)
.SetInstance((IServerLoggerManagement)LoggerManagement);
.SetInstance(LoggerManagement);

Container.SetInstance(DbContextManager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Web;
using Moryx.Tools.Wcf;
using Moryx.Communication.Endpoints;

namespace Moryx.Runtime.Maintenance.Plugins.Common
{
/// <summary>
/// Service contract for the common maintenance.
/// </summary>
[ServiceContract]
[ServiceVersion("3.0.0.0")]
[Endpoint(Name = nameof(ICommonMaintenance), Version = "3.0.0.0")]
internal interface ICommonMaintenance
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Web;
using Moryx.Communication.Endpoints;
using Moryx.Model.Configuration;
using Moryx.Tools.Wcf;
using Moryx.Web;

namespace Moryx.Runtime.Maintenance.Plugins.Databases
Expand All @@ -14,7 +14,7 @@ namespace Moryx.Runtime.Maintenance.Plugins.Databases
/// Service contracts for database operations.
/// </summary>
[ServiceContract]
[ServiceVersion("3.0.0.0")]
[Endpoint(Name = nameof(IDatabaseMaintenance), Version = "3.0.0.0")]
internal interface IDatabaseMaintenance
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Web;
using Moryx.Tools.Wcf;
using Moryx.Communication.Endpoints;
using Moryx.Web;

namespace Moryx.Runtime.Maintenance.Plugins.Logging
Expand All @@ -13,7 +13,7 @@ namespace Moryx.Runtime.Maintenance.Plugins.Logging
/// Service contract for logging features of the maintenance.
/// </summary>
[ServiceContract]
[ServiceVersion("3.0.0")]
[Endpoint(Name = nameof(ILogMaintenance), Version = "3.0.0.0")]
internal interface ILogMaintenance
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Web;
using Moryx.Communication.Endpoints;
using Moryx.Runtime.Modules;
using Moryx.Serialization;
using Moryx.Tools.Wcf;

namespace Moryx.Runtime.Maintenance.Plugins.Modules
{
/// <summary>
/// Base service contract for the maintenance module.
/// </summary>
[ServiceContract]
[ServiceVersion("3.0.0")]
[Endpoint(Name = nameof(IModuleMaintenance), Version = "3.0.0.0")]
internal interface IModuleMaintenance
{
/// <summary>
Expand Down

0 comments on commit f7d7800

Please sign in to comment.