-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFCORE-6635] Add a base JBossModulesCommandBuilder for launching oth…
…er types like the appclient or other JBoss Module containers in a new process. https://issues.redhat.com/browse/WFCORE-6635 Signed-off-by: James R. Perkins <[email protected]>
- Loading branch information
Showing
11 changed files
with
818 additions
and
341 deletions.
There are no files selected for viewing
301 changes: 27 additions & 274 deletions
301
launcher/src/main/java/org/wildfly/core/launcher/AbstractCommandBuilder.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import static org.wildfly.core.launcher.AbstractCommandBuilder.DEFAULT_VM_ARGUMENTS; | ||
import static org.wildfly.core.launcher.JBossModulesCommandBuilder.DEFAULT_VM_ARGUMENTS; | ||
|
||
import org.wildfly.core.launcher.Arguments.Argument; | ||
import static org.wildfly.core.launcher.StandaloneCommandBuilder.DEBUG_FORMAT; | ||
|
@@ -23,7 +23,7 @@ | |
* | ||
* @author <a href="mailto:[email protected]">JF Denise</a> | ||
*/ | ||
@SuppressWarnings("unused") | ||
@SuppressWarnings({"unused", "UnusedReturnValue"}) | ||
public class BootableJarCommandBuilder implements CommandBuilder { | ||
|
||
private final Arguments javaOpts; | ||
|
@@ -430,10 +430,9 @@ public BootableJarCommandBuilder addSecurityProperties(final Map<String, String> | |
|
||
@Override | ||
public List<String> buildArguments() { | ||
final List<String> cmd = new ArrayList<>(); | ||
cmd.addAll(getJavaOptions()); | ||
final List<String> cmd = new ArrayList<>(getJavaOptions()); | ||
if (jvm.enhancedSecurityManagerAvailable()) { | ||
cmd.add(AbstractCommandBuilder.SECURITY_MANAGER_PROP_WITH_ALLOW_VALUE); | ||
cmd.add(JBossModulesCommandBuilder.SECURITY_MANAGER_PROP_WITH_ALLOW_VALUE); | ||
} | ||
if (modulesLocklessArg != null) { | ||
cmd.add(modulesLocklessArg); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,10 @@ | |
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@SuppressWarnings("unused") | ||
@SuppressWarnings({"unused", "UnusedReturnValue"}) | ||
public class CliCommandBuilder implements CommandBuilder { | ||
|
||
private static Path cliClientJar = Paths.get("bin").resolve("client").resolve("jboss-cli-client.jar"); | ||
private static final Path cliClientJar = Paths.get("bin").resolve("client").resolve("jboss-cli-client.jar"); | ||
|
||
enum CliArgument { | ||
CONNECT("--connect", "-c"), | ||
|
@@ -652,20 +652,19 @@ public Path getJavaHome() { | |
|
||
@Override | ||
public List<String> buildArguments() { | ||
final List<String> cmd = new ArrayList<>(); | ||
cmd.addAll(getJavaOptions()); | ||
final List<String> cmd = new ArrayList<>(getJavaOptions()); | ||
if (modularLauncher) { | ||
if (environment.getJvm().isModular()) { | ||
cmd.addAll(AbstractCommandBuilder.DEFAULT_MODULAR_VM_ARGUMENTS); | ||
for (final String optionalModularArgument : AbstractCommandBuilder.OPTIONAL_DEFAULT_MODULAR_VM_ARGUMENTS) { | ||
if (environment.getJvm().isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
cmd.addAll(JBossModulesCommandBuilder.DEFAULT_MODULAR_VM_ARGUMENTS); | ||
for (final String optionalModularArgument : JBossModulesCommandBuilder.OPTIONAL_DEFAULT_MODULAR_VM_ARGUMENTS) { | ||
if (Jvm.isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
cmd.add(optionalModularArgument); | ||
} | ||
} | ||
} | ||
} | ||
if (environment.getJvm().enhancedSecurityManagerAvailable()) { | ||
cmd.add(AbstractCommandBuilder.SECURITY_MANAGER_PROP_WITH_ALLOW_VALUE); | ||
cmd.add(JBossModulesCommandBuilder.SECURITY_MANAGER_PROP_WITH_ALLOW_VALUE); | ||
} | ||
cmd.add("-jar"); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,10 @@ | |
* | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@SuppressWarnings("unused") | ||
@SuppressWarnings({"unused", "UnusedReturnValue"}) | ||
public class DomainCommandBuilder extends AbstractCommandBuilder<DomainCommandBuilder> implements CommandBuilder { | ||
|
||
private static final String MODULE_NAME = "org.jboss.as.process-controller"; | ||
private static final String DOMAIN_BASE_DIR = "jboss.domain.base.dir"; | ||
private static final String DOMAIN_CONFIG_DIR = "jboss.domain.config.dir"; | ||
private static final String DOMAIN_LOG_DIR = "jboss.domain.log.dir"; | ||
|
@@ -45,7 +46,7 @@ public class DomainCommandBuilder extends AbstractCommandBuilder<DomainCommandBu | |
* @param jvm the default JVM | ||
*/ | ||
private DomainCommandBuilder(final Path wildflyHome, final Jvm jvm) { | ||
super(wildflyHome, jvm); | ||
super(wildflyHome, jvm, MODULE_NAME); | ||
hostControllerJavaOpts = new Arguments(); | ||
hostControllerJavaOpts.addAll(DEFAULT_VM_ARGUMENTS); | ||
processControllerJavaOpts = new Arguments(); | ||
|
@@ -287,7 +288,7 @@ public DomainCommandBuilder setProcessControllerPort(final int port) { | |
* @return the builder | ||
*/ | ||
public DomainCommandBuilder setBaseDirectory(final String baseDir) { | ||
this.baseDir = validateAndNormalizeDir(baseDir, true); | ||
this.baseDir = Environment.validateAndNormalizeDir(baseDir, true); | ||
return this; | ||
} | ||
|
||
|
@@ -301,7 +302,7 @@ public DomainCommandBuilder setBaseDirectory(final String baseDir) { | |
* @return the builder | ||
*/ | ||
public DomainCommandBuilder setBaseDirectory(final Path baseDir) { | ||
this.baseDir = validateAndNormalizeDir(baseDir, true); | ||
this.baseDir = Environment.validateAndNormalizeDir(baseDir, true); | ||
return this; | ||
} | ||
|
||
|
@@ -711,7 +712,7 @@ public List<String> buildArguments() { | |
if (environment.getJvm().isModular()) { | ||
cmd.addAll(DEFAULT_MODULAR_VM_ARGUMENTS); | ||
for (final String optionalModularArgument : OPTIONAL_DEFAULT_MODULAR_VM_ARGUMENTS) { | ||
if (environment.getJvm().isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
if (Jvm.isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
cmd.add(optionalModularArgument); | ||
} | ||
} | ||
|
@@ -729,7 +730,7 @@ public List<String> buildArguments() { | |
} | ||
cmd.add("-mp"); | ||
cmd.add(getModulePaths()); | ||
cmd.add("org.jboss.as.process-controller"); | ||
cmd.add(MODULE_NAME); | ||
cmd.add("-jboss-home"); | ||
cmd.add(getWildFlyHome().toString()); | ||
cmd.add("-jvm"); | ||
|
@@ -747,7 +748,7 @@ public List<String> buildArguments() { | |
if (hostControllerJvm.isModular()) { | ||
cmd.addAll(DEFAULT_MODULAR_VM_ARGUMENTS); | ||
for (final String optionalModularArgument : OPTIONAL_DEFAULT_MODULAR_VM_ARGUMENTS) { | ||
if (environment.getJvm().isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
if (Jvm.isPackageAvailable(environment.getJvm().getPath(), optionalModularArgument)) { | ||
cmd.add(optionalModularArgument); | ||
} | ||
} | ||
|
@@ -767,14 +768,6 @@ public List<String> buildArguments() { | |
return cmd; | ||
} | ||
|
||
@Override | ||
public List<String> build() { | ||
final List<String> cmd = new ArrayList<>(); | ||
cmd.add(environment.getJvm().getCommand()); | ||
cmd.addAll(buildArguments()); | ||
return cmd; | ||
} | ||
|
||
@Override | ||
public Path getJavaHome() { | ||
return environment.getJvm().getPath(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.