Пример #1
0
        // !Caller holds config_load_lock
        private static void LoadConfigLegacy(string trinity_config_file)
        {
            XMLConfig xml_config = new XMLConfig(trinity_config_file);
            //construct local configuration section
            XElement localSection = new XElement(ConfigurationConstants.Tags.LOCAL);
            XElement loggingEntry = new XElement(ConfigurationConstants.Tags.LOGGING);
            XElement storageEntry = new XElement(ConfigurationConstants.Tags.STORAGE);
            XElement networkEntry = new XElement(ConfigurationConstants.Tags.NETWORK);

            loggingEntry.SetAttributeValue(ConfigurationConstants.Attrs.LOGGING_DIRECTLY, xml_config.GetEntryValue(ConfigurationConstants.Tags.LOGGING, ConfigurationConstants.Attrs.LOGGING_DIRECTLY));
            loggingEntry.SetAttributeValue(ConfigurationConstants.Attrs.LOGGING_LEVEL, xml_config.GetEntryValue(ConfigurationConstants.Tags.LOGGING, ConfigurationConstants.Attrs.LOGGING_LEVEL));
            storageEntry.SetAttributeValue(ConfigurationConstants.Attrs.STORAGE_ROOT, xml_config.GetEntryValue(ConfigurationConstants.Tags.STORAGE, ConfigurationConstants.Attrs.STORAGE_ROOT));
            networkEntry.SetAttributeValue(ConfigurationConstants.Attrs.HTTP_PORT, xml_config.GetEntryValue(ConfigurationConstants.Tags.NETWORK, ConfigurationConstants.Attrs.HTTP_PORT));
            networkEntry.SetAttributeValue(ConfigurationConstants.Attrs.CLIENT_MAX_CONN, xml_config.GetEntryValue(ConfigurationConstants.Tags.NETWORK, ConfigurationConstants.Attrs.CLIENT_MAX_CONN));
            if (loggingEntry.Attributes().Count() > 0)
            {
                localSection.Add(loggingEntry);
            }
            if (storageEntry.Attributes().Count() > 0)
            {
                localSection.Add(storageEntry);
            }
            if (networkEntry.Attributes().Count() > 0)
            {
                localSection.Add(networkEntry);
            }
            //construct local ConfigurationSection
            s_localConfigurationSection = new ConfigurationSection(localSection);
            //construct a clusterSections
            s_current_cluster_config = ClusterConfig._LegacyLoadClusterConfig(trinity_config_file);

            s_clusterConfigurations.Add(ConfigurationConstants.Tags.DEFAULT_CLUSTER, s_current_cluster_config);
        }
Пример #2
0
 /// <summary>
 /// Creates a cloud storage instance with the specified name.
 /// </summary>
 /// <param name="configFile">The file path of a configuration file.</param>
 /// <returns>The newly created cloud storage instance.</returns>
 public static MemoryCloud CreateCloudStorage(string configFile)
 {
     return(CreateCloudStorage(ClusterConfig._LegacyLoadClusterConfig(configFile)));
 }