java.lang.Object
org.wildfly.core.launcher.CliCommandBuilder
- All Implemented Interfaces:
CommandBuilder
Builds a list of commands to create a new process for a CLI instance.
This builder is not thread safe and the same instance should not be used in multiple threads.
- Author:
- James R. Perkins
-
Method Summary
Modifier and TypeMethodDescriptionaddCliArgument(String arg) Adds an argument to be passed to the CLI command ignore the argument ifnull.addCliArguments(Iterable<String> args) Adds the arguments to the collection of arguments that will be passed to the CLI command ignoring anynullarguments.addCliArguments(String... args) Adds the arguments to the collection of arguments that will be passed to the CLI command ignoring anynullarguments.addJavaOption(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.static CliCommandBuilderasJarLauncher(String wildflyHome) Creates a command builder for a non-modular CLI instance launched from wildflyHome/bin/client/jboss-client.jar.static CliCommandBuilderasJarLauncher(Path wildflyHome) Creates a command builder for a non-modular CLI instance launched from wildflyHome/bin/client/jboss-client.jar.static CliCommandBuilderasModularLauncher(String wildflyHome) Creates a command builder for a CLI instance.static CliCommandBuilderasModularLauncher(Path wildflyHome) Creates a command builder for a CLI instance.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.static CliCommandBuilderCreates a command builder for a modular CLI instance.static CliCommandBuilderCreates a command builder for a modular CLI instance.setCommand(String command) Sets the command to execute.setCommands(Iterable<String> commands) Sets the commands to execute.setCommands(String... commands) Sets the commands to execute.setConnection(String controller) Sets the hostname and port to connect to.setConnection(String hostname, int port) Sets the hostname and port to connect to.setConnection(String protocol, String hostname, int port) Sets the protocol, hostname and port to connect to.setController(String controller) Sets the hostname and port to connect to.setController(String hostname, int port) Sets the hostname and port to connect to.setController(String protocol, String hostname, int port) Sets the protocol, hostname and port to connect to.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.setPassword(String password) Sets the password to use when establishing a connection.setScriptFile(String path) Sets the path to the script file to execute.setScriptFile(Path path) Sets the path to the script file to execute.setTimeout(int timeout) Sets the timeout used when connecting to the server.Sets the command argument to use the GUI CLI client.Sets the user to use when establishing a connection.
-
Method Details
-
asModularLauncher
Creates a command builder for a CLI instance.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
asModularLauncher
Creates a command builder for a CLI instance.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
of
Creates a command builder for a modular CLI instance.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
of
Creates a command builder for a modular CLI instance.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
asJarLauncher
Creates a command builder for a non-modular CLI instance launched from wildflyHome/bin/client/jboss-client.jar.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
asJarLauncher
Creates a command builder for a non-modular CLI instance launched from wildflyHome/bin/client/jboss-client.jar.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
setConnection
Sets the hostname and port to connect to.This sets both the
--connectand--controllerarguments.- Parameters:
controller- the controller argument to use- Returns:
- the builder
-
setConnection
Sets the hostname and port to connect to.This sets both the
--connectand--controllerarguments.- Parameters:
hostname- the host nameport- the port- Returns:
- the builder
-
setConnection
Sets the protocol, hostname and port to connect to.This sets both the
--connectand--controllerarguments.- Parameters:
protocol- the protocol to usehostname- the host nameport- the port- Returns:
- the builder
-
setController
Sets the hostname and port to connect to.- Parameters:
controller- the controller argument to use- Returns:
- the builder
-
setController
Sets the hostname and port to connect to.- Parameters:
hostname- the host nameport- the port- Returns:
- the builder
-
setController
Sets the protocol, hostname and port to connect to.- Parameters:
protocol- the protocol to usehostname- the host nameport- the port- Returns:
- the builder
-
setUser
Sets the user to use when establishing a connection.- Parameters:
user- the user to use- Returns:
- the builder
-
setPassword
Sets the password to use when establishing a connection.- Parameters:
password- the password to use- Returns:
- the builder
-
setScriptFile
Sets the path to the script file to execute.- Parameters:
path- the path to the script file to execute- Returns:
- the builder
-
setScriptFile
Sets the path to the script file to execute.- Parameters:
path- the path to the script file to execute- Returns:
- the builder
-
setCommand
Sets the command to execute.- Parameters:
command- the command to execute- Returns:
- the builder
-
setCommands
Sets the commands to execute.- Parameters:
commands- the commands to execute- Returns:
- the builder
-
setCommands
Sets the commands to execute.- Parameters:
commands- the commands to execute- Returns:
- the builder
-
setTimeout
Sets the timeout used when connecting to the server.- Parameters:
timeout- the time out to use- Returns:
- the builder
-
setUseGui
Sets the command argument to use the GUI CLI client.- Returns:
- the builder
-
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
-
addCliArgument
Adds an argument to be passed to the CLI command ignore the argument ifnull.- Parameters:
arg- the argument to pass- Returns:
- the builder
-
addCliArguments
Adds the arguments to the collection of arguments that will be passed to the CLI command ignoring anynullarguments.- Parameters:
args- the arguments to add- Returns:
- the builder
-
addCliArguments
Adds the arguments to the collection of arguments that will be passed to the CLI command ignoring anynullarguments.- Parameters:
args- the arguments to add- Returns:
- the builder
-
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
-
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
-
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
-
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
-