Skip to content

Commit

Permalink
Nancy discarded, back to Maintenance WCF
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeuchler committed Aug 18, 2020
1 parent 3e7c3f5 commit a929ce0
Show file tree
Hide file tree
Showing 96 changed files with 1,255 additions and 1,692 deletions.
46 changes: 24 additions & 22 deletions MoryxPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Runtime", "src\Moryx.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Runtime.Kernel", "src\Moryx.Runtime.Kernel\Moryx.Runtime.Kernel.csproj", "{8FF77F62-43C3-40FE-9DFE-01A53FE8A68E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Runtime.Maintenance", "src\Moryx.Runtime.Maintenance\Moryx.Runtime.Maintenance.csproj", "{EB039D46-906F-44BF-AC37-B3B3634A4442}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Runtime.Kernel.Tests", "src\Tests\Moryx.Runtime.Kernel.Tests\Moryx.Runtime.Kernel.Tests.csproj", "{0F2C9C4B-E9B7-43DD-9B25-72402E583D90}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Runtime.SystemTests", "src\Tests\Moryx.Runtime.SystemTests\Moryx.Runtime.SystemTests.csproj", "{B47E0CB5-A3EC-4ED6-BCBF-9E3BEA6ABF5D}"
Expand All @@ -31,7 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{10B4B5A2
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestTools", "TestTools", "{953AAE25-26C8-4A28-AB08-61BAFE41B22F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.TestTools.UnitTest", "src\Moryx.TestTools.UnitTest\Moryx.TestTools.UnitTest.csproj", "{505DF475-5FF5-47CC-9E3B-BBE16C359F0E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.TestTools.UnitTest", "src\Moryx.TestTools.UnitTest\Moryx.TestTools.UnitTest.csproj", "{505DF475-5FF5-47CC-9E3B-BBE16C359F0E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Container.TestPlugin", "src\Tests\Moryx.Container.TestPlugin\Moryx.Container.TestPlugin.csproj", "{DD4163B4-1696-4554-961E-DE2A3EB21ECE}"
EndProject
Expand Down Expand Up @@ -91,6 +89,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Model.InMemory", "src
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Runtime.DbUpdate", "src\Moryx.Runtime.DbUpdate\Moryx.Runtime.DbUpdate.csproj", "{5A9EDBD2-FFFE-4B87-9139-3D6C9265758A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Runtime.Maintenance", "src\Moryx.Runtime.Maintenance\Moryx.Runtime.Maintenance.csproj", "{EB039D46-906F-44BF-AC37-B3B3634A4442}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -174,22 +174,6 @@ Global
{8FF77F62-43C3-40FE-9DFE-01A53FE8A68E}.Release|x64.ActiveCfg = Release|Any CPU
{8FF77F62-43C3-40FE-9DFE-01A53FE8A68E}.Release|x64.Build.0 = Release|Any CPU
{8FF77F62-43C3-40FE-9DFE-01A53FE8A68E}.Release|x86.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x64.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x64.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x86.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x86.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|Any CPU.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|Any CPU.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x64.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x64.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x86.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x86.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|Any CPU.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x64.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x86.ActiveCfg = Release|Any CPU
{0F2C9C4B-E9B7-43DD-9B25-72402E583D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F2C9C4B-E9B7-43DD-9B25-72402E583D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F2C9C4B-E9B7-43DD-9B25-72402E583D90}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -702,14 +686,31 @@ Global
{5A9EDBD2-FFFE-4B87-9139-3D6C9265758A}.Release|x64.Build.0 = Release|Any CPU
{5A9EDBD2-FFFE-4B87-9139-3D6C9265758A}.Release|x86.ActiveCfg = Release|Any CPU
{5A9EDBD2-FFFE-4B87-9139-3D6C9265758A}.Release|x86.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x64.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x64.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x86.ActiveCfg = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Debug|x86.Build.0 = Debug|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|Any CPU.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|Any CPU.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x64.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x64.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x86.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release(x86)|x86.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|Any CPU.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x64.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x64.Build.0 = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x86.ActiveCfg = Release|Any CPU
{EB039D46-906F-44BF-AC37-B3B3634A4442}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{92777E64-9978-40AE-8B90-93ECBBBEFE67} = {7DCDBDA5-4163-41EA-B24E-9316DFB9F354}
{8FF77F62-43C3-40FE-9DFE-01A53FE8A68E} = {7DCDBDA5-4163-41EA-B24E-9316DFB9F354}
{EB039D46-906F-44BF-AC37-B3B3634A4442} = {DE7526FF-6D25-4643-9AA3-C24253901C8C}
{0F2C9C4B-E9B7-43DD-9B25-72402E583D90} = {0A466330-6ED6-4861-9C94-31B1949CDDB9}
{B47E0CB5-A3EC-4ED6-BCBF-9E3BEA6ABF5D} = {63266199-BAA4-4463-998A-240E130A197D}
{D8344B1F-9DB3-4E85-9195-6FFFECBF6427} = {DAE7DCE8-AB9B-46A8-808D-6C6C0AAB75A2}
Expand Down Expand Up @@ -739,10 +740,11 @@ Global
{F297C67F-AA7C-4687-912E-5970022165F9} = {7DCDBDA5-4163-41EA-B24E-9316DFB9F354}
{21C94DE5-A774-4474-8C31-DB483D49710E} = {74112169-6672-4907-A187-F055111940A9}
{5A9EDBD2-FFFE-4B87-9139-3D6C9265758A} = {7DCDBDA5-4163-41EA-B24E-9316DFB9F354}
{EB039D46-906F-44BF-AC37-B3B3634A4442} = {DE7526FF-6D25-4643-9AA3-C24253901C8C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {36EFC961-F4E7-49DC-A36A-99594FFB8243}
RESX_ShowErrorsInErrorList = True
RESX_TaskErrorCategory = Message
RESX_ShowErrorsInErrorList = True
SolutionGuid = {36EFC961-F4E7-49DC-A36A-99594FFB8243}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions MoryxPlatform.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=MORYX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Npgsql/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Postgre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=registrator/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Workflows/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Workplan/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ModuleController : ServerModuleFacadeControllerBase<ModuleConfig>,
/// </summary>
protected override void OnInitialize()
{
Container.RegisterWcf(WcfHostFactory, Logger);
Container.RegisterWcf(WcfHostFactory);
Container.LoadComponents<ISimpleHelloWorldWcfConnector>();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Moryx.Model/DbContextContainerExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ public static class DbContextContainerExtension
/// <summary>
/// Register <see cref="IDbContextManager"/> and <see cref="IContextFactory{TContext}"/>
/// </summary>
public static void ActivateDbContexts(this IContainer container, IDbContextManager contextManager)
public static IContainer ActivateDbContexts(this IContainer container, IDbContextManager contextManager)
{
container.SetInstance(contextManager);

container.ExecuteInstaller(new ContextFactoryInstaller());

return container;
}

private class ContextFactoryInstaller : IContainerInstaller
Expand Down
11 changes: 10 additions & 1 deletion src/Moryx.Model/DbContextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,26 @@ public class DbContextManager : IDbContextManager, IInitializable, ILoggingHost
{
#region Dependencies

/// <summary>
/// Config manager to handle database configurations
/// </summary>
public IConfigManager ConfigManager { get; set; }

/// <summary>
/// Logger for the database configurators
/// </summary>
public IModuleLogger Logger { get; set; }

/// <summary>
/// Logger root for this component
/// </summary>
public ILoggerManagement LoggerManagement { get; set; }

#endregion

string ILoggingHost.Name => nameof(DbContextManager);
private ModelWrapper[] _knownModels;

/// <inheritdoc />
public void Initialize()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Runtime.Serialization;
using Moryx.Configuration;
using Moryx.Modules;
using Moryx.Tools.Wcf;

namespace Moryx.Runtime.Maintenance.Contracts
{
Expand All @@ -17,5 +18,11 @@ public abstract class MaintenancePluginConfig : UpdatableEntry, IPluginConfig
/// Name of the plugin.
/// </summary>
public abstract string PluginName { get; }

/// <summary>
/// Endpoint which the plugin provides.
/// </summary>
[DataMember]
public HostConfig ProvidedEndpoint { get; set; }
}
}
50 changes: 0 additions & 50 deletions src/Moryx.Runtime.Maintenance/Maintenance/Common/HostHelper.cs

This file was deleted.

26 changes: 8 additions & 18 deletions src/Moryx.Runtime.Maintenance/ModuleController/ModuleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
using System.Runtime.Serialization;
using Moryx.Configuration;
using Moryx.Runtime.Maintenance.Contracts;
using Moryx.Runtime.Maintenance.Plugins;
using Moryx.Runtime.Maintenance.Plugins.Common;
using Moryx.Runtime.Maintenance.Plugins.Databases;
using Moryx.Runtime.Maintenance.Plugins.Logging;
using Moryx.Runtime.Maintenance.Plugins.Modules;
using Moryx.Serialization;

namespace Moryx.Runtime.Maintenance
Expand All @@ -28,30 +31,17 @@ public class ModuleConfig : ConfigBase
[Description("List of configured maintenance modules.")]
public List<MaintenancePluginConfig> Plugins { get; set; }

/// <summary>
/// If a logging appender exceeds this timeouts its config stream is closed
/// </summary>
[DataMember]
[Description("If a logging appender exceeds this timeouts its config stream is closed")]
[DefaultValue(30000)]
public int AppenderTimeOut { get; set; }

/// <summary>
/// Folder where the setup data is stored.
/// </summary>
[DataMember]
[RelativeDirectories]
[DefaultValue(@".\Backups\")]
public string SetupDataDir { get; set; }

/// <summary>
/// Initialize the maintenance module.
/// </summary>
protected override void Initialize()
{
Plugins = new List<MaintenancePluginConfig>
{
new DefaultMaintenanceConfig()
new ModuleMaintenanceConfig(),
new LoggingMaintenanceConfig(),
new CommonMaintenanceConfig(),
new DatabaseConfig()
};
}
}
Expand Down
46 changes: 30 additions & 16 deletions src/Moryx.Runtime.Maintenance/ModuleController/ModuleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
using Moryx.Runtime.Configuration;
using Moryx.Runtime.Container;
using Moryx.Runtime.Maintenance.Contracts;
using Moryx.Runtime.Maintenance.Logging;
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 @@ -43,29 +44,47 @@ public class ModuleController : ServerModuleBase<ModuleConfig>, IPlatformModule
/// </summary>
public IRuntimeConfigManager RuntimeConfigManager { get; set; }

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

/// <summary>
/// Set the module manager. Not injected by castle.
/// </summary>
/// <param name="moduleManager">the module manager.</param>
public void SetModuleManager(IModuleManager moduleManager)
{
_moduleManager = moduleManager;
}

#endregion

/// <summary>
/// Name of this module
/// </summary>
public override string Name => ModuleName;

/// <inheritdoc />
/// <summary>
/// Called when [initialize].
/// </summary>
protected override void OnInitialize()
{
Container.SetInstance(_moduleManager).SetInstance(RuntimeConfigManager)
.SetInstance(LoggerManagement);
Container.RegisterWcf(WcfHostFactory)
.SetInstance(_moduleManager).SetInstance(RuntimeConfigManager)
.SetInstance((IServerLoggerManagement)LoggerManagement);

Container.SetInstance(DbContextManager);

Container.LoadComponents<IMaintenancePlugin>();
}

/// <inheritdoc />
/// <summary>
/// Called when [start].
/// </summary>
/// <exception cref="System.Exception">Failed to start module + moduleConfig.PluginName</exception>
protected override void OnStart()
{
Container.Resolve<ILoggingAppender>().Start();

var pluginFac = Container.Resolve<IMaintenancePluginFactory>();
var plugins = Container.ResolveAll<IMaintenancePlugin>().ToList();

Expand All @@ -77,7 +96,7 @@ protected override void OnStart()
foreach (var unconfiguredPlugin in unconfiguredPlugins)
{
var baseType = unconfiguredPlugin.GetType().BaseType;
if (baseType == null || !typeof(MaintenancePluginBase<>).IsAssignableFrom(baseType.GetGenericTypeDefinition()))
if (baseType == null || !typeof(MaintenancePluginBase<,>).IsAssignableFrom(baseType.GetGenericTypeDefinition()))
throw new ArgumentException("MaintenancePlugins should be of type MaintenancePluginBase");

var configType = baseType.GetGenericArguments()[0];
Expand Down Expand Up @@ -105,17 +124,12 @@ protected override void OnStart()
}
}

/// <inheritdoc />
/// <summary>
/// Called when [stop].
/// </summary>
protected override void OnStop()
{
Container.Resolve<ILoggingAppender>().Stop();

}

/// <inheritdoc />
void IPlatformModule.SetModuleManager(IModuleManager moduleManager)
{
_moduleManager = moduleManager;
}
}
}
Loading

0 comments on commit a929ce0

Please sign in to comment.