public ElasticsearchProcess( IObservableProcess process, IConsoleOutHandler consoleOutHandler, IFileSystem fileSystem, ElasticsearchEnvironmentConfiguration env, JavaConfiguration java, IElasticsearchTool jvmOptionsParser, IElasticsearchTool javaVersionChecker, ManualResetEvent completedHandle, IEnumerable <string> args) : base( process ?? new ElasticsearchObservableProcess(env), consoleOutHandler ?? new ElasticsearchConsoleOutHandler(process?.UserInteractive ?? false), fileSystem, completedHandle) { CheckForBadEnvironmentVariables(env); var homeDirectory = env.HomeDirectory?.TrimEnd('\\') ?? throw new StartupException($"No {ElasticsearchEnvironmentStateProvider.EsHome} variable set and no home directory could be inferred from the executable location"); var configDirectory = env.ConfigDirectory?.TrimEnd('\\') ?? throw new StartupException($"{ElasticsearchEnvironmentStateProvider.ConfDir} was not explicitly set nor could it be determined from {ElasticsearchEnvironmentStateProvider.EsHome} or the current executable location"); this.HomeDirectory = homeDirectory; this.ConfigDirectory = configDirectory; this.PrivateTempDirectory = env.PrivateTempDirectory; this.GCLogsDirectory = Path.Combine(homeDirectory, "logs"); var parsedArguments = this.ParseArguments(args); var javaHome = java.JavaHomeCanonical; if (javaHome == null) { throw new StartupException("JAVA_HOME is not set and no Java installation could be found in the windows registry!"); } this.ProcessExe = java.JavaExecutable; if (!this.FileSystem.File.Exists(this.ProcessExe)) { throw new StartupException($"Java executable not found, this could be because of a faulty JAVA_HOME variable: {this.ProcessExe}"); } this.JvmOptionsParser = jvmOptionsParser; this.JavaVersionChecker = javaVersionChecker; this.Arguments = this.CreateObservableProcessArguments(parsedArguments); }
public ElasticsearchProcess( IObservableProcess process, IConsoleOutHandler consoleOutHandler, IFileSystem fileSystem, ElasticsearchEnvironmentConfiguration env, JavaConfiguration java, IElasticsearchTool jvmOptionsParser, IElasticsearchTool javaVersionChecker, ManualResetEvent completedHandle, IEnumerable <string> args) : base( process ?? new ElasticsearchObservableProcess(env), consoleOutHandler ?? new ElasticsearchConsoleOutHandler(process?.UserInteractive ?? false), fileSystem, completedHandle) { CheckForBadEnvironmentVariables(env); var homeDirectory = env.HomeDirectory?.TrimEnd('\\') ?? throw new StartupException($"No {ElasticsearchEnvironmentStateProvider.EsHome} variable set and no home directory could be inferred from the executable location"); var configDirectory = env.ConfigDirectory?.TrimEnd('\\') ?? throw new StartupException($"{ElasticsearchEnvironmentStateProvider.ConfDir} was not explicitly set nor could it be determined from {ElasticsearchEnvironmentStateProvider.EsHome} or the current executable location"); this.HomeDirectory = homeDirectory; this.ConfigDirectory = configDirectory; this.PrivateTempDirectory = env.PrivateTempDirectory; var parsedArguments = this.ParseArguments(args); this.ProcessExe = java.JavaExecutable; if (!this.FileSystem.File.Exists(this.ProcessExe)) { throw new StartupException($"java.exe does not exist at {this.ProcessExe}"); } this.JvmOptionsParser = jvmOptionsParser; this.JavaVersionChecker = javaVersionChecker; this.Arguments = this.CreateObservableProcessArguments(parsedArguments); }