/// <summary> Read the microservice endpoints portion of a XML file </summary>
        /// <param name="readerXml"> XML Reader open to the microservice portion </param>
        /// <param name="config"> Configuration information </param>
        /// <param name="SystemBaseUrl"> Base URL for this instance </param>
        public static void Read_Microservices_Client_Details(XmlReader readerXml, MicroservicesClient_Configuration config, string SystemBaseUrl)
        {
            // Just step through the subtree of this
            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                    case "add":
                        string key      = String.Empty;
                        string url      = String.Empty;
                        string protocol = "JSON";
                        if (readerXml.MoveToAttribute("Key"))
                        {
                            key = readerXml.Value;
                        }
                        if (readerXml.MoveToAttribute("URL"))
                        {
                            url = readerXml.Value.Replace("[BASEURL]", SystemBaseUrl);
                        }
                        if (readerXml.MoveToAttribute("Protocol"))
                        {
                            protocol = readerXml.Value;
                        }

                        if ((!String.IsNullOrEmpty(key)) && (!String.IsNullOrEmpty(url)))
                        {
                            config.Add_Endpoint(key, url, protocol);
                        }
                        break;
                    }
                }
            }
        }
 /// <summary> Constructor for a new instance of the MicroservicesClientBase class </summary>
 /// <param name="ConfigFile"> Location for the configuration file to read </param>
 /// <param name="SystemBaseUrl"> System base URL </param>
 protected MicroservicesClientBase(string ConfigFile, string SystemBaseUrl)
 {
     if (Config == null)
     {
         Config = MicroservicesClient_Config_Reader.Read_Config(ConfigFile, SystemBaseUrl);
     }
 }
 /// <summary> Constructor for a new instance of the Single_Instance_Configuration class </summary>
 public Single_Instance_Configuration()
 {
     Is_Active = true;
     Name = String.Empty;
     Microservices = new MicroservicesClient_Configuration();
     DatabaseConnection = new Database_Instance_Configuration();
 }
        private static void read_microservices_client_details(XmlReader readerXml, MicroservicesClient_Configuration config, string SystemBaseUrl)
        {
            // Just step through the subtree of this
            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    switch (readerXml.Name.ToLower())
                    {
                        case "add":
                            string key = String.Empty;
                            string url = String.Empty;
                            string protocol = "JSON";
                            if (readerXml.MoveToAttribute("Key"))
                                key = readerXml.Value;
                            if (readerXml.MoveToAttribute("URL"))
                                url = readerXml.Value.Replace("[BASEURL]", SystemBaseUrl);
                            if (readerXml.MoveToAttribute("Protocol"))
                                protocol = readerXml.Value;

                            if (( !String.IsNullOrEmpty(key)) && ( !String.IsNullOrEmpty(url)))
                                config.Add_Endpoint(key, url, protocol);
                            break;
                    }
                }
            }
        }
        /// <summary> Static class is used to read the configuration file defining microservice endpoints </summary>
        /// <param name="ConfigFile"> Path and name of the configuration XML file to read </param>
        /// <param name="SystemBaseUrl"> System base URL </param>
        /// <returns> Fully configured microservices configuration object </returns>
        public static MicroservicesClient_Configuration Read_Config(string ConfigFile, string SystemBaseUrl)
        {
            MicroservicesClient_Configuration returnValue = new MicroservicesClient_Configuration();

            // Streams used for reading
            Stream        readerStream = null;
            XmlTextReader readerXml    = null;

            try
            {
                // Open a link to the file
                readerStream = new FileStream(ConfigFile, FileMode.Open, FileAccess.Read);

                // Open a XML reader connected to the file
                readerXml = new XmlTextReader(readerStream);

                while (readerXml.Read())
                {
                    if (readerXml.NodeType == XmlNodeType.Element)
                    {
                        switch (readerXml.Name.ToLower())
                        {
                        case "microservicesclient":
                            Read_Microservices_Client_Details(readerXml.ReadSubtree(), returnValue, SystemBaseUrl);
                            break;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                returnValue.Error = ee.Message;
            }
            finally
            {
                if (readerXml != null)
                {
                    readerXml.Close();
                }
                if (readerStream != null)
                {
                    readerStream.Close();
                }
            }

            return(returnValue);
        }
        /// <summary> Static class is used to read the configuration file defining microservice endpoints </summary>
        /// <param name="ConfigFile"> Path and name of the configuration XML file to read </param>
        /// <param name="SystemBaseUrl"> System base URL </param>
        /// <returns> Fully configured microservices configuration object </returns>
        public static MicroservicesClient_Configuration Read_Config(string ConfigFile, string SystemBaseUrl )
        {
            MicroservicesClient_Configuration returnValue = new MicroservicesClient_Configuration();

            // Streams used for reading
            Stream readerStream = null;
            XmlTextReader readerXml = null;

            try
            {
                // Open a link to the file
                readerStream = new FileStream(ConfigFile, FileMode.Open, FileAccess.Read);

                // Open a XML reader connected to the file
                readerXml = new XmlTextReader(readerStream);

                while (readerXml.Read())
                {
                    if (readerXml.NodeType == XmlNodeType.Element)
                    {
                        switch (readerXml.Name.ToLower())
                        {
                            case "microservicesclient":
                                read_microservices_client_details(readerXml.ReadSubtree(), returnValue, SystemBaseUrl);
                                break;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                returnValue.Error = ee.Message;
            }
            finally
            {
                if (readerXml != null)
                {
                    readerXml.Close();
                }
                if (readerStream != null)
                {
                    readerStream.Close();
                }
            }

            return returnValue;
        }
 /// <summary> Constructor for a new instance of the SobekEngineClient_WebSkinEndpoints class </summary>
 /// <param name="ConfigObj"> Fully constructed microservices client configuration </param>
 public SobekEngineClient_WebSkinEndpoints(MicroservicesClient_Configuration ConfigObj)
     : base(ConfigObj)
 {
     // All work done in the base constructor
 }
 /// <summary> Directly set the microservice configuration </summary>
 /// <param name="EndpointConfig"> Configuration of all the endpoint information </param>
 public static void Set_Endpoints(MicroservicesClient_Configuration EndpointConfig )
 {
     ConfigObj = EndpointConfig;
     Config_Read_Attempted = true;
     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);
 }
 /// <summary> Directly set the microservice configuration </summary>
 /// <param name="EndpointConfig"> Configuration of all the endpoint information </param>
 public static void Set_Endpoints(MicroservicesClient_Configuration EndpointConfig)
 {
     Config = EndpointConfig;
 }
 /// <summary> Constructor for a new instance of the MicroservicesClientBase class </summary>
 /// <param name="ConfigObj"> Fully constructed microservices client configuration </param>
 protected MicroservicesClientBase(MicroservicesClient_Configuration ConfigObj)
 {
     Config = ConfigObj;
 }