Example #1
0
        /// <summary>
        /// <para>Saves the configuration settings created for the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public override void Save(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(LoggingSettings.SectionName))
            {
                ClientSettingsNode clientSettingsNode = null;
                try
                {
                    IUIHierarchy hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
                    clientSettingsNode = hierarchy.FindNodeByType(typeof(ClientSettingsNode)) as ClientSettingsNode;
                    if (clientSettingsNode == null)
                    {
                        return;
                    }
                    LoggingSettings loggingSettings = clientSettingsNode.LoggingSettings;
                    configurationContext.WriteConfiguration(LoggingSettings.SectionName, loggingSettings);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, clientSettingsNode, e);
                }
                catch (InvalidOperationException e)
                {
                    ServiceHelper.LogError(serviceProvider, clientSettingsNode, e);
                }
            }
        }
Example #2
0
        /// <summary>
        /// <para>Saves the configuration settings created for the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public override void Save(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(DistributorSettings.SectionName))
            {
                DistributorSettingsNode distributorSettingsNode = null;
                try
                {
                    IUIHierarchy hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
                    distributorSettingsNode = hierarchy.FindNodeByType(typeof(DistributorSettingsNode)) as DistributorSettingsNode;
                    if (distributorSettingsNode == null)
                    {
                        return;
                    }
                    DistributorSettings distributorSettings = distributorSettingsNode.DistributorSettings;
                    configurationContext.WriteConfiguration(DistributorSettings.SectionName, distributorSettings);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, distributorSettingsNode, e);
                }
                catch (InvalidOperationException e)
                {
                    ServiceHelper.LogError(serviceProvider, distributorSettingsNode, e);
                }
            }
        }
        /// <summary>
        /// <para>Saves the configuration settings created for the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Save(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(ExceptionHandlingSettings.SectionName))
            {
                ExceptionHandlingSettingsNode exceptionHandlingSettingsNode = null;
                try
                {
                    IUIHierarchy hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
                    exceptionHandlingSettingsNode = hierarchy.FindNodeByType(typeof(ExceptionHandlingSettingsNode)) as ExceptionHandlingSettingsNode;
                    if (exceptionHandlingSettingsNode == null)
                    {
                        return;
                    }
                    ExceptionHandlingSettings exceptionHandlingSettings = exceptionHandlingSettingsNode.ExceptionHandlingSettings;
                    configurationContext.WriteConfiguration(ExceptionHandlingSettings.SectionName, exceptionHandlingSettings);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, exceptionHandlingSettingsNode, e);
                }
                catch (InvalidOperationException e)
                {
                    ServiceHelper.LogError(serviceProvider, exceptionHandlingSettingsNode, e);
                }
            }
        }
        /// <summary>
        /// <para>Saves the configuration settings created for the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Save(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(CryptographySettings.SectionName))
            {
                CryptographySettingsNode securitySettingsNode = null;
                try
                {
                    IUIHierarchy hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
                    securitySettingsNode = hierarchy.FindNodeByType(typeof(CryptographySettingsNode)) as CryptographySettingsNode;
                    if (securitySettingsNode == null)
                    {
                        return;
                    }
                    CryptographySettings securitySettings = securitySettingsNode.CryptographySettings;
                    configurationContext.WriteConfiguration(CryptographySettings.SectionName, securitySettings);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, securitySettingsNode, e);
                }
                catch (InvalidOperationException e)
                {
                    ServiceHelper.LogError(serviceProvider, securitySettingsNode, e);
                }
            }
        }
