Example #1
0
        private static void read_instances(XmlReader ReaderXml)
        {
            Single_Instance_Configuration singleInstance = new Single_Instance_Configuration();

            while (ReaderXml.Read())
            {
                // Only detect start elements.
                if (ReaderXml.NodeType == XmlNodeType.Element)
                {
                    // Get element name and switch on it.
                    switch (ReaderXml.Name.ToLower())
                    {
                    case "instance":
                        singleInstance = new Single_Instance_Configuration();
                        if (ReaderXml.MoveToAttribute("active"))
                        {
                            if (ReaderXml.Value.ToLower() == "false")
                            {
                                singleInstance.Is_Active = false;
                            }
                        }
                        if (ReaderXml.MoveToAttribute("name"))
                        {
                            singleInstance.Name = ReaderXml.Value.Trim();
                        }
                        break;

                    case "connection_string":
                        if (ReaderXml.MoveToAttribute("type"))
                        {
                            if (ReaderXml.Value.ToLower() == "postgresql")
                            {
                                singleInstance.DatabaseConnection.Database_Type = EalDbTypeEnum.PostgreSQL;
                            }
                        }
                        ReaderXml.Read();
                        singleInstance.DatabaseConnection.Connection_String = ReaderXml.Value;
                        break;

                    case "microservices":
                        MicroservicesClient_Config_Reader.Read_Microservices_Client_Details(ReaderXml.ReadSubtree(), singleInstance.Microservices, String.Empty);
                        break;
                    }
                }
                else if ((ReaderXml.NodeType == XmlNodeType.EndElement) && (ReaderXml.Name.ToLower() == "instance"))
                {
                    // Esnure it has SOME name
                    if (String.IsNullOrWhiteSpace(singleInstance.Name))
                    {
                        singleInstance.Name = "Connection" + (MultiInstance_Builder_Settings.Instances.Count + 1);
                    }

                    // Add this to the list of instances
                    MultiInstance_Builder_Settings.Instances.Add(singleInstance);
                }
            }
        }
Example #2
0
        /// <summary> Read the microservices configuration file </summary>
        /// <param name="ConfigFile"> File ( including path )</param>
        /// <param name="SystemBaseUrl"></param>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        /// <remarks> This also sets the <see cref="Config_Read_Attempted"/> flag to TRUE and set the <see cref="Config_Read_Error"/> flag </remarks>
        public static bool Read_Config_File(string ConfigFile, string SystemBaseUrl)
        {
            ConfigObj             = MicroservicesClient_Config_Reader.Read_Config(ConfigFile, SystemBaseUrl);
            Config_Read_Attempted = true;
            if (String.IsNullOrEmpty(ConfigObj.Error))
            {
                Aggregations = new SobekEngineClient_AggregationEndpoints(ConfigObj);
                WebSkins     = new SobekEngineClient_WebSkinEndpoints(ConfigObj);
                Items        = new SobekEngineClient_ItemEndpoints(ConfigObj);
                Search       = new SobekEngineClient_SearchEndpoints(ConfigObj);
                WebContent   = new SobekEngineClient_WebContentEndpoints(ConfigObj);
                Navigation   = new SobekEngineClient_NavigationEndpoints(ConfigObj);
                Builder      = new SobekEngineClient_BuilderEndpoints(ConfigObj);
                Admin        = new SobekEngineClient_AdminEndpoints(ConfigObj);

                return(true);
            }

            Config_Read_Error = ConfigObj.Error;
            return(false);
        }