java.lang.Object
org.wildfly.core.launcher.JBossModulesCommandBuilder
- All Implemented Interfaces:
CommandBuilder
- Direct Known Subclasses:
DomainCommandBuilder,StandaloneCommandBuilder
Builds a list of commands used to launch JBoss Modules module.
This builder is not thread safe and the same instance should not be used in multiple threads.
- Author:
- James R. Perkins
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJBossModulesCommandBuilder(Path wildflyHome, String moduleName) Creates a command builder for a launching JBoss Modules module. -
Method Summary
Modifier and TypeMethodDescriptionaddJavaOption(String jvmArg) Adds a JVM argument to the command ignoringnullarguments.addJavaOptions(Iterable<String> javaOpts) Adds the collection of JVM arguments to the command.addJavaOptions(String... javaOpts) Adds the array of JVM arguments to the command.addModuleDir(String moduleDir) Adds a directory to the collection of module paths.addModuleDirs(Iterable<String> moduleDirs) Adds all the module directories to the collection of module paths.addModuleDirs(String... moduleDirs) Adds all the module directories to the collection of module paths.addModuleOption(String arg) Adds an option which will be passed to JBoss Modules.addModuleOptions(Iterable<String> args) Adds the options which will be passed to JBoss Modules.addModuleOptions(String... args) Adds the options which will be passed to JBoss Modules.protected voidaddServerArg(String key, String value) addServerArgument(String arg) Adds an argument to be passed to the server ignore the argument ifnull.addServerArguments(Iterable<String> args) Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.addServerArguments(String... args) Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.build()A list of commands, including ajavaexecutable, required to launch WildFly instance.A list of command arguments required to launch WildFly instance.Returns the Java home directory where the java executable command can be found.Returns the JVM arguments.Returns the modules paths used on the command line.Returns the normalized path to thejboss-modules.jarfor launching the server.protected StringgetServerArg(String key) Returns the first argument from the server arguments.A collection of server command line arguments.Returns the home directory used.static JBossModulesCommandBuilderCreates a command builder for a launching JBoss Modules module.static JBossModulesCommandBuilderCreates a command builder for a launching JBoss Modules module.setJavaHome(String javaHome) Sets the Java home where the Java executable can be found.setJavaHome(Path javaHome) Sets the Java home where the Java executable can be found.setJavaOptions(Iterable<String> javaOpts) Sets the JVM arguments to use.setJavaOptions(String... javaOpts) Sets the JVM arguments to use.setModuleDirs(Iterable<String> moduleDirs) Replaces any previously set module directories with the collection of module directories.setModuleDirs(String... moduleDirs) Replaces any previously set module directories with the array of module directories.setModuleOptions(Iterable<String> args) Clears the current module options and adds the options which will be passed to JBoss Modules.setModuleOptions(String... args) Clears the current module options and adds the options which will be passed to JBoss Modules.setModulesLockless(boolean b) Set totrueto use JBoss Modules lockless mode.setModulesMetrics(boolean b) Set totrueto gather metrics for JBoss Modules.protected voidsetSingleServerArg(String key, String value) setUseSecurityManager(boolean useSecMgr) Sets whether or not the security manager option,-secmgr, should be used.booleanIndicates whether or no a security manager should be used for the server launched.
-
Constructor Details
-
JBossModulesCommandBuilder
Creates a command builder for a launching JBoss Modules module. Note thewildflyHomeandjavaHomeare not validated using the constructor. The staticof(Path, String)is preferred.- Parameters:
wildflyHome- the path to WildFly, cannot benullmoduleName- the name of the entry module, cannot benull
-
-
Method Details
-
of
Creates a command builder for a launching JBoss Modules module.- Parameters:
wildflyHome- the path to the WildFly home directory, cannot benullmoduleName- the name of the entry module, cannot benull- Returns:
- a new builder
-
of
Creates a command builder for a launching JBoss Modules module.- Parameters:
wildflyHome- the path to the WildFly home directory, cannot benullmoduleName- the name of the entry module, cannot benull- Returns:
- a new builder
-
setUseSecurityManager
Sets whether or not the security manager option,-secmgr, should be used.- Parameters:
useSecMgr-trueto use the a security manager, otherwisefalse- Returns:
- the builder
-
useSecurityManager
public boolean useSecurityManager()Indicates whether or no a security manager should be used for the server launched.- Returns:
trueif a security manager should be used, otherwisefalse
-
addModuleDir
Adds a directory to the collection of module paths.- Parameters:
moduleDir- the module directory to add- Returns:
- the builder
- Throws:
IllegalArgumentException- if the path isnull
-
addModuleDirs
Adds all the module directories to the collection of module paths.- Parameters:
moduleDirs- an array of module paths to add- Returns:
- the builder
- Throws:
IllegalArgumentException- if any of the module paths are invalid ornull
-
addModuleDirs
Adds all the module directories to the collection of module paths.- Parameters:
moduleDirs- a collection of module paths to add- Returns:
- the builder
- Throws:
IllegalArgumentException- if any of the module paths are invalid ornull
-
setModuleDirs
Replaces any previously set module directories with the collection of module directories. The default module directory will NOT be used if this method is invoked.- Parameters:
moduleDirs- the collection of module directories to use- Returns:
- the builder
- Throws:
IllegalArgumentException- if any of the module paths are invalid ornull
-
setModuleDirs
Replaces any previously set module directories with the array of module directories. The default module directory will NOT be used if this method is invoked.- Parameters:
moduleDirs- the array of module directories to use- Returns:
- the builder
- Throws:
IllegalArgumentException- if any of the module paths are invalid ornull
-
getModulePaths
Returns the modules paths used on the command line.- Returns:
- the paths separated by the
path separator
-
addServerArgument
Adds an argument to be passed to the server ignore the argument ifnull.- Parameters:
arg- the argument to pass- Returns:
- the builder
-
addServerArguments
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.- Parameters:
args- the arguments to add- Returns:
- the builder
-
addServerArguments
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.- Parameters:
args- the arguments to add- Returns:
- the builder
-
getWildFlyHome
Returns the home directory used.- Returns:
- the home directory
-
getJavaHome
Returns the Java home directory where the java executable command can be found. If the directory was not set the system property value,java.home, should be used.- Returns:
- the path to the Java home directory
-
getModulesJarName
Returns the normalized path to thejboss-modules.jarfor launching the server.- Returns:
- the path to
jboss-modules.jar
-
getServerArguments
A collection of server command line arguments.- Returns:
- the server arguments
-
addJavaOption
Adds a JVM argument to the command ignoringnullarguments.- Parameters:
jvmArg- the JVM argument to add- Returns:
- the builder
-
addJavaOptions
Adds the array of JVM arguments to the command.- Parameters:
javaOpts- the array of JVM arguments to add,nullarguments are ignored- Returns:
- the builder
-
addJavaOptions
Adds the collection of JVM arguments to the command.- Parameters:
javaOpts- the collection of JVM arguments to add,nullarguments are ignored- Returns:
- the builder
-
setJavaOptions
Sets the JVM arguments to use. This overrides any default JVM arguments that would normally be added and ignoresnullvalues in the collection. If the collection isnullthe JVM arguments will be cleared and no new arguments will be added.- Parameters:
javaOpts- the JVM arguments to use- Returns:
- the builder
-
setJavaOptions
Sets the JVM arguments to use. This overrides any default JVM arguments that would normally be added and ignoresnullvalues in the array. If the array isnullthe JVM arguments will be cleared and no new arguments will be added.- Parameters:
javaOpts- the JVM arguments to use- Returns:
- the builder
-
getJavaOptions
Returns the JVM arguments.- Returns:
- the JVM arguments
-
addModuleOption
Adds an option which will be passed to JBoss Modules.Note that
-mpor--modulepathis not supported. UseaddModuleDir(String)to add a module directory.- Parameters:
arg- the argument to add- Returns:
- the builder
-
addModuleOptions
Adds the options which will be passed to JBoss Modules.Note that
-mpor--modulepathis not supported. UseaddModuleDirs(String...)to add a module directory.- Parameters:
args- the argument to add- Returns:
- the builder
-
addModuleOptions
Adds the options which will be passed to JBoss Modules.Note that
-mpor--modulepathis not supported. UseaddModuleDirs(Iterable)to add a module directory.- Parameters:
args- the argument to add- Returns:
- the builder
-
setModuleOptions
Clears the current module options and adds the options which will be passed to JBoss Modules.Note that
-mpor--modulepathis not supported. UseaddModuleDirs(String...)to add a module directory.- Parameters:
args- the argument to use- Returns:
- the builder
-
setModuleOptions
Clears the current module options and adds the options which will be passed to JBoss Modules.Note that
-mpor--modulepathis not supported. UseaddModuleDirs(Iterable)to add a module directory.- Parameters:
args- the argument to use- Returns:
- the builder
-
setJavaHome
Sets the Java home where the Java executable can be found.- Parameters:
javaHome- the Java home ornullto use te system propertyjava.home- Returns:
- the builder
-
setJavaHome
Sets the Java home where the Java executable can be found.- Parameters:
javaHome- the Java home ornullto use te system propertyjava.home- Returns:
- the builder
-
setModulesLockless
Set totrueto use JBoss Modules lockless mode.- Parameters:
b-trueto use lockless mode- Returns:
- the builder
-
setModulesMetrics
Set totrueto gather metrics for JBoss Modules.- Parameters:
b-trueto gather metrics for JBoss Modules.- Returns:
- this builder
-
buildArguments
Description copied from interface:CommandBuilderA list of command arguments required to launch WildFly instance. These are the arguments the follow ajavaexecutable command.- Specified by:
buildArgumentsin interfaceCommandBuilder- Returns:
- the list of arguments required to launch WildFly
-
build
Description copied from interface:CommandBuilderA list of commands, including ajavaexecutable, required to launch WildFly instance.- Specified by:
buildin interfaceCommandBuilder- Returns:
- the list of arguments required to launch WildFly
-
setSingleServerArg
-
addServerArg
-
getServerArg
Returns the first argument from the server arguments.- Parameters:
key- the key to the argument- Returns:
- the first argument or
null
-