Example #5
0
        public void RuntimeTest()
        {
            GeneratedHierarchy.Open();
            Assert.AreEqual(0, ConfigurationErrorsCount);

            ConfigurationContext builder = GeneratedHierarchy.ConfigurationContext;

            if (builder.IsValidSection(DistributorSettings.SectionName))
            {
                DistributorSettings distributorSettings = builder.GetConfiguration(DistributorSettings.SectionName) as DistributorSettings;
                if (distributorSettings != null)
                {
                    DistributorSettingsNode distributorSettingsNode = new DistributorSettingsNode(distributorSettings);
                    foreach (ConfigurationNode node in distributorSettingsNode.Nodes)
                    {
                        if (node is SinkCollectionNode)
                        {
                            SinkCollectionNode sinkCollectionNode = (SinkCollectionNode)node;
                            Assert.AreEqual(4, sinkCollectionNode.SinkDataCollection.Count);
                        }
                        else if (node is FormatterCollectionNode)
                        {
                            FormatterCollectionNode formatterCollectionNode = (FormatterCollectionNode)node;
                            Assert.AreEqual(4, formatterCollectionNode.FormatterDataCollection.Count);
                        }
                        else if (node is CategoryCollectionNode)
                        {
                            CategoryCollectionNode categoryCollectionNode = (CategoryCollectionNode)node;
                            Assert.AreEqual(2, categoryCollectionNode.CategoryDataCollection.Count);
                        }
                    }

                    MsmqDistributorServiceNode msmqNode =
                        new MsmqDistributorServiceNode(distributorSettings.DistributorService);
                    Assert.IsNotNull(msmqNode.MsmqPath);
                }
                else
                {
                    Assert.Fail(String.Format("Can not load section: {0}", DistributorSettings.SectionName));
                }
            }
        }
Example #6
0
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public override void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(DistributorSettings.SectionName))
            {
                DistributorSettings     distributorSettings     = null;
                DistributorSettingsNode distributorSettingsNode = null;
                try
                {
                    distributorSettings     = (DistributorSettings)configurationContext.GetConfiguration(DistributorSettings.SectionName);
                    distributorSettingsNode = new DistributorSettingsNode(distributorSettings);
                    ConfigurationNode configurationNode = GetLoggingSettingsNode(serviceProvider);
                    configurationNode.Nodes.Add(distributorSettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, distributorSettingsNode, e);
                }
            }
        }
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(ExceptionHandlingSettings.SectionName))
            {
                ExceptionHandlingSettings     exceptionHandlingSettings     = null;
                ExceptionHandlingSettingsNode exceptionHandlingSettingsNode = null;
                try
                {
                    exceptionHandlingSettings     = (ExceptionHandlingSettings)configurationContext.GetConfiguration(ExceptionHandlingSettings.SectionName);
                    exceptionHandlingSettingsNode = new ExceptionHandlingSettingsNode(exceptionHandlingSettings);
                    ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                    configurationNode.Nodes.Add(exceptionHandlingSettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, exceptionHandlingSettingsNode, e);
                }
            }
        }
Example #8
0
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(SecuritySettings.SectionName))
            {
                SecuritySettings     securitySettings     = null;
                SecuritySettingsNode securitySettingsNode = null;
                try
                {
                    securitySettings     = (SecuritySettings)configurationContext.GetConfiguration(SecuritySettings.SectionName);
                    securitySettingsNode = new SecuritySettingsNode(securitySettings);
                    ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                    configurationNode.Nodes.Add(securitySettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, securitySettingsNode, e);
                }
            }
        }
Example #9
0
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public override void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(LoggingSettings.SectionName))
            {
                LoggingSettings    loggingSettings    = null;
                ClientSettingsNode clientSettingsNode = null;
                try
                {
                    loggingSettings    = (LoggingSettings)configurationContext.GetConfiguration(LoggingSettings.SectionName);
                    clientSettingsNode = new ClientSettingsNode(loggingSettings);
                    ConfigurationNode configurationNode = GetLoggingSettingsNode(serviceProvider);
                    configurationNode.Nodes.Add(clientSettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, clientSettingsNode, e);
                }
            }
        }
        /// <summary>
        /// <para>Saves the configuration settings created for the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Save(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(CacheManagerSettings.SectionName))
            {
                CacheManagerSettingsNode cacheManagerSettingsNode = GetCacheManagerSettingsNode(serviceProvider);
                CacheManagerSettings     settings = cacheManagerSettingsNode.CacheManagerSettings;
                if (settings != null)
                {
                    try
                    {
                        configurationContext.WriteConfiguration(CacheManagerSettings.SectionName, settings);
                    }
                    catch (InvalidOperationException e)
                    {
                        ServiceHelper.LogError(serviceProvider, cacheManagerSettingsNode, e);
                    }
                }
            }
        }
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(CryptographySettings.SectionName))
            {
                CryptographySettings     cryptographySettings     = null;
                CryptographySettingsNode cryptographySettingsNode = null;
                try
                {
                    cryptographySettings     = (CryptographySettings)configurationContext.GetConfiguration(CryptographySettings.SectionName);
                    cryptographySettingsNode = new CryptographySettingsNode(cryptographySettings);
                    ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                    configurationNode.Nodes.Add(cryptographySettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, cryptographySettingsNode, e);
                }
            }
        }
