/// <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();
 }
        /// <summary> Constructor for a new instance of the Worker_BulkLoader class </summary>
        /// <param name="Logger"> Log file object for logging progress </param>
        /// <param name="Verbose"> Flag indicates if the builder is in verbose mode, where it should log alot more information </param>
        /// <param name="DbInstance"> This database instance </param>
        /// <param name="MultiInstanceBuilder"> Flag indicates if this is set to be a multi-instance builder configuration </param>
        /// <param name="LogFileDirectory"> Directory where any log files would be written </param>
        public Worker_BulkLoader(LogFileXhtml Logger, bool Verbose, Database_Instance_Configuration DbInstance, bool MultiInstanceBuilder, string LogFileDirectory )
        {
            // Save the log file and verbose flag
            logger = Logger;
            verbose = Verbose;
            instanceName = DbInstance.Name;
            canAbort = DbInstance.Can_Abort;
            multiInstanceBuilder = MultiInstanceBuilder;
            dbInstance = DbInstance;
            logFileDirectory = LogFileDirectory;

            if (multiInstanceBuilder)
                newItemLimit = 100;
            else
                newItemLimit = -1;

            Add_NonError_To_Log("Worker_BulkLoader.Constructor: Start", verbose, String.Empty, String.Empty, -1);

            // Create new list of collections to build
            aggregationsToRefresh = new List<string>();
            processedItems = new List<BibVidStruct>();
            deletedItems = new List<BibVidStruct>();

            // get all the info
            settings = InstanceWide_Settings_Builder.Build_Settings(dbInstance);
            Refresh_Settings_And_Item_List();

            // Ensure there is SOME instance name
            if (instanceName.Length == 0)
                instanceName = settings.System.System_Name;
            if (verbose)
                settings.Builder.Verbose_Flag = true;

            Add_NonError_To_Log("Worker_BulkLoader.Constructor: Created Static Pages Builder", verbose, String.Empty, String.Empty, -1);

            // Set some defaults
            aborted = false;

            Add_NonError_To_Log("Worker_BulkLoader.Constructor: Building modules for pre, post, and item processing", verbose, String.Empty, String.Empty, -1);

            Add_NonError_To_Log("Worker_BulkLoader.Constructor: Done", verbose, String.Empty, String.Empty, -1);
        }
        /// <summary> Refresh the settings object by pulling the data back from the database </summary>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        public static bool RefreshSettings(Database_Instance_Configuration DbInstance )
        {
            try
            {
                lock (settingsLock)
                {
                    if (settings == null)
                        settings = InstanceWide_Settings_Builder.Build_Settings(DbInstance);
                    else
                    {
                        InstanceWide_Settings newSettings = InstanceWide_Settings_Builder.Build_Settings(DbInstance);
                        settings = newSettings;
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
        /// <summary> Refresh the settings object by pulling the data back from the database </summary>
        /// <returns> TRUE if successful, otherwise FALSE </returns>
        public static bool RefreshConfiguration(Database_Instance_Configuration DbInstance)
        {
            try
            {
                lock (configurationLock)
                {
                    if (configuration == null)
                        configuration = Configuration_Files_Reader.Read_Config_Files( Settings);
                    else
                    {
                        InstanceWide_Configuration newConfig = Configuration_Files_Reader.Read_Config_Files( Settings);
                        configuration = newConfig;
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
        /// <summary> Refress all of the settings within this gateway </summary>
        /// <param name="DbInstance"> Database instance to use when pulling the new data  </param>
        /// <returns> TRUE if successful, FALSE if any errors occurred </returns>
        public static bool RefreshAll( Database_Instance_Configuration DbInstance )
        {
            bool error = !RefreshSettings(DbInstance);
            error = error | !RefreshConfiguration(DbInstance);
            error = error | !RefreshStatsDateRange();
            error = error | !RefreshTranslations();
            error = error | !RefreshWebSkins();
            error = error | !RefreshCodes();
            error = error | !RefreshItems();
            error = error | !RefreshStopWords();
            error = error | !RefreshIP_Restrictions();
            error = error | !RefreshThematicHeadings();
            error = error | !RefreshUserGroups();
            error = error | !RefreshCollectionAliases();
            error = error | !RefreshMimeTypes();
            error = error | !RefreshIcons();
            error = error | !RefreshDefaultMetadataTemplates();
            error = error | !RefreshUrlPortals();
            error = error | !RefreshWebContentHierarchy();

            Last_Refresh = DateTime.Now;

            return !error;
        }