/// <summary> /// Initializes new instance of the <see cref="NomadKernel"/> class. /// </summary> /// <param name="nomadConfiguration"> /// <see cref="NomadConfiguration"/> used to initialize kernel modules. /// </param> /// <remarks> /// <para> /// Initializes both LoadedModules AppDomain with IModuleLoader implementation. /// </para> /// <para> /// Kernel, by now, uses the Nomad's default implementation of IModuleLoader( <see cref="ModuleLoader"/> with no ability to change it. /// This constraint is made on behalf of the dependency on the IoC container which should be used for storing information about loaded modules. /// </para> /// </remarks> public NomadKernel(NomadConfiguration nomadConfiguration) { if (nomadConfiguration == null) { throw new ArgumentNullException("nomadConfiguration", "Configuration must be provided."); } nomadConfiguration.Freeze(); KernelConfiguration = nomadConfiguration; KernelAppDomain = AppDomain.CurrentDomain; // create another app domain and register very important services RegisterCoreServices(); // registering additional services ie. updater + listing + languages... etc RegisterAdditionalServices(); }
/// <summary> /// Initializes new instance of the <see cref="NomadKernel"/> class. /// </summary> /// <param name="nomadConfiguration"> /// <see cref="NomadConfiguration"/> used to initialize kernel modules. /// </param> /// <remarks> /// <para> /// Initializes both LoadedModules AppDomain with IModuleLoader implementation. /// </para> /// <para> /// Kernel, by now, uses the Nomad's default implementation of IModuleLoader( <see cref="ModuleLoader"/> with no ability to change it. /// This constraint is made on behalf of the dependency on the IoC container which should be used for storing information about loaded modules. /// </para> /// </remarks> public NomadKernel(NomadConfiguration nomadConfiguration) { //verify configuration if (nomadConfiguration == null) { throw new ArgumentNullException("nomadConfiguration", "Configuration must be provided."); } nomadConfiguration.Freeze(); KernelConfiguration = nomadConfiguration; KernelAppDomain = AppDomain.CurrentDomain; // create another app domain and register very important services RegisterCoreServices(); // registering additional services ie. updater + listing + languages... etc RegisterAdditionalServices(); }
private void RegisterCoreServices(NomadConfiguration nomadConfiguration) { ModuleAppDomain = AppDomain.CreateDomain("Modules AppDomain", new Evidence(AppDomain.CurrentDomain.Evidence), AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory, true); // create kernel version of the event aggregator4 var siteEventAggregator = new EventAggregator(new NullGuiThreadProvider()); // use container creator to create communication services on modules app domain string asmName = typeof(ContainerCreator).Assembly.FullName; string typeName = typeof(ContainerCreator).FullName; if (typeName != null) { _moduleLoaderCreator = (ContainerCreator) ModuleAppDomain.CreateInstanceAndUnwrap(asmName, typeName); DistributedConfiguration distributedConfiguration = nomadConfiguration.DistributedConfiguration; String loggerConfiguration = KernelConfiguration.ModulesLoggerConfigurationFilePath; _moduleLoaderCreator.Install(distributedConfiguration, loggerConfiguration); // create facade for event aggregator combining proxy and on site object EventAggregator = new ForwardingEventAggregator(_moduleLoaderCreator.EventAggregatorOnModulesDomain, siteEventAggregator); // used proxied service locator ServiceLocator = _moduleLoaderCreator.ServiceLocator; ModuleLoader = _moduleLoaderCreator.CreateModuleLoaderInstance(); } _moduleManager = new ModuleManager(ModuleLoader, KernelConfiguration.ModuleFilter, KernelConfiguration.DependencyChecker); }
private void RegisterCoreServices(NomadConfiguration nomadConfiguration) { ModuleAppDomain = AppDomain.CreateDomain("Modules AppDomain", new Evidence(AppDomain.CurrentDomain.Evidence), AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory, true); // create kernel version of the event aggregator4 var siteEventAggregator = new EventAggregator(new NullGuiThreadProvider()); // use container creator to create communication services on modules app domain string asmName = typeof (ContainerCreator).Assembly.FullName; string typeName = typeof (ContainerCreator).FullName; if (typeName != null) { _moduleLoaderCreator = (ContainerCreator) ModuleAppDomain.CreateInstanceAndUnwrap(asmName, typeName); DistributedConfiguration distributedConfiguration = nomadConfiguration.DistributedConfiguration; String loggerConfiguration = KernelConfiguration.ModulesLoggerConfigurationFilePath; _moduleLoaderCreator.Install(distributedConfiguration, loggerConfiguration); // create facade for event aggregator combining proxy and on site object EventAggregator = new ForwardingEventAggregator(_moduleLoaderCreator.EventAggregatorOnModulesDomain, siteEventAggregator); // used proxied service locator ServiceLocator = _moduleLoaderCreator.ServiceLocator; ModuleLoader = _moduleLoaderCreator.CreateModuleLoaderInstance(); } _moduleManager = new ModuleManager(ModuleLoader, KernelConfiguration.ModuleFilter, KernelConfiguration.DependencyChecker); }
private static void SetUpInDomain() { _assemblyFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyPath); _assemblyFullPath2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AssemblyPath2); _configuration = NomadConfiguration.Default; var dependencyMock = new Mock<IDependencyChecker>(MockBehavior.Loose); dependencyMock.Setup(x => x.SortModules(It.IsAny<IEnumerable<ModuleInfo>>())) .Returns<IEnumerable<ModuleInfo>>(e => e); _configuration.DependencyChecker = dependencyMock.Object; }