Example #12
0
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(DynamicQuerySettings.SectionName))
            {
                DynamicQuerySettings     dynamicQuerySettings     = null;
                DynamicQuerySettingsNode dynamicQuerySettingsNode = null;
                try
                {
                    dynamicQuerySettings     = configurationContext.GetConfiguration(DynamicQuerySettings.SectionName) as DynamicQuerySettings;
                    dynamicQuerySettingsNode = new DynamicQuerySettingsNode(dynamicQuerySettings);
                    ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                    configurationNode.Nodes.Add(dynamicQuerySettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, dynamicQuerySettingsNode, e);
                }
            }
        }
Example #13
0
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(DatabaseSettings.SectionName))
            {
                DatabaseSettings     databaseSettings     = null;
                DatabaseSettingsNode databaseSettingsNode = null;
                try
                {
                    databaseSettings     = (DatabaseSettings)configurationContext.GetConfiguration(DatabaseSettings.SectionName);
                    databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);
                    ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                    configurationNode.Nodes.Add(databaseSettingsNode);
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, databaseSettingsNode, e);
                }
            }
        }
        /// <summary>
        /// <para>Opens the configuration settings and registers them with the application.</para>
        /// </summary>
        /// <param name="serviceProvider">
        /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
        /// </param>
        public void Open(IServiceProvider serviceProvider)
        {
            ConfigurationContext configurationContext = ServiceHelper.GetCurrentConfigurationContext(serviceProvider);

            if (configurationContext.IsValidSection(CacheManagerSettings.SectionName))
            {
                CacheManagerSettingsNode cacheManagerSettingsNode = null;
                try
                {
                    CacheManagerSettings settings = configurationContext.GetConfiguration(CacheManagerSettings.SectionName) as CacheManagerSettings;
                    if (settings != null)
                    {
                        cacheManagerSettingsNode = new CacheManagerSettingsNode(settings);
                        ConfigurationNode configurationNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
                        configurationNode.Nodes.Add(cacheManagerSettingsNode);
                    }
                }
                catch (ConfigurationException e)
                {
                    ServiceHelper.LogError(serviceProvider, cacheManagerSettingsNode, e);
                }
            }
        }
        public void RuntimeTest()
        {
            GeneratedHierarchy.Open();
            Assert.AreEqual(0, ConfigurationErrorsCount);

            ConfigurationContext configurationContext = GeneratedHierarchy.ConfigurationContext;

            if (configurationContext.IsValidSection(LoggingSettings.SectionName))
            {
                LoggingSettings clientSettings = configurationContext.GetConfiguration(LoggingSettings.SectionName) as LoggingSettings;
                if (clientSettings != null)
                {
                    ClientSettingsNode settingsNode = new ClientSettingsNode(clientSettings);
                    Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, settingsNode.CategoryFilterSettings.CategoryFilterMode);
                    Assert.AreEqual(false, settingsNode.LoggingEnabled);
                    Assert.AreEqual(1, settingsNode.MinimumPriority);
                    Assert.AreEqual(false, settingsNode.TracingEnabled);
                }
            }
            else
            {
                Assert.Fail(String.Format("Can not load section: {0}", LoggingSettings.SectionName));
            }
        }