Example #1
0
        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);
        }
Example #2
0
        public void Dispose()
        {
            _logger.Debug("Disposing: " + typeof(NomadKernel));

            if (_moduleLoaderCreator != null)
            {
                _moduleLoaderCreator.Dispose();
                _moduleLoaderCreator = null;
            }

            _logger.Debug("Shutting down logger repository");
            if (_repository != null)
            {
                _repository.Shutdown();
                _repository = null;
            }
        }