// Token: 0x060002CE RID: 718 RVA: 0x00011788 File Offset: 0x0000F988
        public void OnJobFinished(FinishedJobInfo[] jobFinishedInfo)
        {
            IServiceStateProvider serviceStateProvider = this.parentService;

            if (serviceStateProvider != null && serviceStateProvider.IsServiceDown)
            {
                JobSchedulerEventServicev2.log.InfoFormat("Parent Service Engine is in an invalid state.  Job results will be discarded.", Array.Empty <object>());
                return;
            }
            this.resultsManager.AddJobResults(jobFinishedInfo);
            for (FinishedJobInfo jobResult = this.resultsManager.GetJobResult(); jobResult != null; jobResult = this.resultsManager.GetJobResult())
            {
                try
                {
                    this.ProcessJobResult(jobResult);
                }
                catch (Exception ex)
                {
                    JobSchedulerEventServicev2.log.Error("Error processing job", ex);
                }
                finally
                {
                    this.resultsManager.FinishProcessingJobResult(jobResult);
                }
            }
        }
        // Token: 0x060002CC RID: 716 RVA: 0x00011710 File Offset: 0x0000F910
        public JobSchedulerEventServicev2(IServiceStateProvider parentService)
        {
            this.parentService = parentService;
            JobResultsManagerV2 jobResultsManagerV = this.resultsManager;

            jobResultsManagerV.JobFailure = (JobResultsManagerV2.JobFailureDelegate)Delegate.Combine(jobResultsManagerV.JobFailure, new JobResultsManagerV2.JobFailureDelegate(this.ProcessJobFailure));
        }
コード例 #3
0
        public NoticeModel(
            VersionConfiguration versionConfig,
            IServiceStateProvider serviceStateProvider,
            LocationsModel locationsModel,
            ServiceModel serviceModel
            )
        {
            this.IsRelevant             = versionConfig.ExistingVersionInstalled;
            this.LocationsModel         = locationsModel;
            this.ServiceModel           = serviceModel;
            this.Header                 = "Notice";
            this.ExistingVersion        = versionConfig.UpgradeFromVersion;
            this.CurrentVersion         = versionConfig.CurrentVersion;
            this.ReadMoreOnUpgrades     = ReactiveCommand.Create();
            this.ReadMoreOnXPackOpening = ReactiveCommand.Create();
            this._serviceStateProvider  = serviceStateProvider;
            this.Refresh();

            if (!string.IsNullOrWhiteSpace(this.CurrentVersion?.Prerelease))
            {
                if (versionConfig.ExistingVersionInstalled)
                {
                    this.UpgradeTextHeader = TextResources.NoticeModel_ToPrerelease_Header;
                    this.UpgradeText       = TextResources.NoticeModel_ToPrerelease;
                }
                else
                {
                    this.UpgradeTextHeader = TextResources.NoticeModel_Prerelease_Header;
                    this.UpgradeText       = TextResources.NoticeModel_Prerelease;
                }
                this.IsRelevant = true;                 //show prerelease notice always
            }
            else if (!string.IsNullOrWhiteSpace(this.ExistingVersion?.Prerelease))
            {
                this.UpgradeTextHeader = TextResources.NoticeModel_FromPrerelease_Header;
                this.UpgradeText       = TextResources.NoticeModel_FromPrerelease;
                this.IsRelevant        = true;          //show prerelease notice always
            }
            else
            {
                var v      = Enum.GetName(typeof(VersionChange), versionConfig.VersionChange);
                var d      = Enum.GetName(typeof(InstallationDirection), versionConfig.InstallationDirection);
                var prefix = nameof(NoticeModel) + "_" + v + d;
                this.UpgradeTextHeader = TextResources.ResourceManager.GetString(prefix + "_Header");
                this.UpgradeText       = TextResources.ResourceManager.GetString(prefix);
            }

            if (!string.IsNullOrWhiteSpace(this.UpgradeTextHeader))
            {
                this.UpgradeTextHeader = string.Format(this.UpgradeTextHeader, versionConfig.UpgradeFromVersion, versionConfig.CurrentVersion);
            }

            this.ShowOpeningXPackBanner       = this.ExistingVersion < XPackModel.XPackInstalledByDefaultVersion;
            this.ShowUpgradeDocumentationLink = versionConfig.VersionChange == VersionChange.Major || versionConfig.VersionChange == VersionChange.Minor;

            this.ExistingVersionInstalled = versionConfig.ExistingVersionInstalled;
        }
コード例 #4
0
 internal OneTimeJobManager(
     IServiceStateProvider parent,
     Func <IJobSchedulerHelper> jobSchedulerHelperFactory,
     TimeSpan jobTimeoutTolerance)
     : base(parent)
 {
     this.jobSchedulerHelperFactory = jobSchedulerHelperFactory;
     this.jobTimeoutTolerance       = jobTimeoutTolerance;
 }
コード例 #5
0
 public ClosingModel(
     SemVersion currentVersion,
     bool isUpgrade,
     IObservable <string> hostName,
     IObservable <string> wixLogFile,
     IObservable <string> kibanaLog,
     IServiceStateProvider serviceStateProvider)
     : base(currentVersion, isUpgrade, hostName, wixLogFile, kibanaLog, serviceStateProvider)
 {
     this.Refresh();
 }
