Beispiel #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private static void LoadNodeHostConfig()
        {
            s_Log.Debug("Loading {0}", BootConfiguration.DefaultBootConfigFileName);

            s_BootConfig = BootConfiguration.LoadFromFile(PathUtility.LocalBinPath(BootConfiguration.DefaultBootConfigFileName));
            s_BootConfig.Validate();

            s_Log.Info(s_BootConfig.ToLogString());
        }
Beispiel #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private static void GenerateDummyNodeHostConfig()
        {
            _s_bootConfig = new BootConfiguration() {
                ApplicationName = "Test App",
                NodeName = "Test Node",
                ApplicationModules = new List<BootConfiguration.ModuleConfig> {
                    new BootConfiguration.ModuleConfig {
                        Assembly = "Dummy.Module"
                    }
                }
            };

            var serializer = new DataContractSerializer(typeof(BootConfiguration));
            using ( var file = File.Create(PathUtility.LocalBinPath(BootConfiguration.DefaultBootConfigFileName)) )
            {
                serializer.WriteObject(file, _s_bootConfig);
                file.Flush();
            }

            _s_bootConfig = null;
        }
Beispiel #3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private static void LoadBootConfig(string[] programArgs)
        {
            var configFilePath = PathUtility.LocalBinPath(programArgs.Length > 0 ? programArgs[0] : BootConfiguration.DefaultBootConfigFileName);

            _s_log.Debug("Loading configuration from: {0}", configFilePath);

            _s_bootConfig = BootConfiguration.LoadFromFile(configFilePath);
            _s_bootConfig.Validate();

            _s_log.Debug("> Application Name   - {0}", _s_bootConfig.ApplicationName);
            _s_log.Debug("> Node Name          - {0}", _s_bootConfig.NodeName);

            foreach ( var module in _s_bootConfig.FrameworkModules )
            {
                _s_log.Debug("> Framework Module   - {0}", module.Name);
            }

            foreach ( var module in _s_bootConfig.ApplicationModules )
            {
                _s_log.Debug("> Application Module - {0}", module.Name);
            }
        }
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        private void LoadConfigurationFile(BootConfiguration.ConfigFile file)
        {
            if ( file.IsOptionalAndMissing )
            {
                _logger.OptionalFileNotPresentSkipping(file.Path);
                return;
            }

            using ( _logger.LoadingConfigurationFile(file.Path) )
            {
                try
                {
                    var document = XDocument.Load(file.Path, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
                    LoadConfigurationDocument(document);
                }
                catch ( Exception e )
                {
                    _logger.FailedToLoadConfigurationFile(file.Path, e);
                    throw;
                }
            }
        }