Пример #1
0
        static ProcessControllerFacade()
        {
            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());

            _controlledTypes.Add(typeof(IPublishControlled), typeof(IPublishProcessController));
            _controlledTypes.Add(typeof(ILocalizedControlled), typeof(ILocalizeProcessController));
        }
Пример #2
0
        private void step5CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding <bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding <bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();

            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());

            if (this.GetBinding <bool>("ReloadConsoleOnCompletion") == false)
            {
                PackageElementProviderAvailablePackagesItemEntityToken castedEntityToken = (PackageElementProviderAvailablePackagesItemEntityToken)this.EntityToken;

                InstalledPackageInformation installedPackage = PackageManager.GetInstalledPackages().FirstOrDefault(f => f.Id == castedEntityToken.PackageId);

                var installedPackageEntityToken = new PackageElementProviderInstalledPackageItemEntityToken(
                    installedPackage.Id,
                    installedPackage.GroupName,
                    installedPackage.IsLocalInstalled,
                    installedPackage.CanBeUninstalled);

                ExecuteWorklow(installedPackageEntityToken, WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.PackageElementProvider.ViewInstalledPackageInfoWorkflow"));
            }
        }
Пример #3
0
        static BrowserRender()
        {
            GlobalEventSystemFacade.SubscribeToShutDownEvent(a => ShutdownPhantomJsExeSilent());
            PackageInstaller.OnPackageInstallation += ShutdownPhantomJsExeSilent;

            FileChangeNotificator.Subscribe(PhantomServer.ScriptFilePath, (a, b) => PhantomServer.ShutDown(false));
        }
        static CodeGenerationManager()
        {
            string assemblyTempPath = null;

            try
            {
                assemblyTempPath = PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory);
            }
            catch
            {
                // NOTE: We don't want this static constructor fail if GlobalSettingsFacade failed to load.
            }

            if (assemblyTempPath != null)
            {
                if (!C1Directory.Exists(assemblyTempPath))
                {
                    C1Directory.CreateDirectory(assemblyTempPath);
                }
            }

            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());

            GlobalEventSystemFacade.SubscribeToShutDownEvent(args => ClearOldTempFiles());
        }
        static DataFacadeReflectionCache()
        {
            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());

            IQueryProvider_CreateQuery = typeof(IQueryProvider).GetMethods().First(m => m.Name == "CreateQuery" && m.IsGenericMethod);
            Queryable_AsQueryable      = typeof(Queryable).GetMethods().First(m => m.Name == "AsQueryable" && m.IsGenericMethod);
        }
Пример #6
0
        static XmlDataProviderDocumentWriter()
        {
            _autoCommitTimer           = new System.Timers.Timer(_updateFrequency.TotalMilliseconds);
            _autoCommitTimer.AutoReset = true;
            _autoCommitTimer.Elapsed  += new System.Timers.ElapsedEventHandler(OnAutoCommitTimer);
            _autoCommitTimer.Start();

            GlobalEventSystemFacade.SubscribeToShutDownEvent(OnShutDownEvent);
        }
Пример #7
0
            private void InvalidateCache()
            {
                lock (_calculationLock)
                {
                    _hash = null;
                    _lastFileChangeTime = null;
                }

                GlobalEventSystemFacade.FireDesignChangeEvent();
            }
        static StackifyTraceListener()
        {
            GlobalEventSystemFacade.SubscribeToPrepareForShutDownEvent(args =>
            {
                StackifyAPILogger.Log("Composite C1 TraceListener shutting down");
                MetricClient.StopMetricsQueue("Composite C1 TraceListener shutting down");

                StackifyLogger.Shutdown();
            });
        }
Пример #9
0
        public static void OnInitialized()
        {
            var hours = int.Parse(Config.SendEveryNHours);

            Log.LogInformation("Composite.Tools.LegacyUrlHandler", string.Format("Send404Mails Thread Timer Started(send emails every {0} hour)", Config.SendEveryNHours));

            _timer = new Timer(Run, null, 60000, 900000);
            GlobalEventSystemFacade.SubscribeToPrepareForShutDownEvent(RunOnShutDown);

            Functions.DeleteOldBrokenLinks();
        }
Пример #10
0
        /// <exclude />
        public void UpdateDataTypeDescriptor(DataTypeDescriptor dataTypeDescriptor, bool flushTheSystem)
        {
            dataTypeDescriptor.Validate();

            DataMetaDataFacade.PersistMetaData(dataTypeDescriptor);

            if (flushTheSystem)
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }
        }
Пример #11
0
        /// <exclude />
        public void FunctionsUpdated()
        {
            if (SystemSetupFacade.SetupIsRunning)
            {
                return;
            }

            MetaFunctionProviderRegistry.ReinitializeFunctionFromProvider(this.ProviderName);

            GlobalEventSystemFacade.FireDesignChangeEvent();
        }