コード例 #6
0
        public JobSchedulerEventServicev2(IServiceStateProvider parentService)
        {
            this.parentService = parentService;
            JobResultsManagerV2 resultsManager = this.resultsManager;
            // ISSUE: variable of the null type
            __Null jobFailure = resultsManager.JobFailure;
            JobSchedulerEventServicev2 schedulerEventServicev2 = this;

            // ISSUE: virtual method pointer
            JobResultsManagerV2.JobFailureDelegate jobFailureDelegate = new JobResultsManagerV2.JobFailureDelegate((object)schedulerEventServicev2, __vmethodptr(schedulerEventServicev2, ProcessJobFailure));
            resultsManager.JobFailure = (__Null)Delegate.Combine((Delegate)jobFailure, (Delegate)jobFailureDelegate);
        }
コード例 #7
0
 public ClosingModel(
     SemVersion currentVersion,
     bool isUpgrade,
     IObservable <string> hostName,
     IObservable <string> wixLogFile,
     IObservable <string> elasticsearchLog,
     IServiceStateProvider serviceStateProvider)
     : base(currentVersion, isUpgrade, hostName, wixLogFile, elasticsearchLog, serviceStateProvider)
 {
     this.OpenFindYourClient = ReactiveCommand.Create();
     this.Refresh();
 }
コード例 #8
0
        public NoticeModel(
            VersionConfiguration versionConfig,
            IServiceStateProvider serviceStateProvider,
            LocationsModel locationsModel,
            ServiceModel serviceModel
            )
        {
            this.IsRelevant         = versionConfig.ExistingVersionInstalled;
            this.LocationsModel     = locationsModel;
            this.ServiceModel       = serviceModel;
            this.Header             = "Notice";
            this.ExistingVersion    = versionConfig.ExistingVersion;
            this.CurrentVersion     = versionConfig.CurrentVersion;
            this.ReadMoreOnUpgrades = ReactiveCommand.Create();

            var e = versionConfig.ExistingVersion;
            var c = versionConfig.CurrentVersion;

            if (!string.IsNullOrWhiteSpace(c?.Prerelease))
            {
                this.UpgradeTextHeader = TextResources.NoticeModel_ToPrerelease_Header;
                this.UpgradeText       = TextResources.NoticeModel_ToPrerelease;
                this.IsRelevant        = true;          //show prerelease notice always
            }
            else if (!string.IsNullOrWhiteSpace(e?.Prerelease))
            {
                this.UpgradeTextHeader = TextResources.NoticeModel_FromPrerelease_Header;
                this.UpgradeText       = TextResources.NoticeModel_FromPrerelease;
                this.IsRelevant        = true;          //show prerelease notice always
            }
            else
            {
                var v      = Enum.GetName(typeof(VersionChange), versionConfig.VersionChange);
                var d      = Enum.GetName(typeof(InstallationDirection), versionConfig.InstallationDirection);
                var prefix = nameof(NoticeModel) + "_" + v + d;
                this.UpgradeTextHeader = TextResources.ResourceManager.GetString(prefix + "_Header");
                this.UpgradeText       = TextResources.ResourceManager.GetString(prefix);
            }
            // TODO: We should show the upgrade notice, even for a patch upgrade.
            if (this.IsRelevant &&
                versionConfig.VersionChange == VersionChange.Patch &&
                versionConfig.InstallationDirection == InstallationDirection.Up)
            {
                this.IsRelevant = false;
            }

            this.ExistingVersionInstalled = versionConfig.ExistingVersionInstalled;
            this.InstalledAsService       = serviceStateProvider.SeesService;
            this.Refresh();
        }
コード例 #9
0
 protected ClosingModelBase(
     SemVersion currentVersion,
     bool isUpgrade,
     IObservable <string> hostName,
     IObservable <string> wixLogFile,
     IObservable <string> productLog,
     IServiceStateProvider serviceStateProvider)
 {
     this.Header               = "";
     this.CurrentVersion       = currentVersion;
     this.Host                 = hostName;
     this.IsUpgrade            = isUpgrade;
     this.WixLogFile           = wixLogFile;
     this.ServiceStateProvider = serviceStateProvider;
     this.OpenReference        = ReactiveCommand.Create();
     this.OpenGettingStarted   = ReactiveCommand.Create();
     this.OpenInstallationLog  = ReactiveCommand.Create();
     this.OpenIssues           = ReactiveCommand.Create();
     this.OpenProduct          = ReactiveCommand.Create();
     this.OpenProductLog       = ReactiveCommand.Create();
     this.ProductLog           = productLog;
 }
