/// <summary> /// Initialize the module manager. /// </summary> public void Initialize() { // Create components LoggerManagement.ActivateLogging(this); _config = ConfigManager.GetConfiguration <ModuleManagerConfig>(); // Create dependency manager and build tree of available modules _dependencyManager = new ModuleDependencyManager(Logger.GetChild(string.Empty, typeof(ModuleDependencyManager))); var availableModules = _dependencyManager.BuildDependencyTree(ServerModules); // Create dedicated components for stopping and starting var waitingModules = new Dictionary <IServerModule, ICollection <IServerModule> >(); _moduleStarter = new ModuleStarter(_dependencyManager, Logger.GetChild(string.Empty, typeof(ModuleStarter)), _config) { AvailableModules = availableModules, WaitingModules = waitingModules }; _moduleStopper = new ModuleStopper(_dependencyManager, Logger.GetChild(string.Empty, typeof(ModuleStopper))) { AvailableModules = availableModules, WaitingModules = waitingModules }; // Link framework modules foreach (var platformModule in availableModules.OfType <IPlatformModule>()) { platformModule.SetModuleManager(this); } // Observe state changed events of modules foreach (var module in availableModules) { module.StateChanged += OnModuleStateChanged; } AllModules = ServerModules; }
public ModuleStarter(IModuleDependencyManager dependencyManager, IModuleLogger logger, ModuleManagerConfig config) { _dependencyManager = dependencyManager; _logger = logger; _config = config; }
public ModuleStopper(IModuleDependencyManager dependencyManager, IModuleLogger logger) { _dependencyManager = dependencyManager; _logger = logger; }