- java.lang.Object
-
- org.wildfly.core.launcher.BootableJarCommandBuilder
-
- All Implemented Interfaces:
CommandBuilder
public class BootableJarCommandBuilder extends Object implements CommandBuilder
Builds a list of commands used to launch a bootable jar instance of WildFly. This builder is not thread safe and the same instance should not be used in multiple threads.- Author:
- JF Denise
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BootableJarCommandBuilder
addJavaOption(String jvmArg)
Adds a JVM argument to the command ignoringnull
arguments.BootableJarCommandBuilder
addJavaOptions(Iterable<String> javaOpts)
Adds the collection of JVM arguments to the command.BootableJarCommandBuilder
addJavaOptions(String... javaOpts)
Adds the array of JVM arguments to the command.BootableJarCommandBuilder
addSecurityProperties(Map<String,String> properties)
Adds all the security properties to be passed to the server.BootableJarCommandBuilder
addSecurityProperty(String key)
Adds a security property to be passed to the server with anull
value.BootableJarCommandBuilder
addSecurityProperty(String key, String value)
Adds a security property to be passed to the server.BootableJarCommandBuilder
addServerArgument(String arg)
Adds an argument to be passed to the server ignore the argument ifnull
.BootableJarCommandBuilder
addServerArguments(Iterable<String> args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynull
arguments.BootableJarCommandBuilder
addServerArguments(String... args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynull
arguments.List<String>
build()
A list of commands, including ajava
executable, required to launch WildFly instance.List<String>
buildArguments()
A list of command arguments required to launch WildFly instance.Path
getJavaHome()
Returns the Java home directory where the java executable command can be found.List<String>
getJavaOptions()
Returns the JVM arguments.List<String>
getServerArguments()
A collection of server command line arguments.static BootableJarCommandBuilder
of(String bootableJar)
Creates a command builder for a bootable instance of WildFly.static BootableJarCommandBuilder
of(Path bootableJar)
Creates a command builder for a bootable instance of WildFly.BootableJarCommandBuilder
setBindAddressHint(String address)
Sets the system propertyjboss.bind.address
to the address given.BootableJarCommandBuilder
setBindAddressHint(String interfaceName, String address)
Sets the system propertyjboss.bind.address.$INTERFACE
to the address given where$INTERFACE
is theinterfaceName
parameter.BootableJarCommandBuilder
setDebug()
Sets the debug argument for the JVM with a default port of8787
.BootableJarCommandBuilder
setDebug(boolean suspend, int port)
Sets the debug JPDA remote socket debugging argument.BootableJarCommandBuilder
setDebug(int port)
Sets the debug argument for the JVM.BootableJarCommandBuilder
setInstallDir(Path installDir)
Set the directory to install the server.BootableJarCommandBuilder
setJavaHome(String javaHome)
Sets the Java home where the Java executable can be found.BootableJarCommandBuilder
setJavaHome(Path javaHome)
Sets the Java home where the Java executable can be found.BootableJarCommandBuilder
setJavaOptions(Iterable<String> javaOpts)
Sets the JVM arguments to use.BootableJarCommandBuilder
setJavaOptions(String... javaOpts)
Sets the JVM arguments to use.BootableJarCommandBuilder
setModulesLockless(boolean b)
Set totrue
to use JBoss Modules lockless mode.BootableJarCommandBuilder
setModulesMetrics(boolean b)
Set totrue
to gather metrics for JBoss Modules.BootableJarCommandBuilder
setMulticastAddressHint(String address)
Sets the system propertyjboss.default.multicast.address
to the address given.BootableJarCommandBuilder
setYamlFiles(Path... yamlFiles)
Adds the YAML configuration file argument with the given YAML configuration files.BootableJarCommandBuilder
setYamlFiles(Collection<Path> yamlFiles)
Adds the YAML configuration file argument with the given YAML configuration files.
-
-
-
Method Detail
-
setInstallDir
public BootableJarCommandBuilder setInstallDir(Path installDir)
Set the directory to install the server.- Parameters:
installDir
- Installation directory.- Returns:
- This builder.
-
getServerArguments
public List<String> getServerArguments()
A collection of server command line arguments.- Returns:
- the server arguments
-
addServerArguments
public BootableJarCommandBuilder addServerArguments(String... args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynull
arguments.- Parameters:
args
- the arguments to add- Returns:
- the builder
-
addServerArguments
public BootableJarCommandBuilder addServerArguments(Iterable<String> args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring anynull
arguments.- Parameters:
args
- the arguments to add- Returns:
- the builder
-
addServerArgument
public BootableJarCommandBuilder addServerArgument(String arg)
Adds an argument to be passed to the server ignore the argument ifnull
.- Parameters:
arg
- the argument to pass- Returns:
- the builder
-
setBindAddressHint
public BootableJarCommandBuilder setBindAddressHint(String address)
Sets the system propertyjboss.bind.address
to the address given. This will override any previous value set viaaddServerArgument(String)
. Note: This option only works if the standard system property has not been removed from the interface. If the system property was removed the address provided has no effect.- Parameters:
address
- the address to set the bind address to- Returns:
- the builder
-
setBindAddressHint
public BootableJarCommandBuilder setBindAddressHint(String interfaceName, String address)
Sets the system propertyjboss.bind.address.$INTERFACE
to the address given where$INTERFACE
is theinterfaceName
parameter. For example in the default configuration passingmanagement
for theinterfaceName
parameter would result in the system propertyjboss.bind.address.management
being set to the address provided. This will override any previous value set viaaddServerArgument(String)
. Note: This option only works if the standard system property has not been removed from the interface. If the system property was removed the address provided has no effect.- Parameters:
interfaceName
- the name of the interface of the binding addressaddress
- the address to bind the management interface to- Returns:
- the builder
-
setMulticastAddressHint
public BootableJarCommandBuilder setMulticastAddressHint(String address)
Sets the system propertyjboss.default.multicast.address
to the address given. This will override any previous value set viaaddServerArgument(String)
. Note: This option only works if the standard system property has not been removed from the interface. If the system property was removed the address provided has no effect.- Parameters:
address
- the address to set the multicast system property to- Returns:
- the builder
-
of
public static BootableJarCommandBuilder of(Path bootableJar)
Creates a command builder for a bootable instance of WildFly.- Parameters:
bootableJar
- the path to the bootable jar- Returns:
- a new builder
-
of
public static BootableJarCommandBuilder of(String bootableJar)
Creates a command builder for a bootable instance of WildFly.- Parameters:
bootableJar
- the path to the WildFly home directory- Returns:
- a new builder
-
addJavaOption
public BootableJarCommandBuilder addJavaOption(String jvmArg)
Adds a JVM argument to the command ignoringnull
arguments.- Parameters:
jvmArg
- the JVM argument to add- Returns:
- the builder
-
setYamlFiles
public BootableJarCommandBuilder setYamlFiles(Path... yamlFiles)
Adds the YAML configuration file argument with the given YAML configuration files.- Parameters:
yamlFiles
- the files to add- Returns:
- the builder
-
setYamlFiles
public BootableJarCommandBuilder setYamlFiles(Collection<Path> yamlFiles)
Adds the YAML configuration file argument with the given YAML configuration files.- Parameters:
yamlFiles
- the files to add- Returns:
- the builder
-
addJavaOptions
public BootableJarCommandBuilder addJavaOptions(String... javaOpts)
Adds the array of JVM arguments to the command.- Parameters:
javaOpts
- the array of JVM arguments to add,null
arguments are ignored- Returns:
- the builder
-
addJavaOptions
public BootableJarCommandBuilder addJavaOptions(Iterable<String> javaOpts)
Adds the collection of JVM arguments to the command.- Parameters:
javaOpts
- the collection of JVM arguments to add,null
arguments are ignored- Returns:
- the builder
-
setJavaOptions
public BootableJarCommandBuilder setJavaOptions(Iterable<String> javaOpts)
Sets the JVM arguments to use. This overrides any default JVM arguments that would normally be added and ignoresnull
values in the collection. If the collection isnull
the JVM arguments will be cleared and no new arguments will be added.- Parameters:
javaOpts
- the JVM arguments to use- Returns:
- the builder
-
setJavaOptions
public BootableJarCommandBuilder setJavaOptions(String... javaOpts)
Sets the JVM arguments to use. This overrides any default JVM arguments that would normally be added and ignoresnull
values in the array. If the array isnull
the JVM arguments will be cleared and no new arguments will be added.- Parameters:
javaOpts
- the JVM arguments to use- Returns:
- the builder
-
getJavaOptions
public List<String> getJavaOptions()
Returns the JVM arguments.- Returns:
- the JVM arguments
-
setDebug
public BootableJarCommandBuilder setDebug()
Sets the debug argument for the JVM with a default port of8787
.- Returns:
- the builder
-
setDebug
public BootableJarCommandBuilder setDebug(int port)
Sets the debug argument for the JVM.- Parameters:
port
- the port to listen on- Returns:
- the builder
-
setDebug
public BootableJarCommandBuilder setDebug(boolean suspend, int port)
Sets the debug JPDA remote socket debugging argument.- Parameters:
suspend
-true
to suspend otherwisefalse
port
- the port to listen on- Returns:
- the builder
-
setJavaHome
public BootableJarCommandBuilder setJavaHome(String javaHome)
Sets the Java home where the Java executable can be found.- Parameters:
javaHome
- the Java home ornull
to use te system propertyjava.home
- Returns:
- the builder
-
setJavaHome
public BootableJarCommandBuilder setJavaHome(Path javaHome)
Sets the Java home where the Java executable can be found.- Parameters:
javaHome
- the Java home ornull
to use te system propertyjava.home
- Returns:
- the builder
-
setModulesLockless
public BootableJarCommandBuilder setModulesLockless(boolean b)
Set totrue
to use JBoss Modules lockless mode.- Parameters:
b
-true
to use lockless mode- Returns:
- the builder
-
setModulesMetrics
public BootableJarCommandBuilder setModulesMetrics(boolean b)
Set totrue
to gather metrics for JBoss Modules.- Parameters:
b
-true
to gather metrics for JBoss Modules.- Returns:
- this builder
-
addSecurityProperty
public BootableJarCommandBuilder addSecurityProperty(String key)
Adds a security property to be passed to the server with anull
value.- Parameters:
key
- the property key- Returns:
- the builder
-
addSecurityProperty
public BootableJarCommandBuilder addSecurityProperty(String key, String value)
Adds a security property to be passed to the server.- Parameters:
key
- the property keyvalue
- the property value- Returns:
- the builder
-
addSecurityProperties
public BootableJarCommandBuilder addSecurityProperties(Map<String,String> properties)
Adds all the security properties to be passed to the server.- Parameters:
properties
- a map of the properties to add,null
values are allowed in the map- Returns:
- the builder
-
buildArguments
public List<String> buildArguments()
Description copied from interface:CommandBuilder
A list of command arguments required to launch WildFly instance. These are the arguments the follow ajava
executable command.- Specified by:
buildArguments
in interfaceCommandBuilder
- Returns:
- the list of arguments required to launch WildFly
-
build
public List<String> build()
Description copied from interface:CommandBuilder
A list of commands, including ajava
executable, required to launch WildFly instance.- Specified by:
build
in interfaceCommandBuilder
- Returns:
- the list of arguments required to launch WildFly
-
getJavaHome
public Path 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
-
-