コード例 #10
0
        public ServiceModel(IServiceStateProvider serviceStateProvider, VersionConfiguration versionConfig)
        {
            this._existingVersionInstalled     = versionConfig.ExistingVersionInstalled;
            this.PreviouslyInstalledAsAService = serviceStateProvider.SeesService;
            this.IsRelevant = !this._existingVersionInstalled || (this._existingVersionInstalled && !this.PreviouslyInstalledAsAService);
            this.Header     = "Service";
            this.Refresh();
            this.WhenAny(vm => vm.User, vm => vm.Password,
                         (u, p) => string.IsNullOrEmpty(u.Value) && string.IsNullOrEmpty(p.Value))
            .Subscribe(b =>
            {
                if (b)
                {
                    return;
                }
                this.UseExistingUser   = true;
                this.UseLocalSystem    = false;
                this.UseNetworkService = false;
            });

            this.WhenAny(vm => vm.InstallAsService, i => i.Value)
            .Subscribe(b =>
            {
                if (!b)
                {
                    _internalRefresh = true;
                    this.Refresh();
                }
            });

            this.ValidateCredentials = ReactiveCommand.CreateAsyncTask(async _ => {
                this.ValidatingCredentials = true;
                var valid = await Task.Run(() => this.Validator.ValidateCredentials(this.User, this.Password));
                this.ManualValidationPassed = valid;
                this.ValidatingCredentials  = false;
            });
        }
コード例 #11
0
 public ClosingModel(
     SemVersion currentVersion,
     bool isUpgrade,
     IObservable <string> hostName,
     IObservable <string> wixLogFile,
     IObservable <string> elasticsearchLog,
     IServiceStateProvider serviceStateProvider)
 {
     this.Header               = "";
     this.CurrentVersion       = currentVersion;
     this.IsUpgrade            = isUpgrade;
     this.Host                 = hostName;
     this.WixLogFile           = wixLogFile;
     this.ElasticsearchLog     = elasticsearchLog;
     this.OpenElasticsearch    = ReactiveCommand.Create();
     this.OpenReference        = ReactiveCommand.Create();
     this.OpenGettingStarted   = ReactiveCommand.Create();
     this.OpenFindYourClient   = ReactiveCommand.Create();
     this.OpenIssues           = ReactiveCommand.Create();
     this.OpenInstallationLog  = ReactiveCommand.Create();
     this.OpenElasticsearchLog = ReactiveCommand.Create();
     this.ServiceStateProvider = serviceStateProvider;
     this.Refresh();
 }
