diff --git a/robozonky-app/src/main/assembly/filtered-resources/robozonky.bat b/robozonky-app/src/main/assembly/filtered-resources/robozonky.bat
index 679c470ef..e9840fcce 100644
--- a/robozonky-app/src/main/assembly/filtered-resources/robozonky.bat
+++ b/robozonky-app/src/main/assembly/filtered-resources/robozonky.bat
@@ -1,5 +1,2 @@
-if not defined ROBOZONKY_PORT set ROBOZONKY_PORT=7091
-if not defined ROBOZONKY_IP set ROBOZONKY_IP=localhost
-set "JMX_OPTS=-Djava.rmi.server.hostname=%ROBOZONKY_IP% -Dcom.sun.management.jmxremote.port=%ROBOZONKY_PORT% -Dcom.sun.management.jmxremote.rmi.port=%ROBOZONKY_PORT% -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
-set "ROBOZONKY_OPTS=%JMX_OPTS% %JAVA_OPTS% -Dlogback.configurationFile=logback.xml -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true"
+set "ROBOZONKY_OPTS=%JAVA_OPTS% -Dlogback.configurationFile=logback.xml -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true"
java %ROBOZONKY_OPTS% -jar bin/robozonky-app-${project.version}.jar %*
diff --git a/robozonky-app/src/main/assembly/filtered-resources/robozonky.sh b/robozonky-app/src/main/assembly/filtered-resources/robozonky.sh
index 6d2d410d7..cf5346dcf 100644
--- a/robozonky-app/src/main/assembly/filtered-resources/robozonky.sh
+++ b/robozonky-app/src/main/assembly/filtered-resources/robozonky.sh
@@ -1,7 +1,4 @@
#!/bin/bash
BASEDIR=$(dirname "$0")
-ROBOZONKY_PORT=${ROBOZONKY_PORT:-7091}
-ROBOZONKY_IP=${ROBOZONKY_IP:-localhost}
-JMX_OPTS="-Djava.rmi.server.hostname=$ROBOZONKY_IP -Dcom.sun.management.jmxremote.port=$ROBOZONKY_PORT -Dcom.sun.management.jmxremote.rmi.port=$ROBOZONKY_PORT -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
-ROBOZONKY_OPTS="$JMX_OPTS $JAVA_OPTS -Dlogback.configurationFile=logback.xml -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true"
+ROBOZONKY_OPTS="$JAVA_OPTS -Dlogback.configurationFile=logback.xml -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true"
$JAVA_HOME/bin/java $ROBOZONKY_OPTS -jar ${BASEDIR}/bin/robozonky-app-${project.version}.jar "$@"
diff --git a/robozonky-installer/robozonky-installer-app/src/main/izpack/install.xml b/robozonky-installer/robozonky-installer-app/src/main/izpack/install.xml
index 30f7e8e19..86648956d 100644
--- a/robozonky-installer/robozonky-installer-app/src/main/izpack/install.xml
+++ b/robozonky-installer/robozonky-installer-app/src/main/izpack/install.xml
@@ -51,6 +51,10 @@
isEmailEnabled
true
+
+ isJmxEnabled
+ true
+
strategyType
file
@@ -80,6 +84,7 @@
+
diff --git a/robozonky-installer/robozonky-installer-app/src/main/izpack/userInputSpec.xml b/robozonky-installer/robozonky-installer-app/src/main/izpack/userInputSpec.xml
index 900dd9236..d3eaf89ee 100644
--- a/robozonky-installer/robozonky-installer-app/src/main/izpack/userInputSpec.xml
+++ b/robozonky-installer/robozonky-installer-app/src/main/izpack/userInputSpec.xml
@@ -48,6 +48,9 @@
+
+
+
@@ -105,17 +108,13 @@
-
-
-
-
-
+
@@ -147,6 +146,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/CommandLinePart.java b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/CommandLinePart.java
index e79729221..16d6531f6 100644
--- a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/CommandLinePart.java
+++ b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/CommandLinePart.java
@@ -24,7 +24,6 @@
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -33,8 +32,8 @@
public class CommandLinePart {
private final Map> options = new LinkedHashMap<>();
- private final Map properties = new TreeMap<>();
- private final Map environmentVariables = new TreeMap<>();
+ private final Map properties = new LinkedHashMap<>();
+ private final Map environmentVariables = new LinkedHashMap<>();
public CommandLinePart setOption(final String key, final String... value) {
diff --git a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListener.java b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListener.java
index 0ddc192af..b5ec38fbe 100644
--- a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListener.java
+++ b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListener.java
@@ -122,6 +122,20 @@ private SecretProvider getSecretProvider(final char[] keystorePassword) {
}
}
+ CommandLinePart prepareJmx() {
+ if (!Boolean.valueOf(Variables.IS_JMX_ENABLED.getValue(DATA))) {
+ return new CommandLinePart();
+ }
+ final String port = Variables.JMX_PORT.getValue(DATA);
+ return new CommandLinePart()
+ .setProperty("com.sun.management.jmxremote.authenticate",
+ Variables.IS_JMX_SECURITY_ENABLED.getValue(DATA))
+ .setProperty("com.sun.management.jmxremote.ssl", "false")
+ .setProperty("com.sun.management.jmxremote.rmi.port", port)
+ .setProperty("com.sun.management.jmxremote.port", port)
+ .setProperty("java.rmi.server.hostname", Variables.JMX_HOSTNAME.getValue(DATA));
+ }
+
CommandLinePart prepareCore() {
return prepareCore(KEYSTORE_PASSWORD);
}
@@ -154,7 +168,7 @@ CommandLinePart prepareCore(final char[] keystorePassword) {
}
CommandLinePart prepareCommandLine(final CommandLinePart strategy, final CommandLinePart emailConfig,
- final CommandLinePart credentials) {
+ final CommandLinePart jmxConfig, final CommandLinePart credentials) {
// assemble the CLI
final CommandLinePart cli = new CommandLinePart();
credentials.getOptions().forEach((k, v) -> cli.setOption(k, v.toArray(new String[v.size()])));
@@ -167,7 +181,8 @@ CommandLinePart prepareCommandLine(final CommandLinePart strategy, final Command
final CommandLinePart result = new CommandLinePart()
.setOption("@" + CLI_CONFIG_FILE.getAbsolutePath())
.setEnvironmentVariable("JAVA_HOME", Variables.JAVA_HOME.getValue(DATA));
- Stream.of(strategy.getProperties(), emailConfig.getProperties(), credentials.getProperties())
+ Stream.of(strategy.getProperties(), emailConfig.getProperties(), jmxConfig.getProperties(),
+ credentials.getProperties())
.forEach(m -> m.forEach(result::setProperty));
return result;
} catch (final IOException ex) {
@@ -234,18 +249,20 @@ void moveLog() {
@Override
public void afterPacks(final List packs, final ProgressListener progressListener) {
- progressListener.startAction("Konfigurace RoboZonky", 6);
+ progressListener.startAction("Konfigurace RoboZonky", 7);
progressListener.nextStep("Příprava strategie.", 1, 1);
final CommandLinePart strategyConfig = prepareStrategy();
progressListener.nextStep("Příprava nastavení e-mailu.", 2, 1);
final CommandLinePart emailConfig = prepareEmailConfiguration();
- progressListener.nextStep("Příprava nastavení Zonky.", 3, 1);
+ progressListener.nextStep("Příprava nastavení JMX.", 3, 1);
+ final CommandLinePart jmx = prepareJmx();
+ progressListener.nextStep("Příprava nastavení Zonky.", 4, 1);
final CommandLinePart credentials = prepareCore();
- progressListener.nextStep("Generování parametrů příkazové řádky.", 4, 1);
- final CommandLinePart result = prepareCommandLine(strategyConfig, emailConfig, credentials);
- progressListener.nextStep("Příprava nastavení logování.", 5, 1);
+ progressListener.nextStep("Generování parametrů příkazové řádky.", 5, 1);
+ final CommandLinePart result = prepareCommandLine(strategyConfig, emailConfig, jmx, credentials);
+ progressListener.nextStep("Příprava nastavení logování.", 6, 1);
moveLog();
- progressListener.nextStep("Generování spustitelného souboru.", 6, 1);
+ progressListener.nextStep("Generování spustitelného souboru.", 7, 1);
prepareRunScript(result);
progressListener.stopAction();
}
diff --git a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/Variables.java b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/Variables.java
index 072876427..f3d6eee96 100644
--- a/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/Variables.java
+++ b/robozonky-installer/robozonky-installer-panels/src/main/java/com/github/triceo/robozonky/installer/panels/Variables.java
@@ -27,6 +27,8 @@ enum Variables {
INSTALL_PATH("INSTALL_PATH"),
IS_DRY_RUN("isDryRun"),
IS_EMAIL_ENABLED("isEmailEnabled"),
+ IS_JMX_ENABLED("isJmxEnabled"),
+ IS_JMX_SECURITY_ENABLED("isJmxSecurityEnabled"),
IS_USING_OAUTH_TOKEN("isUsingToken"),
IS_WINDOWS("izpack.windowsinstall"),
IS_ZONKOID_ENABLED("isZonkoidEnabled"),
@@ -38,6 +40,8 @@ enum Variables {
SMTP_PORT("smtpPort"),
SMTP_IS_TLS("smtpIsTls"),
SMTP_IS_SSL("smtpIsSsl"),
+ JMX_HOSTNAME("jmxHostname"),
+ JMX_PORT("jmxPort"),
STRATEGY_SOURCE("strategy"),
STRATEGY_TYPE("strategyType"),
ZONKOID_TOKEN("zonkoidToken"),
diff --git a/robozonky-installer/robozonky-installer-panels/src/test/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListenerTest.java b/robozonky-installer/robozonky-installer-panels/src/test/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListenerTest.java
index fa9d71e81..329fb5050 100644
--- a/robozonky-installer/robozonky-installer-panels/src/test/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListenerTest.java
+++ b/robozonky-installer/robozonky-installer-panels/src/test/java/com/github/triceo/robozonky/installer/panels/RoboZonkyInstallerListenerTest.java
@@ -245,7 +245,7 @@ public void progressUnix() {
softly.assertThat(RoboZonkyInstallerListener.CLI_CONFIG_FILE).exists();
});
Mockito.verify(progress, times(1)).startAction(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt());
- Mockito.verify(progress, times(6))
+ Mockito.verify(progress, times(7))
.nextStep(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt(), ArgumentMatchers.eq(1));
Mockito.verify(progress, times(1)).stopAction();
}
@@ -267,7 +267,7 @@ public void progressWindows() {
softly.assertThat(RoboZonkyInstallerListener.CLI_CONFIG_FILE).exists();
});
Mockito.verify(progress, times(1)).startAction(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt());
- Mockito.verify(progress, times(6))
+ Mockito.verify(progress, times(7))
.nextStep(ArgumentMatchers.anyString(), ArgumentMatchers.anyInt(), ArgumentMatchers.eq(1));
Mockito.verify(progress, times(1)).stopAction();
}