aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2017-08-22 11:03:54 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-05 14:24:12 +0200
commit64c191d947c46df80bc3ac2ce7a0dce8a7cfef09 (patch)
treeb07c8aba91783659ba0a3e0cab6f6554aa04ca71 /server/sonar-main
parent8a4587ef7ee4189c0a46170bca4c0ef0368d7ec8 (diff)
downloadsonarqube-64c191d947c46df80bc3ac2ce7a0dce8a7cfef09.tar.gz
sonarqube-64c191d947c46df80bc3ac2ce7a0dce8a7cfef09.zip
SONAR-9590 add EsFileSystem class
Diffstat (limited to 'server/sonar-main')
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java b/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java
index 549e4ddfe4e..76576b6d235 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java
@@ -36,6 +36,7 @@ import org.sonar.process.ProcessId;
import org.sonar.process.command.AbstractCommand;
import org.sonar.process.command.EsCommand;
import org.sonar.process.command.JavaCommand;
+import org.sonar.process.es.EsFileSystem;
import org.sonar.process.jmvoptions.JvmOptions;
import org.sonar.process.sharedmemoryfile.AllProcessesCommands;
import org.sonar.process.sharedmemoryfile.ProcessCommands;
@@ -90,7 +91,8 @@ public class ProcessLauncherImpl implements ProcessLauncher {
}
private void writeConfFiles(EsCommand esCommand) {
- File confDir = esCommand.getConfDir();
+ EsFileSystem esFileSystem = esCommand.getFileSystem();
+ File confDir = esFileSystem.getConfDirectory();
if (!confDir.exists() && !confDir.mkdirs()) {
String error = format("Failed to create temporary configuration directory [%s]", confDir.getAbsolutePath());
LOG.error(error);
@@ -98,9 +100,9 @@ public class ProcessLauncherImpl implements ProcessLauncher {
}
try {
- IOUtils.copy(getClass().getResourceAsStream("elasticsearch.yml"), new FileOutputStream(new File(confDir, "elasticsearch.yml")));
- esCommand.getEsJvmOptions().writeToJvmOptionFile(new File(confDir, "jvm.options"));
- esCommand.getLog4j2Properties().store(new FileOutputStream(new File(confDir, "log4j2.properties")), "log42 properties file for ES bundled in SonarQube");
+ IOUtils.copy(getClass().getResourceAsStream("elasticsearch.yml"), new FileOutputStream(esFileSystem.getElasticsearchYml()));
+ esCommand.getEsJvmOptions().writeToJvmOptionFile(esFileSystem.getJvmOptions());
+ esCommand.getLog4j2Properties().store(new FileOutputStream(esFileSystem.getLog4j2Properties()), "log4j2 properties file for ES bundled in SonarQube");
} catch (IOException e) {
throw new IllegalStateException("Failed to write ES configuration files", e);
}
@@ -137,7 +139,7 @@ public class ProcessLauncherImpl implements ProcessLauncher {
private ProcessBuilder create(EsCommand esCommand) {
List<String> commands = new ArrayList<>();
- commands.add(esCommand.getExecutable().getAbsolutePath());
+ commands.add(esCommand.getFileSystem().getExecutable().getAbsolutePath());
commands.addAll(esCommand.getEsOptions());
return create(esCommand, commands);