コード例 #12
0
        public ElasticsearchInstallationModel(
            IWixStateProvider wixStateProvider,
            JavaConfiguration javaConfiguration,
            ElasticsearchEnvironmentConfiguration elasticsearchEnvironmentConfiguration,
            IServiceStateProvider serviceStateProvider,
            IPluginStateProvider pluginStateProvider,
            ElasticsearchYamlConfiguration yamlConfiguration,
            LocalJvmOptionsConfiguration localJvmOptions,
            TempDirectoryConfiguration tempDirectoryConfiguration,
            IFileSystem fileSystem,
            ISession session,
            string[] args) : base(wixStateProvider, session, args)
        {
            this.JavaConfiguration = javaConfiguration ?? throw new ArgumentNullException(nameof(javaConfiguration));
            this.ElasticsearchEnvironmentConfiguration = elasticsearchEnvironmentConfiguration;
            this.TempDirectoryConfiguration            = tempDirectoryConfiguration;
            this._yamlConfiguration = yamlConfiguration;

            var versionConfig = new VersionConfiguration(wixStateProvider, this.Session.IsInstalled);

            this.SameVersionAlreadyInstalled = versionConfig.SameVersionAlreadyInstalled;
            this.UnInstalling           = this.Session.IsUninstalling;
            this.InstallationInProgress = this._wixStateProvider.InstallationInProgress;
            this.Installing             = this.Session.IsInstalling;
            this.Installed = this.Session.IsInstalled;
            this.Upgrading = this.Session.IsUpgrading;
            this.HigherVersionAlreadyInstalled = versionConfig.HigherVersionAlreadyInstalled;

            this.LocationsModel     = new LocationsModel(elasticsearchEnvironmentConfiguration, yamlConfiguration, versionConfig, fileSystem);
            this.ServiceModel       = new ServiceModel(serviceStateProvider, versionConfig);
            this.NoticeModel        = new NoticeModel(versionConfig, serviceStateProvider, this.LocationsModel, this.ServiceModel);
            this.ConfigurationModel = new ConfigurationModel(yamlConfiguration, localJvmOptions);

            var pluginDependencies = this.WhenAnyValue(
                vm => vm.NoticeModel.ExistingVersionInstalled,
                vm => vm.LocationsModel.PreviousInstallationDirectory,
                vm => vm.LocationsModel.ConfigDirectory
                );

            this.PluginsModel = new PluginsModel(pluginStateProvider, versionConfig.CurrentVersion, pluginDependencies);
            var upgradeFromXPackPlugin = this.WhenAnyValue(vm => vm.PluginsModel.PreviousInstallationHasXPack);

            var canAutomaticallySetup = this.WhenAnyValue(vm => vm.ServiceModel.StartAfterInstall, vm => vm.ServiceModel.InstallAsService)
                                        .Select(t => t.Item1 && t.Item2);

            this.XPackModel = new XPackModel(versionConfig, canAutomaticallySetup, upgradeFromXPackPlugin);

            var isUpgrade   = versionConfig.InstallationDirection == InstallationDirection.Up;
            var observeHost = this.WhenAnyValue(vm => vm.ConfigurationModel.NetworkHost, vm => vm.ConfigurationModel.HttpPort,
                                                (h, p) => $"http://{(string.IsNullOrWhiteSpace(h) ? "localhost" : h)}:{p}");
            var observeInstallationLog  = this.WhenAnyValue(vm => vm.MsiLogFileLocation);
            var observeElasticsearchLog = this.WhenAnyValue(vm => vm.LocationsModel.ElasticsearchLog);

            this.ClosingModel = new ClosingModel(wixStateProvider.CurrentVersion, isUpgrade, observeHost, observeInstallationLog, observeElasticsearchLog, serviceStateProvider);

            this.AllSteps.AddRange(new List <IStep>
            {
                this.NoticeModel,
                this.LocationsModel,
                this.ServiceModel,
                this.ConfigurationModel,
                this.PluginsModel,
                this.XPackModel,
                this.ClosingModel
            });
            this.AllSteps.ChangeTrackingEnabled = true;

            var observeValidationChanges = this.WhenAny(
                vm => vm.NoticeModel.ValidationFailures,
                vm => vm.LocationsModel.ValidationFailures,
                vm => vm.ConfigurationModel.ValidationFailures,
                vm => vm.PluginsModel.ValidationFailures,
                vm => vm.XPackModel.ValidationFailures,
                vm => vm.ServiceModel.ValidationFailures,
                vm => vm.ClosingModel.ValidationFailures,
                vm => vm.TabSelectedIndex,
                (welcome, locations, configuration, plugins, xpack, service, install, index) =>
            {
                var firstInvalidScreen = this.Steps.FirstOrDefault(s => !s.IsValid) ?? this.ClosingModel;
                return(firstInvalidScreen);
            });

            observeValidationChanges
            .Subscribe(firstInvalidStep =>
            {
                this.TabFirstInvalidIndex = this.Steps
                                            .Select((s, i) => new { s, i = (int?)i })
                                            .Where(t => !t.s.IsValid)
                                            .Select(t => t.i)
                                            .FirstOrDefault();
                this.FirstInvalidStepValidationFailures = firstInvalidStep.ValidationFailures;
            });

            this.WhenAny(
                vm => vm.NoticeModel.IsValid,
                vm => vm.LocationsModel.IsValid,
                vm => vm.ConfigurationModel.IsValid,
                vm => vm.PluginsModel.IsValid,
                vm => vm.XPackModel.IsValid,
                vm => vm.ServiceModel.IsValid,
                vm => vm.ClosingModel.IsValid,
                (welcome, locations, configuration, plugins, xpack, service, install) =>
            {
                var firstInvalidScreen = this.Steps.Select((s, i) => new { s, i }).FirstOrDefault(s => !s.s.IsValid);
                return(firstInvalidScreen?.i ?? (this.Steps.Count - 1));
            })
            .Subscribe(selected =>
            {
                this.TabSelectionMax = selected;
                //if one of the steps prior to the current selection is invalid jump back
                if (this.TabSelectedIndex > this.TabSelectionMax)
                {
                    this.TabSelectedIndex = this.TabSelectionMax;
                }

                this.FirstInvalidStepValidationFailures = this.ActiveStep.ValidationFailures;
            });

            this.Steps.Changed.Subscribe(e =>
            {
                var firstInvalidScreen = this.Steps.Select((s, i) => new { s, i }).FirstOrDefault(s => !s.s.IsValid);
                var selectedTabIndex   = firstInvalidScreen?.i ?? (this.Steps.Count - 1);
                this.TabSelectionMax   = selectedTabIndex;

                //if one of the steps prior to the current selection is invalid jump back
                if (this.TabSelectedIndex > this.TabSelectionMax)
                {
                    this.TabSelectedIndex = this.TabSelectionMax;
                }

                this.FirstInvalidStepValidationFailures = this.ActiveStep.ValidationFailures;
            });

            this.Install = ReactiveCommand.CreateAsyncTask(observeValidationChanges.Select(s => s.IsValid), _ =>
            {
                this.TabSelectedIndex += 1;
                return(this.InstallUITask());
            });

            this.Install.Subscribe(installationObservable =>
            {
                installationObservable.Subscribe(installed => this.ClosingModel.Installed = installed);
            });

            this.Refresh();
            //validate the first stab explicitly on constructing this
            //main viewmodel. WPF triggers a validation already
            this.ParsedArguments = new ElasticsearchArgumentParser(
                this.AllSteps.Cast <IValidatableReactiveObject>().Concat(new[] { this }).ToList(), args);

            this.ActiveStep.Validate();
        }
コード例 #13
0
 public StopServiceTask(KibanaInstallationModel model, ISession session, IFileSystem fileSystem, IServiceStateProvider serviceConfig)
     : base(model, session, fileSystem)
 {
     this.ServiceStateProvider = serviceConfig;
 }
