java.lang.Object
org.wildfly.core.launcher.JBossModulesCommandBuilder
org.wildfly.core.launcher.DomainCommandBuilder
- All Implemented Interfaces:
CommandBuilder
Builds a list of commands used to launch a domain instance of WildFly.
This builder is not thread safe and the same instance should not be used in multiple threads.
The
default Java home directory is used for the process controller and optionally for the
host
controller and the servers launched.- Author:
- James R. Perkins
-
Method Summary
Modifier and TypeMethodDescriptionAdds a JVM argument to the host controller ignoringnullvalues.Adds a JVM arguments to the host controller ignoringnullvalues.addHostControllerJavaOptions(String... args) Adds a JVM arguments to the host controller ignoringnullvalues.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.Adds a JVM argument to the process controller ignoringnullvalues.Adds a JVM arguments to the process controller ignoringnullvalues.addProcessControllerJavaOptions(String... args) Adds a JVM arguments to the process controller ignoringnullvalues.addPropertiesFile(String file) Adds a properties file to be passed to the server.addPropertiesFile(Path file) Adds a properties file to be passed to the server.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.protected static voidaddSystemPropertyArg(List<String> cmd, String key, Object value) A list of command arguments required to launch WildFly instance.Returns the base directory for the server.protected StringgetBootLogArgument(String fileName) Returns the command line argument that specifies the path the log file that should be used.Returns the configuration directory for the server.Returns the configuration filesetornullif one was not set.Returns the configuration filesetornullif one was not set.Returns the Java home path the host controller will use.Returns the JVM arguments for the host controller.Returns the Java home directory where the java executable command can be found.Returns the log directory for the server.protected StringgetLoggingPropertiesArgument(String fileName) Returns the command line argument that specifies the logging configuration.Returns the JVM arguments used for the process controller.Returns the configuration filesetReadOnlyDomainConfiguration(String)set} ornullif one was not set.Returns the configuration filesetReadOnlyHostConfiguration(String)set} ornullif one was not set.Returns the Java home path the servers will use.protected DomainCommandBuildergetThis()Returns the concrete builder.protected PathnormalizePath(String path) Resolves the path to the path relative to the WildFly home directory.protected PathnormalizePath(Path parent, String path) Resolves the path relative to the parent and normalizes it.static DomainCommandBuilderCreates a command builder for a domain instance of WildFly.static DomainCommandBuilderCreates a command builder for a domain instance of WildFly.static DomainCommandBuilderCreates a command builder for a domain instance of WildFly.static DomainCommandBuilderCreates a command builder for a domain instance of WildFly.Sets the server argument--admin-only.Sets the option (--backupto keep a copy of the persistent domain configuration even if this host is not a domain controller.setBaseDirectory(String baseDir) Sets the base directory to use.setBaseDirectory(Path baseDir) Sets the base directory to use.setBindAddressHint(String address) Sets the system propertyjboss.bind.addressto the address given.setBindAddressHint(String interfaceName, String address) Sets the system propertyjboss.bind.address.$INTERFACEto the address given where$INTERFACEis theinterfaceNameparameter.Sets the option (--cached-dc) to boot using a locally cached copy of the domain configuration.Sets the configuration directory to be used for configuration files.Sets the configuration directory to be used for configuration files.setDomainConfiguration(String configFile) Sets the configuration file for the domain (domain.xml).setHostConfiguration(String configFile) Sets the configuration file for the host controller (host.xml).setHostControllerJavaHome(String javaHome) Sets the Java home for the host controller.setHostControllerJavaHome(Path javaHome) Sets the Java home for the host controller.Sets the JVM arguments for the host controller ignoringnullvalues in the collection.setHostControllerJavaOptions(String... args) Sets the JVM arguments for the host controller ignoringnullvalues in the array.Sets the address on which the host controller should listen for communication from the process controller (interprocess-hc-address).setInterProcessHostControllerPort(int port) Sets the port on which the host controller should listen for communication from the process controller (interprocess-hc-address).Sets the port on which the host controller should listen for communication from the process controller (interprocess-hc-address).setLogDirectory(String path) Sets the log directory to be used for log files.setLogDirectory(Path path) Sets the log directory to be used for log files.setMasterAddressHint(String address) Sets the system propertyjboss.domain.primary.address.setMasterPortHint(int port) Sets the system propertyjboss.domain.primary.port.setMasterPortHint(String port) Sets the system propertyjboss.domain.primary.port.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.setMulticastAddressHint(String address) Sets the system propertyjboss.default.multicast.addressto the address given.setProcessControllerAddress(String address) Sets the address on which the process controller listens for communication from processes it controls.Sets the JVM arguments for the process controller ignoringnullvalues in the collection.setProcessControllerJavaOptions(String... args) Sets the JVM arguments for the process controller ignoringnullvalues in the array.setProcessControllerPort(int port) Sets the port on which the process controller listens for communication from processes it controls.Sets the port on which the process controller listens for communication from processes it controls.setPropertiesFile(String file) Sets the properties file to use for the server ornullto remove the file.setPropertiesFile(Path file) Sets the properties file to use for the server ornullto remove the file.setReadOnlyDomainConfiguration(String configFile) Sets the read only configuration file for the domain (domain.xml).setReadOnlyHostConfiguration(String configFile) Sets the read only configuration file for the host controller (host.xml).setServerJavaHome(String javaHome) Sets the Java home for the servers that are launched in the domain.setServerJavaHome(Path javaHome) Sets the Java home for the servers that are launched in the domain.setStability(String stability) Sets the stability level of the standalone server process.Sets the server argument--start-mode=suspend.setUseSecurityManager(boolean useSecMgr) Sets whether or not the security manager option,-secmgr, should be used.Methods inherited from class org.wildfly.core.launcher.JBossModulesCommandBuilder
addJavaOption, addJavaOptions, addJavaOptions, addModuleOption, addModuleOptions, addModuleOptions, addServerArg, build, getJavaOptions, getModulePaths, getModulesJarName, getServerArg, getServerArguments, getWildFlyHome, of, setJavaHome, setJavaHome, setJavaOptions, setJavaOptions, setModuleOptions, setModuleOptions, setModulesLockless, setModulesMetrics, setSingleServerArg, useSecurityManagerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.core.launcher.CommandBuilder
build
-
Method Details
-
of
Creates a command builder for a domain instance of WildFly. Uses the system propertyjava.hometo find the java executable required for the default Java home.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
of
Creates a command builder for a domain instance of WildFly. Uses the system propertyjava.hometo find the java executable required for the default Java home.- Parameters:
wildflyHome- the path to the WildFly home directory- Returns:
- a new builder
-
of
Creates a command builder for a domain instance of WildFly.- Parameters:
wildflyHome- the path to the WildFly home directoryjavaHome- the path to the default Java home directory- Returns:
- a new builder
-
of
Creates a command builder for a domain instance of WildFly.- Parameters:
wildflyHome- the path to the WildFly home directoryjavaHome- the path default to the Java home directory- Returns:
- a new builder
-
setBackup
Sets the option (--backupto keep a copy of the persistent domain configuration even if this host is not a domain controller.- Returns:
- the builder
-
setCachedDomainController
Sets the option (--cached-dc) to boot using a locally cached copy of the domain configuration.- Returns:
- the builder
- See Also:
-
setInterProcessHostControllerAddress
Sets the address on which the host controller should listen for communication from the process controller (interprocess-hc-address). Ignoresnullvalues.- Parameters:
address- the address- Returns:
- the builder
-
setInterProcessHostControllerPort
Sets the port on which the host controller should listen for communication from the process controller (interprocess-hc-address). Ignoresnullvalues or values less than 0.- Parameters:
port- the port- Returns:
- the builder
- Throws:
NumberFormatException- if the port is not a valid integer
-
setInterProcessHostControllerPort
Sets the port on which the host controller should listen for communication from the process controller (interprocess-hc-address). Ignores values less than 0.- Parameters:
port- the port- Returns:
- the builder
-
setMasterAddressHint
Sets the system propertyjboss.domain.primary.address. In a default slave host configuration this is used to configure the address of the master host controller. Ignoresnullvalues. Note: This option only works if the standard system property has not been removed from the remote host. If the system property was removed the address provided has no effect.- Parameters:
address- the address- Returns:
- the builder
-
setMasterPortHint
Sets the system propertyjboss.domain.primary.port. In a default slave host configuration this is used to configure the port of the master host controller. Ignoresnullvalues or values less than 0. Note: This option only works if the standard system property has not been removed from the remote host. If the system property was removed the port provided has no effect.- Parameters:
port- the port- Returns:
- the builder
- Throws:
NumberFormatException- if the port is not a valid integer
-
setMasterPortHint
Sets the system propertyjboss.domain.primary.port. In a default slave host configuration this is used to configure the port of the master host controller. Ignores values less than 0. Note: This option only works if the standard system property has not been removed from the remote host. If the system property was removed the port provided has no effect.- Parameters:
port- the port- Returns:
- the builder
-
setProcessControllerAddress
Sets the address on which the process controller listens for communication from processes it controls. Ignoresnullvalues.- Parameters:
address- the address- Returns:
- the builder
-
setProcessControllerPort
Sets the port on which the process controller listens for communication from processes it controls. Ignoresnullvalues or values less than 0.- Parameters:
port- the port- Returns:
- the builder
- Throws:
NumberFormatException- if the port is not a valid integer
-
setProcessControllerPort
Sets the port on which the process controller listens for communication from processes it controls. Ignores values less than 0.- Parameters:
port- the port- Returns:
- the builder
-
setBaseDirectory
Sets the base directory to use. The default is$JBOSS_HOME/standalone.- Parameters:
baseDir- the base directory ornullto resolve the base directory- Returns:
- the builder
-
setBaseDirectory
Sets the base directory to use. The default is$JBOSS_HOME/standalone.- Parameters:
baseDir- the base directory ornullto resolve the base directory- Returns:
- the builder
-
setHostControllerJavaHome
Sets the Java home for the host controller. If thejavaHomeis notnullthen the java executable will be resolved and used to launch the host processor. If thejavaHomeisnullthe same java executable will be used to launch the host controller that launched the process controller.- Parameters:
javaHome- the java home to set, can benullto use the default- Returns:
- the builder
-
setHostControllerJavaHome
Sets the Java home for the host controller. If thejavaHomeis notnullthen the java executable will be resolved and used to launch the host processor. If thejavaHomeisnullthe same java executable will be used to launch the host controller that launched the process controller.- Parameters:
javaHome- the java home to set, can benullto use the default- Returns:
- the builder
-
getHostControllerJavaHome
Returns the Java home path the host controller will use.- Returns:
- the path to the Java home for the host controller
-
setHostConfiguration
Sets the configuration file for the host controller (host.xml). The file must be in theconfigurationdirectory. A value ofnullis ignored.- Parameters:
configFile- the configuration file name- Returns:
- the builder
-
getHostConfiguration
Returns the configuration filesetornullif one was not set.- Returns:
- the configuration file set or
nullif not set
-
setReadOnlyHostConfiguration
Sets the read only configuration file for the host controller (host.xml). The file must be in theconfigurationdirectory. A value ofnullis ignored This will override any previous value set.- Parameters:
configFile- the configuration file name ornull- Returns:
- the builder
-
getReadOnlyHostConfiguration
Returns the configuration filesetReadOnlyHostConfiguration(String)set} ornullif one was not set.- Returns:
- the configuration file set or
nullif not set
-
setDomainConfiguration
Sets the configuration file for the domain (domain.xml). The file must be in theconfigurationdirectory. A value ofnullis ignored. This will override any previous value set.- Parameters:
configFile- the configuration file name- Returns:
- the builder
-
getDomainConfiguration
Returns the configuration filesetornullif one was not set.- Returns:
- the configuration file set or
nullif not set
-
setReadOnlyDomainConfiguration
Sets the read only configuration file for the domain (domain.xml). The file must be in theconfigurationdirectory. A value ofnullis ignored This will override any previous value set.- Parameters:
configFile- the configuration file name ornull- Returns:
- the builder
-
getReadOnlyDomainConfiguration
Returns the configuration filesetReadOnlyDomainConfiguration(String)set} ornullif one was not set.- Returns:
- the configuration file set or
nullif not set
-
addHostControllerJavaOption
Adds a JVM argument to the host controller ignoringnullvalues.- Parameters:
arg- the argument to add- Returns:
- the builder
-
addHostControllerJavaOptions
Adds a JVM arguments to the host controller ignoringnullvalues.- Parameters:
args- the arguments to add- Returns:
- the builder
-
addHostControllerJavaOptions
Adds a JVM arguments to the host controller ignoringnullvalues.- Parameters:
args- the arguments to add- Returns:
- the builder
-
setHostControllerJavaOptions
Sets the JVM arguments for the host controller ignoringnullvalues in the array. If the array isnullthe host controller JVM arguments are cleared and no new ones are added- Parameters:
args- the arguments to add- Returns:
- the builder
-
setHostControllerJavaOptions
Sets the JVM arguments for the host controller ignoringnullvalues in the collection. If the collection isnullthe host controller JVM arguments are cleared and no new ones are added- Parameters:
args- the arguments to add- Returns:
- the builder
-
getHostControllerJavaOptions
Returns the JVM arguments for the host controller.- Returns:
- the JVM arguments
-
addProcessControllerJavaOption
Adds a JVM argument to the process controller ignoringnullvalues.- Parameters:
arg- the argument to add- Returns:
- the builder
-
addProcessControllerJavaOptions
Adds a JVM arguments to the process controller ignoringnullvalues.- Parameters:
args- the arguments to add- Returns:
- the builder
-
addProcessControllerJavaOptions
Adds a JVM arguments to the process controller ignoringnullvalues.- Parameters:
args- the arguments to add- Returns:
- the builder
-
setProcessControllerJavaOptions
Sets the JVM arguments for the process controller ignoringnullvalues in the array. If the array isnullthe process controller JVM arguments are cleared and no new ones are added- Parameters:
args- the arguments to add- Returns:
- the builder
-
setProcessControllerJavaOptions
Sets the JVM arguments for the process controller ignoringnullvalues in the collection. If the collection isnullthe process controller JVM arguments are cleared and no new ones are added- Parameters:
args- the arguments to add- Returns:
- the builder
-
getProcessControllerJavaOptions
Returns the JVM arguments used for the process controller.- Returns:
- the JVM arguments
-
setServerJavaHome
Sets the Java home for the servers that are launched in the domain. If thejavaHomeis notnullthen the java executable will be resolved and used to launch the servers in the domain. If thejavaHomeisnullthe same java executable will be used to launch the servers in the domain that launched the process controller.- Parameters:
javaHome- the java home to set, can benullto use the default- Returns:
- the builder
-
setServerJavaHome
Sets the Java home for the servers that are launched in the domain. If thejavaHomeis notnullthen the java executable will be resolved and used to launch the servers in the domain. If thejavaHomeisnullthe same java executable will be used to launch the servers in the domain that launched the process controller.- Parameters:
javaHome- the java home to set, can benullto use the default- Returns:
- the builder
-
setStability
Sets the stability level of the standalone server process.- Parameters:
stability- a stability level- Returns:
- a reference to this builder
-
getServerJavaHome
Returns the Java home path the servers will use.- Returns:
- the path to the Java home for the servers
-
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- Overrides:
buildArgumentsin classJBossModulesCommandBuilder- Returns:
- the list of arguments required to launch WildFly
-
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
-
getBaseDirectory
Returns the base directory for the server. Example: For standalone the base directory would be$JBOSS_HOME/standalone.- Returns:
- the base directory
-
getThis
Returns the concrete builder.- Returns:
- the concrete builder
-
setUseSecurityManager
Description copied from class:JBossModulesCommandBuilderSets whether or not the security manager option,-secmgr, should be used.- Overrides:
setUseSecurityManagerin classJBossModulesCommandBuilder- Parameters:
useSecMgr-trueto use the a security manager, otherwisefalse- Returns:
- the builder
-
addModuleDir
Description copied from class:JBossModulesCommandBuilderAdds a directory to the collection of module paths.- Overrides:
addModuleDirin classJBossModulesCommandBuilder- Parameters:
moduleDir- the module directory to add- Returns:
- the builder
-
addModuleDirs
Description copied from class:JBossModulesCommandBuilderAdds all the module directories to the collection of module paths.- Overrides:
addModuleDirsin classJBossModulesCommandBuilder- Parameters:
moduleDirs- an array of module paths to add- Returns:
- the builder
-
addModuleDirs
Description copied from class:JBossModulesCommandBuilderAdds all the module directories to the collection of module paths.- Overrides:
addModuleDirsin classJBossModulesCommandBuilder- Parameters:
moduleDirs- a collection of module paths to add- Returns:
- the builder
-
setModuleDirs
Description copied from class:JBossModulesCommandBuilderReplaces any previously set module directories with the collection of module directories. The default module directory will NOT be used if this method is invoked.- Overrides:
setModuleDirsin classJBossModulesCommandBuilder- Parameters:
moduleDirs- the collection of module directories to use- Returns:
- the builder
-
setModuleDirs
Description copied from class:JBossModulesCommandBuilderReplaces any previously set module directories with the array of module directories. The default module directory will NOT be used if this method is invoked.- Overrides:
setModuleDirsin classJBossModulesCommandBuilder- Parameters:
moduleDirs- the array of module directories to use- Returns:
- the builder
-
getLogDirectory
Returns the log directory for the server.- Returns:
- the log directory
-
setLogDirectory
Sets the log directory to be used for log files. If set tonull, the default, the log directory will be resolved.- Parameters:
path- the path to the log directory ornullto have the log directory resolved- Returns:
- the builder
- Throws:
IllegalArgumentException- if the directory is not a valid directory
-
setLogDirectory
Sets the log directory to be used for log files. If set tonull, the default, the log directory will be resolved.- Parameters:
path- the path to the log directory ornullto have the log directory resolved- Returns:
- the builder
- Throws:
IllegalArgumentException- if the directory is not a valid directory
-
getConfigurationDirectory
Returns the configuration directory for the server.- Returns:
- the configuration directory
-
setConfigurationDirectory
Sets the configuration directory to be used for configuration files. If set tonull, the default, the configuration directory will be resolved.- Parameters:
path- the path to the configuration directory ornullto have the configuration directory resolved- Returns:
- the builder
- Throws:
IllegalArgumentException- if the directory is not a valid directory
-
setConfigurationDirectory
Sets the configuration directory to be used for configuration files. If set tonull, the default, the configuration directory will be resolved.- Parameters:
path- the path to the configuration directory ornullto have the configuration directory resolved- Returns:
- the builder
- Throws:
IllegalArgumentException- if the directory is not a valid directory
-
addServerArgument
Description copied from class:JBossModulesCommandBuilderAdds an argument to be passed to the server ignore the argument ifnull.- Overrides:
addServerArgumentin classJBossModulesCommandBuilder- Parameters:
arg- the argument to pass- Returns:
- the builder
-
addServerArguments
Description copied from class:JBossModulesCommandBuilderAdds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.- Overrides:
addServerArgumentsin classJBossModulesCommandBuilder- Parameters:
args- the arguments to add- Returns:
- the builder
-
addServerArguments
Description copied from class:JBossModulesCommandBuilderAdds the arguments to the collection of arguments that will be passed to the server ignoring anynullarguments.- Overrides:
addServerArgumentsin classJBossModulesCommandBuilder- Parameters:
args- the arguments to add- Returns:
- the builder
-
setAdminOnly
Sets the server argument--admin-only.- Returns:
- the builder
-
setStartSuspended
Sets the server argument--start-mode=suspend.- Returns:
- the builder
-
setBindAddressHint
Sets the system propertyjboss.bind.addressto the address given. This will override any previous value set viaJBossModulesCommandBuilder.addServerArgument(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
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 viaJBossModulesCommandBuilder.addServerArgument(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
Sets the system propertyjboss.default.multicast.addressto the address given. This will override any previous value set viaJBossModulesCommandBuilder.addServerArgument(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
-
addPropertiesFile
Adds a properties file to be passed to the server. Note that the file must exist.- Parameters:
file- the file to add- Returns:
- the builder
- Throws:
IllegalArgumentException- if the file does not exist or is not a regular file
-
addPropertiesFile
Adds a properties file to be passed to the server. Note that the file must exist.- Parameters:
file- the file to add- Returns:
- the builder
- Throws:
IllegalArgumentException- if the file does not exist or is not a regular file
-
setPropertiesFile
Sets the properties file to use for the server ornullto remove the file. Note that the file must exist.This will override any previous values set.
- Parameters:
file- the properties file to use ornull- Returns:
- the builder
- Throws:
IllegalArgumentException- if the file does not exist or is not a regular file
-
setPropertiesFile
Sets the properties file to use for the server ornullto remove the file. Note that the file must exist.This will override any previous values set.
- Parameters:
file- the properties file to use ornull- Returns:
- the builder
- Throws:
IllegalArgumentException- if the file does not exist or is not a regular file
-
getLoggingPropertiesArgument
Returns the command line argument that specifies the logging configuration.- Parameters:
fileName- the name of the configuration file- Returns:
- the command line argument
-
getBootLogArgument
Returns the command line argument that specifies the path the log file that should be used. This is generally only used on the initial boot of the server in standalone. The server will rewrite the configuration file with hard-coded values.- Parameters:
fileName- the name of the file- Returns:
- the command line argument
-
normalizePath
Resolves the path to the path relative to the WildFly home directory.- Parameters:
path- the name of the relative path- Returns:
- the normalized path
-
normalizePath
Resolves the path relative to the parent and normalizes it.- Parameters:
parent- the parent pathpath- the path- Returns:
- the normalized path
-
addSystemPropertyArg
-