예제 #1
0
        private void StartManagers()
        {
            object          dummy;
            IClusterChannel channel = null;

            try
            {
                BlobStorageComponents.DataProvider     = Providers.Instance.BlobMetaDataProvider;
                BlobStorageComponents.ProviderSelector = Providers.Instance.BlobProviderSelector;

                ConsoleWrite("Initializing cache ... ");
                dummy = Cache.Count;
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting message channel ... ");
                channel = DistributedApplication.ClusterChannel;
                ConsoleWriteLine("ok.");

                ConsoleWrite("Sending greeting message ... ");
                new PingMessage(new string[0]).SendAsync(CancellationToken.None).GetAwaiter().GetResult();
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting NodeType system ... ");
                dummy = ActiveSchema.NodeTypes[0];
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting ContentType system ... ");
                dummy = ContentType.GetByName("GenericContent");
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting AccessProvider ... ");
                dummy = User.Current;
                ConsoleWriteLine("ok.");

                SnQuery.SetPermissionFilterFactory(Providers.Instance.PermissionFilterFactory);

                if (_settings.StartIndexingEngine)
                {
                    StartIndexingEngine();
                }
                else
                {
                    ConsoleWriteLine("IndexingEngine is not started.");
                }

                // switch on message processing after IndexingEngine was started.
                channel.AllowMessageProcessing = true;

                if (_settings.StartWorkflowEngine)
                {
                    StartWorkflowEngine();
                }
                else
                {
                    ConsoleWriteLine("Workflow subsystem is not started.");
                }

                ConsoleWrite("Loading string resources ... ");
                dummy = SenseNetResourceManager.Current;
                ConsoleWriteLine("ok.");

                serviceInstances = new List <ISnService>();
                foreach (var serviceType in TypeResolver.GetTypesByInterface(typeof(ISnService)))
                {
                    var service = (ISnService)Activator.CreateInstance(serviceType);
                    service.Start();
                    ConsoleWriteLine("Service started: ", serviceType.Name);
                    serviceInstances.Add(service);
                }

                // register this application in the task management component
                SnTaskManager.RegisterApplication();
            }
            catch
            {
                // If an error occoured, shut down the cluster channel.
                channel?.ShutDownAsync(CancellationToken.None).GetAwaiter().GetResult();

                throw;
            }
        }
예제 #2
0
        private void StartManagers()
        {
            object dummy;

            SenseNet.Communication.Messaging.IClusterChannel channel = null;

            try
            {
                ConsoleWrite("Initializing cache ... ");
                dummy = SenseNet.ContentRepository.DistributedApplication.Cache.Count;
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting message channel ... ");
                channel = SenseNet.ContentRepository.DistributedApplication.ClusterChannel;
                ConsoleWriteLine("ok.");

                ConsoleWrite("Sending greeting message ... ");
                (new PingMessage(new string[0])).Send();
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting NodeType system ... ");
                dummy = ActiveSchema.NodeTypes[0];
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting ContentType system ... ");
                dummy = SenseNet.ContentRepository.Schema.ContentType.GetByName("GenericContent");
                ConsoleWriteLine("ok.");

                ConsoleWrite("Starting AccessProvider ... ");
                dummy = User.Current;
                ConsoleWriteLine("ok.");

                if (_settings.StartLuceneManager)
                {
                    StartLucene();
                }
                else
                {
                    ConsoleWriteLine("LuceneManager is not started.");
                }

                // switch on message processing after LuceneManager was started
                channel.AllowMessageProcessing = true;

                SenseNet.Search.Indexing.IndexHealthMonitor.Start(_settings.Console);

                if (_settings.StartWorkflowEngine)
                {
                    StartWorkflowEngine();
                }
                else
                {
                    ConsoleWriteLine("Workflow subsystem is not started.");
                }

                ConsoleWrite("Loading string resources ... ");
                dummy = SenseNetResourceManager.Current;
                ConsoleWriteLine("ok.");

                serviceInstances = new List <ISnService>();
                foreach (var serviceType in TypeResolver.GetTypesByInterface(typeof(ISnService)))
                {
                    var service = (ISnService)Activator.CreateInstance(serviceType);
                    service.Start();
                    ConsoleWriteLine("Service started: ", serviceType.Name);
                    serviceInstances.Add(service);
                }

                // register this application in the task management component
                SnTaskManager.RegisterApplication();
            }
            catch
            {
                // If an error occoured, shut down the cluster channel.
                if (channel != null)
                {
                    channel.ShutDown();
                }

                throw;
            }
        }