Пример #12
0
 static DataCachingFacade()
 {
     ReadSettings();
     GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
     DataEvents <IData> .OnStoreChanged += (sender, args) =>
     {
         if (!args.DataEventsFired)
         {
             ClearCache(args.DataType, args.PublicationScope);
         }
     };
 }
Пример #13
0
        static DataMetaDataFacade()
        {
            GlobalEventSystemFacade.SubscribeToFlushEvent(args => Flush());

            _metaDataPath = PathUtil.Resolve(GlobalSettingsFacade.DataMetaDataDirectory);
            if (!C1Directory.Exists(_metaDataPath))
            {
                C1Directory.CreateDirectory(_metaDataPath);
            }

            UpdateFilenames();
        }
Пример #14
0
        /// <exclude />
        static LoggingService()
        {
            MethodInfo getRuntimeResourceStringMethodInfo = typeof(Environment)
                                                            .GetMethod("GetRuntimeResourceString", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(string) }, null);

            // NOTE: "Magic" strings, shouldn't be modified
            BeginOfInnerExceptionMarker = "---> ";
            EndOfInnerExceptionMarker   = Environment.NewLine + "   " +
                                          (string)getRuntimeResourceStringMethodInfo.Invoke(null, new object[] { "Exception_EndOfInnerExceptionStack" });

            ExceptionToStringInternal_MethodInfo = typeof(Exception).GetMethod("ToString", BindingFlags.Instance | BindingFlags.NonPublic);

            GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlush);
        }
Пример #15
0
        /// <exclude />
        public static void Application_End(object sender, EventArgs e)
        {
            if (RuntimeInformation.IsDebugBuild)
            {
                Log.LogInformation(_verboseLogEntryTitle, "AppDomain {0} ended at {1} in process {2}", AppDomain.CurrentDomain.Id, DateTime.Now.ToString("HH:mm:ss:ff"), Process.GetCurrentProcess().Id);
            }

            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
            {
                return;
            }


            using (ThreadDataManager.Initialize())
            {
                try
                {
                    CodeGenerationManager.ValidateCompositeGenerate(_startTime);
                    CodeGenerationManager.GenerateCompositeGeneratedAssembly();
                }
                catch (Exception ex)
                {
                    Log.LogCritical("Global.asax", "Error updating Composite.Generated.dll");
                    Log.LogCritical("Global.asax", ex);
                }

                try
                {
                    GlobalEventSystemFacade.PrepareForShutDown();
                    if (RuntimeInformation.IsDebugBuild)
                    {
                        LogShutDownReason();
                    }
                    GlobalEventSystemFacade.ShutDownTheSystem();

                    TempDirectoryFacade.OnApplicationEnd();
                }
                catch (Exception ex)
                {
                    Log.LogCritical("Global.asax", ex);

                    throw;
                }

                Log.LogVerbose("Global.asax", string.Format("--- Web Application End, {0} Id = {1}---",
                                                            DateTime.Now.ToLongTimeString(),
                                                            AppDomain.CurrentDomain.Id));
            }
        }
        private void step3CodeActivity_RefreshTree_ExecuteCode(object sender, EventArgs e)
        {
            if (this.GetBinding<bool>("ReloadConsoleOnCompletion"))
            {
                ConsoleMessageQueueFacade.Enqueue(new RebootConsoleMessageQueueItem(), null);
            }

            if (this.GetBinding<bool>("FlushOnCompletion"))
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }

            SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher();
            specificTreeRefresher.PostRefreshMesseges(new PackageElementProviderRootEntityToken());
        }
Пример #17
0
        public static void Initialize()
        {
            if (!_initialized)
            {
                lock (_lock)
                {
                    if (!_initialized)
                    {
                        GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);

                        AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

                        _initialized = true;
                    }
                }
            }
        }
Пример #18
0
        /// <exclude />
        public void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush)
        {
            Verify.ArgumentNotNullOrEmpty(providerName, "providerName");
            Verify.ArgumentNotNull(typeDescriptor, "typeDescriptor");

            typeDescriptor.Validate();

            using (var transactionScope = TransactionsFacade.CreateNewScope())
            {
                DataProviderPluginFacade.DropStore(providerName, typeDescriptor);
                DataMetaDataFacade.DeleteMetaData(typeDescriptor.DataTypeId);
                transactionScope.Complete();
            }

            if (makeAFlush)
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }
        }
Пример #19
0
        /// <exclude />
        public override void Uninstall()
        {
            Verify.IsNotNull(_dataTypeDescriptorsToDelete, "DynamicDataTypePackageFragmentUninstaller has not been validated");

            bool flushTheSystem = false;

            foreach (DataTypeDescriptor dataTypeDescriptor in _dataTypeDescriptorsToDelete)
            {
                Log.LogVerbose(this.GetType().Name, "Uninstalling the type '{0}'", dataTypeDescriptor);

                GeneratedTypesFacade.DeleteType(dataTypeDescriptor, false);
                flushTheSystem = true;
            }

            if (flushTheSystem)
            {
                GlobalEventSystemFacade.FlushTheSystem(true);
            }
        }
