- 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 BootableJarCommandBuilderaddJavaOption(String jvmArg)Adds a JVM argument to the command ignoringnullarguments.BootableJarCommandBuilderaddJavaOptions(Iterable<String> javaOpts)Adds the collection of JVM arguments to the command.BootableJarCommandBuilderaddJavaOptions(String... javaOpts)Adds the array of JVM arguments to the command.BootableJarCommandBuilderaddSecurityProperties(Map<String,String> properties)Adds all the security properties to be passed to the server.BootableJarCommandBuilderaddSecurityProperty(String key)Adds a security property to be passed to the server with anullvalue.BootableJarCommandBuilderaddSecurityProperty(String key, String value)Adds a security property to be passed to the server.BootableJarCommandBuilderaddServerArgument(String arg)Adds an argument to be passed to the server ignore the argument ifnull.BootableJarCommandBuilderaddServerArguments(Iterable<String> args)Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.BootableJarCommandBuilderaddServerArguments(String... args)Adds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.List<String>build()A list of commands, including ajavaexecutable, required to launch WildFly instance.List<String>buildArguments()A list of command arguments required to launch WildFly instance.PathgetJavaHome()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 BootableJarCommandBuilderof(String bootableJar)Creates a command builder for a bootable instance of WildFly.static BootableJarCommandBuilderof(Path bootableJar)Creates a command builder for a bootable instance of WildFly.BootableJarCommandBuildersetBindAddressHint(String address)Sets the system propertyjboss.bind.addressto the address given.BootableJarCommandBuildersetBindAddressHint(String interfaceName, String address)Sets the system propertyjboss.bind.address.$INTERFACEto the address given where$INTERFACEis theinterfaceNameparameter.BootableJarCommandBuildersetDebug()Sets the debug argument for the JVM with a default port of8787.BootableJarCommandBuildersetDebug(boolean suspend, int port)Sets the debug JPDA remote socket debugging argument.BootableJarCommandBuildersetDebug(int port)Sets the debug argument for the JVM.BootableJarCommandBuildersetInstallDir(Path installDir)Set the directory to install the server.BootableJarCommandBuildersetJavaHome(String javaHome)Sets the Java home where the Java executable can be found.BootableJarCommandBuildersetJavaHome(Path javaHome)Sets the Java home where the Java executable can be found.BootableJarCommandBuildersetJavaOptions(Iterable<String> javaOpts)Sets the JVM arguments to use.BootableJarCommandBuildersetJavaOptions(String... javaOpts)Sets the JVM arguments to use.BootableJarCommandBuildersetModulesLockless(boolean b)Set totrueto use JBoss Modules lockless mode.BootableJarCommandBuildersetModulesMetrics(boolean b)Set totrueto gather metrics for JBoss Modules.BootableJarCommandBuildersetMulticastAddressHint(String address)Sets the system propertyjboss.default.multicast.addressto the address given.BootableJarCommandBuildersetYamlFiles(Path... yamlFiles)Adds the YAML configuration file argument with the given YAML configuration files.BootableJarCommandBuildersetYamlFiles(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 anynullarguments.- 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 anynullarguments.- 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.addressto 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.$INTERFACEto the address given where$INTERFACEis theinterfaceNameparameter. For example in the default configuration passingmanagementfor theinterfaceNameparameter would result in the system propertyjboss.bind.address.managementbeing 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.addressto 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 ignoringnullarguments.- 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,nullarguments 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,nullarguments 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 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
public BootableJarCommandBuilder setJavaOptions(String... javaOpts)
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
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-trueto suspend otherwisefalseport- 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 ornullto 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 ornullto use te system propertyjava.home- Returns:
- the builder
-
setModulesLockless
public BootableJarCommandBuilder setModulesLockless(boolean b)
Set totrueto use JBoss Modules lockless mode.- Parameters:
b-trueto use lockless mode- Returns:
- the builder
-
setModulesMetrics
public BootableJarCommandBuilder setModulesMetrics(boolean b)
Set totrueto gather metrics for JBoss Modules.- Parameters:
b-trueto 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 anullvalue.- 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,nullvalues are allowed in the map- Returns:
- the builder
-
buildArguments
public List<String> 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
public List<String> 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
-
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
-
-