public void AuthorizeRequest(object sender, EventArgs e)
            {
                if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
                {
                    return;
                }

                HttpApplication application = (HttpApplication)sender;
                HttpContext     context     = application.Context;

                bool adminRootRequest = UrlUtils.IsAdminConsoleRequest(context);

                if (adminRootRequest && UserValidationFacade.IsLoggedIn())
                {
                    _dataScope = new DataScope(DataScopeIdentifier.Administrated, UserSettings.ActiveLocaleCultureInfo);

                    if (!_consoleArtifactsInitialized)
                    {
                        lock (_consoleArtifactsInitializeLock)
                        {
                            if (!_consoleArtifactsInitialized && !SystemSetupFacade.SetupIsRunning)
                            {
                                HookingFacade.EnsureInitialization();
                                FlowControllerFacade.Initialize();
                                ConsoleFacade.Initialize();
                                ElementProviderLoader.LoadAllProviders();
                                _consoleArtifactsInitialized = true;
                            }
                        }
                    }
                }
            }
Example #2
0
        private static void DoInitialize()
        {
            int startTime = Environment.TickCount;

            Guid installationId = InstallationInformationFacade.InstallationId;

            Log.LogVerbose(LogTitle, "Initializing the system core - installation id = " + installationId);

            using (new LogExecutionTime(LogTitle, "Initialization of the static data types"))
            {
                DataProviderRegistry.InitializeDataTypes();
            }


            using (new LogExecutionTime(LogTitle, "Auto update of static data types"))
            {
                bool typesUpdated = AutoUpdateStaticDataTypes();
                if (typesUpdated)
                {
                    using (new LogExecutionTime(LogTitle, "Reinitialization of the static data types"))
                    {
                        SqlTableInformationStore.Flush();
                        DataProviderRegistry.Flush();
                        DataProviderPluginFacade.Flush();


                        DataProviderRegistry.InitializeDataTypes();
                    }

                    CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);
                }
            }


            using (new LogExecutionTime(LogTitle, "Ensure data stores"))
            {
                bool dataStoresCreated = DataStoreExistenceVerifier.EnsureDataStores();

                if (dataStoresCreated)
                {
                    Log.LogVerbose(LogTitle, "Initialization of the system was halted, performing a flush");
                    _initializing = false;
                    GlobalEventSystemFacade.FlushTheSystem();
                    return;
                }
            }



            using (new LogExecutionTime(LogTitle, "Initializing data process controllers"))
            {
                ProcessControllerFacade.Initialize_PostDataTypes();
            }


            using (new LogExecutionTime(LogTitle, "Initializing data type references"))
            {
                DataReferenceRegistry.Initialize_PostDataTypes();
            }


            using (new LogExecutionTime(LogTitle, "Initializing data type associations"))
            {
                DataAssociationRegistry.Initialize_PostDataTypes();
            }


            using (new LogExecutionTime(LogTitle, "Initializing internal urls"))
            {
                InternalUrls.Initialize_PostDataTypes();
            }


            using (new LogExecutionTime(LogTitle, "Initializing functions"))
            {
                MetaFunctionProviderRegistry.Initialize_PostDataTypes();
            }


            Log.LogVerbose(LogTitle, "Starting initialization of administrative secondaries");


            if (SystemSetupFacade.IsSystemFirstTimeInitialized && !SystemSetupFacade.SetupIsRunning)
            {
                using (new LogExecutionTime(LogTitle, "Initializing workflow runtime"))
                {
                    WorkflowFacade.EnsureInitialization();
                }
            }


            if (!RuntimeInformation.IsUnittest)
            {
                using (new LogExecutionTime(LogTitle, "Initializing flow system"))
                {
                    FlowControllerFacade.Initialize();
                }

                using (new LogExecutionTime(LogTitle, "Initializing console system"))
                {
                    ConsoleFacade.Initialize();
                }
            }


            using (new LogExecutionTime(LogTitle, "Auto installing packages"))
            {
                DoAutoInstallPackages();
            }


            using (new LogExecutionTime(LogTitle, "Loading element providers"))
            {
                ElementProviderLoader.LoadAllProviders();
            }


            int executionTime = Environment.TickCount - startTime;

            Log.LogVerbose(LogTitle, "Done initializing of the system core. ({0} ms)".FormatWith(executionTime));
        }