Пример #20
0
        public static void Initialize()
        {
            SubscribeToDataEvents();

            var cts  = new CancellationTokenSource();
            var task = Task.Run(() => WaitForWriteLockAndStartServiceBusListener(cts.Token));

            GlobalEventSystemFacade.SubscribeToPrepareForShutDownEvent(args =>
            {
                try
                {
                    cts.Cancel();
                    task.Wait(WaitingTimeForCancellationToFinishInMs);
                }
                catch (Exception ex)
                {
                    Log.LogError(nameof(SitemapEventRegistrator), ex);
                }
            });
        }
        public override IEnumerable <XElement> Install()
        {
            if (_updates == null)
            {
                throw new InvalidOperationException(GetType().Name + " has not been validated");
            }

            foreach (var kvp in _updates)
            {
                var oldDataTypeDescriptor = kvp.Key;
                var newDataTypeDescriptor = kvp.Value;

                var updateDescriptor = new UpdateDataTypeDescriptor(oldDataTypeDescriptor, newDataTypeDescriptor);

                GeneratedTypesFacade.UpdateType(updateDescriptor);
            }

            GlobalEventSystemFacade.FlushTheSystem();

            return(Configuration);
        }
Пример #22
0
        public static void Initialize()
        {
            if (_initialized)
            {
                return;
            }

            lock (_lock)
            {
                if (_initialized)
                {
                    return;
                }

                GlobalEventSystemFacade.SubscribeToFlushEvent(args => ClearAssemblyList());

                AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
                AppDomain.CurrentDomain.AssemblyLoad    += OnAssemblyLoad;

                _initialized = true;
            }
        }
Пример #23
0
        /// <exclude />
        public override IEnumerable <XElement> Install()
        {
            Verify.IsNotNull(_typesToInstall, "DataTypePackageFragmentInstaller has not been validated");

            string typeNames = string.Join(", ", _typesToInstall.Select(t => t.GetFullInterfaceName()));

            Log.LogVerbose(this.GetType().Name, "Installing types: '{0}'", typeNames);


            DynamicTypeManager.CreateStores(_typesToInstall, false);

            var typeElements = new List <XElement>();

            foreach (var dataTypeDescriptor in _typesToInstall)
            {
                var typeElement = new XElement("Type", new XAttribute("typeId", dataTypeDescriptor.DataTypeId));
                typeElements.Add(typeElement);
            }

            GlobalEventSystemFacade.FlushTheSystem(true);

            yield return(new XElement("Types", typeElements));
        }
        /// <exclude />
        public static void TransformConfiguration(Func <XDocument, bool> transformer)
        {
            using (GlobalInitializerFacade.CoreLockScope)
            {
                lock (_lock)
                {
                    XDocument document = XDocumentUtils.Load(ConfigurationServices.FileConfigurationSourcePath);

                    if (transformer(document))
                    {
                        ValidateConfigurationFile(document);

                        // Kill monitoring of file changes:
                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);
                        document.SaveToFile(ConfigurationServices.FileConfigurationSourcePath);
                        _configurationSource = new FileConfigurationSource(ConfigurationServices.FileConfigurationSourcePath);
                        // Kill monitoring of file changes:
                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);

                        GlobalEventSystemFacade.ShutDownTheSystem();
                    }
                }
            }
        }
Пример #25
0
        /// <exclude />
        public void CreateStores(string providerName, IReadOnlyCollection <DataTypeDescriptor> typeDescriptors, bool doFlush)
        {
            Verify.ArgumentNotNullOrEmpty(providerName, "providerName");
            Verify.ArgumentNotNull(typeDescriptors, "typeDescriptors");

            typeDescriptors.ForEach(d => d.Validate());

            using (var transactionScope = TransactionsFacade.CreateNewScope())
            {
                foreach (var typeDescriptor in typeDescriptors)
                {
                    DataMetaDataFacade.PersistMetaData(typeDescriptor);
                }

                DataProviderPluginFacade.CreateStores(providerName, typeDescriptors);

                transactionScope.Complete();
            }

            if (doFlush)
            {
                GlobalEventSystemFacade.FlushTheSystem();
            }
        }
Пример #26
0
 static WorkflowRuntimeProviderRegistry()
 {
     GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
 }
Пример #27
0
 static SerializationFacade()
 {
     GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
 }
Пример #28
0
 static EmptyDataClassTypeManager()
 {
     GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
 }
Пример #29
0
 static GlobalInitializerFacade()
 {
     GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
 }
Пример #30
0
        /// <exclude />
        public static void FatalResetTheSystem()
        {
            Log.LogWarning(LogTitle, "Unhandled error occurred, reinitializing the system!");

            ReinitializeTheSystem(delegate() { _fatalErrorFlushCount++; GlobalEventSystemFacade.FlushTheSystem(); });
        }