コード例 #14
0
 public StopServiceTask(string[] args, ISession session) : base(args, session)
 {
     this.ServiceStateProvider = new ServiceStateProvider(session, "Kibana");
 }
コード例 #15
0
 public InstallServiceTask(ElasticsearchInstallationModel model, ISession session, IFileSystem fileSystem, IServiceStateProvider serviceConfig)
     : base(model, session, fileSystem)
 {
     this.ServiceStateProvider = serviceConfig;
 }
コード例 #16
0
        public ElasticsearchInstallationModel(
            IWixStateProvider wixStateProvider,
            JavaConfiguration javaConfiguration,
            ElasticsearchEnvironmentConfiguration elasticsearchEnvironmentConfiguration,
            IServiceStateProvider serviceStateProvider,
            IPluginStateProvider pluginStateProvider,
            ElasticsearchYamlConfiguration yamlConfiguration,
            LocalJvmOptionsConfiguration localJvmOptions,
            ISession session,
            string[] args
            ) : base(wixStateProvider, session, args)
        {
            this.JavaConfiguration = javaConfiguration ?? throw new ArgumentNullException(nameof(javaConfiguration));
            this.ElasticsearchEnvironmentConfiguration = elasticsearchEnvironmentConfiguration;
            this._yamlConfiguration = yamlConfiguration;

            var versionConfig = new VersionConfiguration(wixStateProvider);

            this.SameVersionAlreadyInstalled   = versionConfig.SameVersionAlreadyInstalled;
            this.HigherVersionAlreadyInstalled = versionConfig.HigherVersionAlreadyInstalled;

            this.LocationsModel     = new LocationsModel(elasticsearchEnvironmentConfiguration, yamlConfiguration, versionConfig);
            this.NoticeModel        = new NoticeModel(versionConfig, serviceStateProvider, this.LocationsModel);
            this.ServiceModel       = new ServiceModel(serviceStateProvider, versionConfig);
            this.ConfigurationModel = new ConfigurationModel(yamlConfiguration, localJvmOptions);

            var pluginDependencies = this.WhenAnyValue(
                vm => vm.ConfigurationModel.IngestNode,
                vm => vm.NoticeModel.AlreadyInstalled,
                vm => vm.LocationsModel.InstallDir,
                vm => vm.LocationsModel.ConfigDirectory
                );

            this.PluginsModel = new PluginsModel(pluginStateProvider, pluginDependencies);

            var isUpgrade   = versionConfig.InstallationDirection == InstallationDirection.Up;
            var observeHost = this.WhenAnyValue(vm => vm.ConfigurationModel.NetworkHost, vm => vm.ConfigurationModel.HttpPort,
                                                (h, p) => $"http://{(string.IsNullOrWhiteSpace(h) ? "localhost" : h)}:{p}");
            var observeInstallationLog  = this.WhenAnyValue(vm => vm.MsiLogFileLocation);
            var observeElasticsearchLog = this.WhenAnyValue(vm => vm.LocationsModel.ElasticsearchLog);
            var observeInstallXPack     = this.PluginsModel.AvailablePlugins.ItemChanged
                                          .Where(x => x.PropertyName == nameof(Plugin.Selected) && x.Sender.PluginType == PluginType.XPack)
                                          .Select(x => x.Sender.Selected);

            this.ClosingModel = new ClosingModel(wixStateProvider.CurrentVersion, isUpgrade, observeHost, observeInstallationLog,
                                                 observeElasticsearchLog, observeInstallXPack, serviceStateProvider);
            this.AllSteps = new ReactiveList <IStep>
            {
                this.NoticeModel,
                this.LocationsModel,
                this.ServiceModel,
                this.ConfigurationModel,
                this.PluginsModel,
                this.ClosingModel
            };
            this.Steps = this.AllSteps.CreateDerivedCollection(x => x, x => x.IsRelevant);

            var observeValidationChanges = this.WhenAny(
                vm => vm.NoticeModel.ValidationFailures,
                vm => vm.LocationsModel.ValidationFailures,
                vm => vm.ConfigurationModel.ValidationFailures,
                vm => vm.PluginsModel.ValidationFailures,
                vm => vm.ServiceModel.ValidationFailures,
                vm => vm.ClosingModel.ValidationFailures,
                vm => vm.TabSelectedIndex,
                (welcome, locations, configuration, plugins, service, install, index) =>
            {
                var firstInvalidScreen = this.Steps.FirstOrDefault(s => !s.IsValid) ?? this.ClosingModel;
                return(firstInvalidScreen);
            });

            observeValidationChanges
            .Subscribe(selected =>
            {
                var step     = this.Steps[this.TabSelectedIndex];
                var failures = step.ValidationFailures;
                this.CurrentStepValidationFailures = selected.ValidationFailures;
            });

            this.WhenAny(
                vm => vm.NoticeModel.IsValid,
                vm => vm.LocationsModel.IsValid,
                vm => vm.ConfigurationModel.IsValid,
                vm => vm.PluginsModel.IsValid,
                vm => vm.ServiceModel.IsValid,
                vm => vm.ClosingModel.IsValid,
                (welcome, locations, configuration, plugins, service, install) =>
            {
                var firstInvalidScreen = this.Steps.Select((s, i) => new { s, i }).FirstOrDefault(s => !s.s.IsValid);
                return(firstInvalidScreen?.i ?? (this.Steps.Count - 1));
            })
            .Subscribe(selected =>
            {
                this.TabSelectionMax = selected;
                //if one of the steps prior to the current selection is invalid jump back
                if (this.TabSelectedIndex > this.TabSelectionMax)
                {
                    this.TabSelectedIndex = this.TabSelectionMax;
                }

                this.CurrentStepValidationFailures = this.ActiveStep.ValidationFailures;
            });

            this.Install = ReactiveCommand.CreateAsyncTask(observeValidationChanges.Select(s => s.IsValid), _ =>
            {
                this.TabSelectedIndex += 1;
                return(this.InstallUITask());
            });

            this.Install.Subscribe(installationObservable =>
            {
                installationObservable.Subscribe(installed => this.ClosingModel.Installed = installed);
            });

            this.Refresh();
            //validate the first stab explicitly on constructing this
            //main viewmodel. WPF triggers a validation already
            this.ParsedArguments = new ElasticsearchArgumentParser(
                this.AllSteps.Cast <IValidatableReactiveObject>().Concat(new[] { this }).ToList(), args);

            this.ActiveStep.Validate();
        }
コード例 #17
0
 public UninstallServiceTask(string[] args, ISession session) : base(args, session)
 {
     this.ServiceStateProvider = new ServiceStateProvider(session);
 }
コード例 #18
0
        public InstallationModel(
            IWixStateProvider wixStateProvider,
            JavaConfiguration javaConfiguration,
            IElasticsearchEnvironmentStateProvider environmentStateProvider,
            IServiceStateProvider serviceStateProvider,
            IPluginStateProvider pluginStateProvider,
            ElasticsearchYamlConfiguration yamlConfiguration,
            LocalJvmOptionsConfiguration localJvmOptions,
            ISession session,
            string[] args
            )
        {
            this.Session = session;

            if (wixStateProvider == null)
            {
                throw new ArgumentNullException(nameof(wixStateProvider));
            }
            if (javaConfiguration == null)
            {
                throw new ArgumentNullException(nameof(javaConfiguration));
            }

            this._wixStateProvider             = wixStateProvider;
            this.JavaConfiguration             = javaConfiguration;
            this.ElasticsearchEnvironmentState = environmentStateProvider;
            this._yamlConfiguration            = yamlConfiguration;

            var versionConfig = new VersionConfiguration(wixStateProvider);

            this.SameVersionAlreadyInstalled   = versionConfig.SameVersionAlreadyInstalled;
            this.HigherVersionAlreadyInstalled = versionConfig.HigherVersionAlreadyInstalled;

            this.LocationsModel     = new LocationsModel(environmentStateProvider, yamlConfiguration, versionConfig);
            this.NoticeModel        = new NoticeModel(versionConfig, serviceStateProvider, this.LocationsModel);
            this.ServiceModel       = new ServiceModel(serviceStateProvider, versionConfig);
            this.ConfigurationModel = new ConfigurationModel(yamlConfiguration, localJvmOptions);

            var pluginDependencies = this.WhenAnyValue(
                vm => vm.ConfigurationModel.IngestNode,
                vm => vm.NoticeModel.AlreadyInstalled,
                vm => vm.LocationsModel.InstallDir,
                vm => vm.LocationsModel.ConfigDirectory
                );

            this.PluginsModel = new PluginsModel(pluginStateProvider, pluginDependencies);

            var observeHost = this.WhenAnyValue(vm => vm.ConfigurationModel.NetworkHost, vm => vm.ConfigurationModel.HttpPort,
                                                (h, p) => $"http://{(string.IsNullOrWhiteSpace(h) ? "localhost" : h)}:{p}");
            var observeLog = this.WhenAnyValue(vm => vm.MsiLogFileLocation);
            var observeElasticsearchLog = this.WhenAnyValue(vm => vm.LocationsModel.ElasticsearchLog);

            var isUpgrade = versionConfig.InstallationDirection == InstallationDirection.Up;

            this.ClosingModel = new ClosingModel(wixStateProvider.CurrentVersion, isUpgrade, observeHost, observeLog, observeElasticsearchLog, serviceStateProvider);

            this.AllSteps = new ReactiveList <IStep>
            {
                this.NoticeModel,
                this.LocationsModel,
                this.ServiceModel,
                this.ConfigurationModel,
                this.PluginsModel,
                this.ClosingModel
            };
            this.Steps = this.AllSteps.CreateDerivedCollection(x => x, x => x.IsRelevant);

            this.NextButtonText = TextResources.SetupView_NextText;

            var canMoveForwards = this.WhenAny(vm => vm.TabSelectedIndex, vm => vm.TabSelectionMax,
                                               (i, max) => i.GetValue() < max.GetValue());

            this.Next = ReactiveCommand.Create(canMoveForwards);
            this.Next.Subscribe(i =>
            {
                this.TabSelectedIndex = Math.Min(this.Steps.Count - 1, this.TabSelectedIndex + 1);
            });

            var canMoveBackwards = this.WhenAny(vm => vm.TabSelectedIndex, (i) => i.GetValue() > 0);

            this.Back = ReactiveCommand.Create(canMoveBackwards);
            this.Back.Subscribe(i =>
            {
                this.TabSelectedIndex = Math.Max(0, this.TabSelectedIndex - 1);
            });

            this.Help                  = ReactiveCommand.Create();
            this.ShowLicenseBlurb      = ReactiveCommand.Create();
            this.ShowCurrentStepErrors = ReactiveCommand.Create();
            this.RefreshCurrentStep    = ReactiveCommand.Create();
            this.RefreshCurrentStep.Subscribe(x => { this.Steps[this.TabSelectedIndex].Refresh(); });
            this.Exit = ReactiveCommand.Create();

            var observeValidationChanges = this.WhenAny(
                vm => vm.NoticeModel.ValidationFailures,
                vm => vm.LocationsModel.ValidationFailures,
                vm => vm.ConfigurationModel.ValidationFailures,
                vm => vm.PluginsModel.ValidationFailures,
                vm => vm.ServiceModel.ValidationFailures,
                vm => vm.ClosingModel.ValidationFailures,
                vm => vm.TabSelectedIndex,
                (welcome, locations, configuration, plugins, service, install, index) =>
            {
                var firstInvalidScreen = this.Steps.FirstOrDefault(s => !s.IsValid) ?? this.ClosingModel;
                return(firstInvalidScreen);
            });
            var canInstall = observeValidationChanges.Select(s => s.IsValid);

            this.Install = ReactiveCommand.CreateAsyncTask(canInstall, _ =>
            {
                this.TabSelectedIndex += 1;
                return(this.InstallUITask());
            });

            this.Install.Subscribe(installationObservable =>
            {
                installationObservable.Subscribe(installed =>
                {
                    this.ClosingModel.Installed = installed;
                });
            });


            this.WhenAny(vm => vm.TabSelectedIndex, v => v.GetValue())
            .Subscribe(i =>
            {
                var c = this.Steps.Count;
                if (i == (c - 1))
                {
                    this.NextButtonText = TextResources.SetupView_ExitText;
                }
                else if (i == (c - 2))
                {
                    this.NextButtonText = TextResources.SetupView_InstallText;
                }
                else
                {
                    this.NextButtonText = TextResources.SetupView_NextText;
                }
            });


            observeValidationChanges
            .Subscribe(selected =>
            {
                var step     = this.Steps[this.TabSelectedIndex];
                var failures = step.ValidationFailures;
                this.CurrentStepValidationFailures = selected.ValidationFailures;
            });


            this.WhenAny(
                vm => vm.NoticeModel.IsValid,
                vm => vm.LocationsModel.IsValid,
                vm => vm.ConfigurationModel.IsValid,
                vm => vm.PluginsModel.IsValid,
                vm => vm.ServiceModel.IsValid,
                vm => vm.ClosingModel.IsValid,
                (welcome, locations, configuration, plugins, service, install) =>
            {
                var firstInvalidScreen = this.Steps.Select((s, i) => new { s, i }).FirstOrDefault(s => !s.s.IsValid);
                return(firstInvalidScreen?.i ?? (this.Steps.Count - 1));
            })
            .Subscribe(selected =>
            {
                this.TabSelectionMax = selected;
                //if one of the steps prior to the current selection is invalid jump back
                if (this.TabSelectedIndex > this.TabSelectionMax)
                {
                    this.TabSelectedIndex = this.TabSelectionMax;
                }

                this.CurrentStepValidationFailures = this.ActiveStep.ValidationFailures;
            });

            this.WhenAnyValue(view => view.ValidationFailures)
            .Subscribe(failures =>
            {
                this.PrequisiteFailures = (failures ?? Enumerable.Empty <ValidationFailure>())
                                          .Where(v => _prerequisiteProperties.Contains(v.PropertyName))
                                          .ToList();
            });

            this.Refresh();
            //validate the first stab explicitly on constructing this
            //main viewmodel. WPF triggers a validation already
            this.ParsedArguments = new InstallationModelArgumentParser(this.AllSteps.Cast <IValidatableReactiveObject>().Concat(new[] { this }).ToList(), args);

            this.ActiveStep.Validate();
        }
コード例 #19
0
 public InstallServiceTask(string[] args, ISession session) : base(args, session)
 {
     this.ServiceStateProvider = new ServiceStateProvider(session, "Elasticsearch");
 }
コード例 #20
0
        public KibanaInstallationModel(
            IWixStateProvider wixStateProvider,
            IServiceStateProvider serviceStateProvider,
            IPluginStateProvider pluginStateProvider,
            IKibanaEnvironmentStateProvider environmentStateProvider,
            ISession session,
            string[] args
            ) : base(wixStateProvider, session, args)
        {
            var versionConfig = new VersionConfiguration(wixStateProvider, this.Session.IsInstalled);

            this.KibanaEnvironmentState = environmentStateProvider;

            this.LocationsModel     = new LocationsModel(versionConfig);
            this.NoticeModel        = new NoticeModel(versionConfig, serviceStateProvider, this.LocationsModel);
            this.ServiceModel       = new ServiceModel(serviceStateProvider, versionConfig);
            this.ConfigurationModel = new ConfigurationModel();
            this.ConnectingModel    = new ConnectingModel();
            var pluginDependencies = this.WhenAnyValue(
                vm => vm.NoticeModel.AlreadyInstalled,
                vm => vm.LocationsModel.InstallDir,
                vm => vm.LocationsModel.ConfigDirectory
                );

            this.PluginsModel = new PluginsModel(pluginStateProvider, pluginDependencies);

            var isUpgrade   = versionConfig.InstallationDirection == InstallationDirection.Up;
            var observeHost = this.WhenAnyValue(x => x.ConfigurationModel.HostName, x => x.ConfigurationModel.HttpPort,
                                                (h, p) => $"http://{(string.IsNullOrWhiteSpace(h) ? "localhost" : h)}:{p}");
            var observeInstallationLog = this.WhenAnyValue(vm => vm.MsiLogFileLocation);
            var observeKibanaLog       = this.WhenAnyValue(vm => vm.LocationsModel.KibanaLog);
            var observeInstallXPack    = this.PluginsModel.AvailablePlugins.ItemChanged
                                         .Where(x => x.PropertyName == nameof(Plugin.Selected) && x.Sender.PluginType == PluginType.XPack)
                                         .Select(x => x.Sender.Selected);

            this.ClosingModel = new ClosingModel(wixStateProvider.CurrentVersion, isUpgrade, observeHost, observeInstallationLog,
                                                 observeKibanaLog, observeInstallXPack, serviceStateProvider);

            this.AllSteps.AddRange(new List <IStep>
            {
                this.NoticeModel,
                this.LocationsModel,
                this.ServiceModel,
                this.ConfigurationModel,
                this.ConnectingModel,
                this.PluginsModel,
                this.ClosingModel
            });

            var observeValidationChanges = this.WhenAny(
                vm => vm.NoticeModel.ValidationFailures,
                vm => vm.LocationsModel.ValidationFailures,
                vm => vm.PluginsModel.ValidationFailures,
                vm => vm.ServiceModel.ValidationFailures,
                vm => vm.ConfigurationModel.ValidationFailures,
                vm => vm.ConnectingModel.ValidationFailures,
                vm => vm.ClosingModel.ValidationFailures,
                vm => vm.TabSelectedIndex,
                (notice, locations, plugins, service, config, connecting, closing, index) =>
            {
                var firstInvalidScreen = this.Steps.FirstOrDefault(s => !s.IsValid) ?? this.ClosingModel;
                return(firstInvalidScreen);
            });

            observeValidationChanges
            .Subscribe(selected =>
            {
                var step     = this.Steps[this.TabSelectedIndex];
                var failures = step.ValidationFailures;
                this.FirstInvalidStepValidationFailures = selected.ValidationFailures;
            });

            this.WhenAny(
                vm => vm.NoticeModel.IsValid,
                vm => vm.LocationsModel.IsValid,
                vm => vm.PluginsModel.IsValid,
                vm => vm.ServiceModel.IsValid,
                vm => vm.ConfigurationModel.IsValid,
                vm => vm.ConnectingModel.IsValid,
                vm => vm.ClosingModel.IsValid,
                (notice, locations, plugins, service, config, connecting, closing) =>
            {
                var firstInvalidScreen = this.Steps.Select((s, i) => new { s, i }).FirstOrDefault(s => !s.s.IsValid);
                return(firstInvalidScreen?.i ?? (this.Steps.Count - 1));
            })
            .Subscribe(selected =>
            {
                this.TabSelectionMax = selected;
                //if one of the steps prior to the current selection is invalid jump back
                if (this.TabSelectedIndex > this.TabSelectionMax)
                {
                    this.TabSelectedIndex = this.TabSelectionMax;
                }

                this.FirstInvalidStepValidationFailures = this.ActiveStep.ValidationFailures;
            });

            this.Install = ReactiveCommand.CreateAsyncTask(observeValidationChanges.Select(s => s.IsValid), _ =>
            {
                this.TabSelectedIndex += 1;
                return(this.InstallUITask());
            });
            this.Install.Subscribe(installationObservable =>
            {
                installationObservable.Subscribe(installed => { this.ClosingModel.Installed = installed; });
            });

            this.Refresh();
            //validate the first stab explicitly on constructing this
            //main viewmodel. WPF triggers a validation already

            this.ParsedArguments = new KibanaArgumentParser(
                this.AllSteps.Cast <IValidatableReactiveObject>().Concat(new[] { this }).ToList(), args);

            this.ActiveStep.Validate();
        }
コード例 #21
0
 // Token: 0x060005A0 RID: 1440 RVA: 0x00021F7A File Offset: 0x0002017A
 public OneTimeJobManager(IServiceStateProvider parent) : this(parent, () => JobScheduler.GetLocalInstance(), TimeSpan.FromSeconds(10.0))
 {
 }