public class DomainCommandBuilder extends Object implements CommandBuilder
default Java home
directory is used for the process controller and optionally for the
host
controller and the servers launched.Modifier and Type | Field and Description |
---|---|
protected org.wildfly.core.launcher.Environment |
environment |
Modifier and Type | Method and Description |
---|---|
DomainCommandBuilder |
addHostControllerJavaOption(String arg)
Adds a JVM argument to the host controller ignoring
null values. |
DomainCommandBuilder |
addHostControllerJavaOptions(Iterable<String> args)
Adds a JVM arguments to the host controller ignoring
null values. |
DomainCommandBuilder |
addHostControllerJavaOptions(String... args)
Adds a JVM arguments to the host controller ignoring
null values. |
T |
addModuleDir(String moduleDir)
Adds a directory to the collection of module paths.
|
T |
addModuleDirs(Iterable<String> moduleDirs)
Adds all the module directories to the collection of module paths.
|
T |
addModuleDirs(String... moduleDirs)
Adds all the module directories to the collection of module paths.
|
DomainCommandBuilder |
addProcessControllerJavaOption(String arg)
Adds a JVM argument to the process controller ignoring
null values. |
DomainCommandBuilder |
addProcessControllerJavaOptions(Iterable<String> args)
Adds a JVM arguments to the process controller ignoring
null values. |
DomainCommandBuilder |
addProcessControllerJavaOptions(String... args)
Adds a JVM arguments to the process controller ignoring
null values. |
T |
addPropertiesFile(Path file)
Adds a properties file to be passed to the server.
|
T |
addPropertiesFile(String file)
Adds a properties file to be passed to the server.
|
protected void |
addServerArg(String key,
String value) |
T |
addServerArgument(String arg)
Adds an argument to be passed to the server ignore the argument if
null . |
T |
addServerArguments(Iterable<String> args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring any
null
arguments. |
T |
addServerArguments(String... args)
Adds the arguments to the collection of arguments that will be passed to the server ignoring any
null
arguments. |
protected static void |
addSystemPropertyArg(List<String> cmd,
String key,
Object value) |
List<String> |
build()
A list of commands, including a
java executable, required to launch WildFly
instance. |
List<String> |
buildArguments()
A list of command arguments required to launch WildFly instance.
|
Path |
getBaseDirectory()
Returns the base directory for the server.
|
protected String |
getBootLogArgument(String fileName)
Returns the command line argument that specifies the path the log file that should be used.
|
Path |
getConfigurationDirectory()
Returns the configuration directory for the server.
|
String |
getDomainConfiguration()
Returns the configuration file
set or null if one was not set. |
String |
getHostConfiguration()
Returns the configuration file
set or null if one was not set. |
Path |
getHostControllerJavaHome()
Returns the Java home path the host controller will use.
|
List<String> |
getHostControllerJavaOptions()
Returns the JVM arguments for the host controller.
|
protected String |
getJavaCommand()
The java executable command found in the
Java home directory. |
protected String |
getJavaCommand(Path javaHome)
The java executable command found in the Java home directory.
|
Path |
getJavaHome()
Returns the Java home directory where the java executable command can be found.
|
Path |
getLogDirectory()
Returns the log directory for the server.
|
protected String |
getLoggingPropertiesArgument(String fileName)
Returns the command line argument that specifies the logging configuration.
|
String |
getModulePaths()
Returns the modules paths used on the command line.
|
String |
getModulesJarName()
Returns the normalized path to the
jboss-modules.jar for launching the server. |
List<String> |
getProcessControllerJavaOptions()
Returns the JVM arguments used for the process controller.
|
String |
getReadOnlyDomainConfiguration()
Returns the configuration file
setReadOnlyDomainConfiguration(String) set} or null if one was
not set. |
String |
getReadOnlyHostConfiguration()
Returns the configuration file
setReadOnlyHostConfiguration(String) set} or null if one was
not set. |
protected String |
getServerArg(String key)
Returns the first argument from the server arguments.
|
List<String> |
getServerArguments()
A collection of server command line arguments.
|
Path |
getServerJavaHome()
Returns the Java home path the servers will use.
|
protected DomainCommandBuilder |
getThis()
Returns the concrete builder.
|
Path |
getWildFlyHome()
Returns the home directory used.
|
protected Path |
normalizePath(Path parent,
String path)
Resolves the path relative to the parent and normalizes it.
|
protected Path |
normalizePath(String path)
Resolves the path to the path relative to the WildFly home directory.
|
static DomainCommandBuilder |
of(Path wildflyHome)
Creates a command builder for a domain instance of WildFly.
|
static DomainCommandBuilder |
of(Path wildflyHome,
Path javaHome)
Creates a command builder for a domain instance of WildFly.
|
static DomainCommandBuilder |
of(String wildflyHome)
Creates a command builder for a domain instance of WildFly.
|
static DomainCommandBuilder |
of(String wildflyHome,
String javaHome)
Creates a command builder for a domain instance of WildFly.
|
protected static Path |
resolveJavaHome(Path javaHome)
Deprecated.
|
T |
setAdminOnly()
Sets the server argument
--admin-only . |
DomainCommandBuilder |
setBackup()
Sets the option (
--backup to keep a copy of the persistent domain configuration even if this host is not
a domain controller. |
DomainCommandBuilder |
setBaseDirectory(Path baseDir)
Sets the base directory to use.
|
DomainCommandBuilder |
setBaseDirectory(String baseDir)
Sets the base directory to use.
|
T |
setBindAddressHint(String address)
Sets the system property
jboss.bind.address to the address given. |
T |
setBindAddressHint(String interfaceName,
String address)
Sets the system property
jboss.bind.address.$INTERFACE to the address given where $INTERFACE is
the interfaceName parameter. |
DomainCommandBuilder |
setCachedDomainController()
Sets the option (
--cached-dc ) to boot using a locally cached copy of the domain configuration. |
T |
setConfigurationDirectory(Path path)
Sets the configuration directory to be used for configuration files.
|
T |
setConfigurationDirectory(String path)
Sets the configuration directory to be used for configuration files.
|
DomainCommandBuilder |
setDomainConfiguration(String configFile)
Sets the configuration file for the domain (domain.xml).
|
DomainCommandBuilder |
setHostConfiguration(String configFile)
Sets the configuration file for the host controller (host.xml).
|
DomainCommandBuilder |
setHostControllerJavaHome(Path javaHome)
Sets the Java home for the host controller.
|
DomainCommandBuilder |
setHostControllerJavaHome(String javaHome)
Sets the Java home for the host controller.
|
DomainCommandBuilder |
setHostControllerJavaOptions(Iterable<String> args)
Sets the JVM arguments for the host controller ignoring
null values in the collection. |
DomainCommandBuilder |
setHostControllerJavaOptions(String... args)
Sets the JVM arguments for the host controller ignoring
null values in the array. |
DomainCommandBuilder |
setInterProcessHostControllerAddress(String address)
Sets the address on which the host controller should listen for communication from the process controller
(
interprocess-hc-address ). |
DomainCommandBuilder |
setInterProcessHostControllerPort(int port)
Sets the port on which the host controller should listen for communication from the process controller (
interprocess-hc-address ). |
DomainCommandBuilder |
setInterProcessHostControllerPort(String port)
Sets the port on which the host controller should listen for communication from the process controller (
interprocess-hc-address ). |
T |
setLogDirectory(Path path)
Sets the log directory to be used for log files.
|
T |
setLogDirectory(String path)
Sets the log directory to be used for log files.
|
DomainCommandBuilder |
setMasterAddressHint(String address)
Sets the system property
jboss.domain.master.address . |
DomainCommandBuilder |
setMasterPortHint(int port)
Sets the system property
jboss.domain.master.port . |
DomainCommandBuilder |
setMasterPortHint(String port)
Sets the system property
jboss.domain.master.port . |
T |
setModuleDirs(Iterable<String> moduleDirs)
Replaces any previously set module directories with the collection of module directories.
|
T |
setModuleDirs(String... moduleDirs)
Replaces any previously set module directories with the array of module directories.
|
T |
setMulticastAddressHint(String address)
Sets the system property
jboss.default.multicast.address to the address given. |
DomainCommandBuilder |
setProcessControllerAddress(String address)
Sets the address on which the process controller listens for communication from processes it controls.
|
DomainCommandBuilder |
setProcessControllerJavaOptions(Iterable<String> args)
Sets the JVM arguments for the process controller ignoring
null values in the collection. |
DomainCommandBuilder |
setProcessControllerJavaOptions(String... args)
Sets the JVM arguments for the process controller ignoring
null values in the array. |
DomainCommandBuilder |
setProcessControllerPort(int port)
Sets the port on which the process controller listens for communication from processes it controls.
|
DomainCommandBuilder |
setProcessControllerPort(String port)
Sets the port on which the process controller listens for communication from processes it controls.
|
T |
setPropertiesFile(Path file)
Sets the properties file to use for the server or
null to remove the file. |
T |
setPropertiesFile(String file)
Sets the properties file to use for the server or
null to remove the file. |
DomainCommandBuilder |
setReadOnlyDomainConfiguration(String configFile)
Sets the read only configuration file for the domain (domain.xml).
|
DomainCommandBuilder |
setReadOnlyHostConfiguration(String configFile)
Sets the read only configuration file for the host controller (host.xml).
|
DomainCommandBuilder |
setServerJavaHome(Path javaHome)
Sets the Java home for the servers that are launched in the domain.
|
DomainCommandBuilder |
setServerJavaHome(String javaHome)
Sets the Java home for the servers that are launched in the domain.
|
protected void |
setSingleServerArg(String key,
String value) |
T |
setUseSecurityManager(boolean useSecMgr)
Sets whether or not the security manager option,
-secmgr , should be used. |
boolean |
useSecurityManager()
Indicates whether or no a security manager should be used for the server launched.
|
protected static Path |
validateAndNormalizeDir(Path path,
boolean allowNull) |
protected static Path |
validateAndNormalizeDir(String path,
boolean allowNull) |
protected static Path |
validateJavaHome(Path javaHome) |
protected static Path |
validateJavaHome(String javaHome) |
protected static Path |
validateWildFlyDir(Path wildflyHome) |
protected static Path |
validateWildFlyDir(String wildflyHome) |
public static DomainCommandBuilder of(Path wildflyHome)
java.home
to find the java executable required for the default Java home.wildflyHome
- the path to the WildFly home directorypublic static DomainCommandBuilder of(String wildflyHome)
java.home
to find the java executable required for the default Java home.wildflyHome
- the path to the WildFly home directorypublic static DomainCommandBuilder of(String wildflyHome, String javaHome)
wildflyHome
- the path to the WildFly home directoryjavaHome
- the path to the default Java home directorypublic static DomainCommandBuilder of(Path wildflyHome, Path javaHome)
wildflyHome
- the path to the WildFly home directoryjavaHome
- the path default to the Java home directorypublic DomainCommandBuilder setBackup()
--backup
to keep a copy of the persistent domain configuration even if this host is not
a domain controller.public DomainCommandBuilder setCachedDomainController()
--cached-dc
) to boot using a locally cached copy of the domain configuration.setBackup()
public DomainCommandBuilder setInterProcessHostControllerAddress(String address)
interprocess-hc-address
). Ignores null
values.address
- the addresspublic DomainCommandBuilder setInterProcessHostControllerPort(String port)
interprocess-hc-address
). Ignores null
values or values less than 0.port
- the portNumberFormatException
- if the port is not a valid integerpublic DomainCommandBuilder setInterProcessHostControllerPort(int port)
interprocess-hc-address
). Ignores values less than 0.port
- the portpublic DomainCommandBuilder setMasterAddressHint(String address)
jboss.domain.master.address
. In a default slave host configuration this is used
to configure the address of the master host controller. Ignores null
values.
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.address
- the addresspublic DomainCommandBuilder setMasterPortHint(String port)
jboss.domain.master.port
. In a default slave host configuration this is used
to configure the port of the master host controller. Ignores null
values 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.port
- the portNumberFormatException
- if the port is not a valid integerpublic DomainCommandBuilder setMasterPortHint(int port)
jboss.domain.master.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.port
- the portpublic DomainCommandBuilder setProcessControllerAddress(String address)
null
values.address
- the addresspublic DomainCommandBuilder setProcessControllerPort(String port)
null
values or values less than 0.port
- the portNumberFormatException
- if the port is not a valid integerpublic DomainCommandBuilder setProcessControllerPort(int port)
port
- the portpublic DomainCommandBuilder setBaseDirectory(String baseDir)
$JBOSS_HOME/standalone
.baseDir
- the base directory or null
to resolve the base directorypublic DomainCommandBuilder setBaseDirectory(Path baseDir)
$JBOSS_HOME/standalone
.baseDir
- the base directory or null
to resolve the base directorypublic DomainCommandBuilder setHostControllerJavaHome(String javaHome)
javaHome
is not null
then the java executable will be resolved and used to launch the
host processor. If the javaHome
is null
the same java executable will be used to launch the host
controller that launched the process controller.javaHome
- the java home to set, can be null
to use the defaultpublic DomainCommandBuilder setHostControllerJavaHome(Path javaHome)
javaHome
is not null
then the java executable will be resolved and used to launch the
host processor. If the javaHome
is null
the same java executable will be used to launch the host
controller that launched the process controller.javaHome
- the java home to set, can be null
to use the defaultpublic Path getHostControllerJavaHome()
Java home
will be used.public DomainCommandBuilder setHostConfiguration(String configFile)
configuration
directory. A value of null
is ignored.configFile
- the configuration file namepublic String getHostConfiguration()
set
or null
if one was not set.null
if not setpublic DomainCommandBuilder setReadOnlyHostConfiguration(String configFile)
configuration
directory. A value of null
is ignored
This will override any previous value set.configFile
- the configuration file name or null
public String getReadOnlyHostConfiguration()
setReadOnlyHostConfiguration(String)
set} or null
if one was
not set.null
if not setpublic DomainCommandBuilder setDomainConfiguration(String configFile)
configuration
directory. A value of null
is ignored.
This will override any previous value set.configFile
- the configuration file namepublic String getDomainConfiguration()
set
or null
if one was not set.null
if not setpublic DomainCommandBuilder setReadOnlyDomainConfiguration(String configFile)
configuration
directory. A value of null
is ignored
This will override any previous value set.configFile
- the configuration file name or null
public String getReadOnlyDomainConfiguration()
setReadOnlyDomainConfiguration(String)
set} or null
if one was
not set.null
if not setpublic DomainCommandBuilder addHostControllerJavaOption(String arg)
null
values.arg
- the argument to addpublic DomainCommandBuilder addHostControllerJavaOptions(String... args)
null
values.args
- the arguments to addpublic DomainCommandBuilder addHostControllerJavaOptions(Iterable<String> args)
null
values.args
- the arguments to addpublic DomainCommandBuilder setHostControllerJavaOptions(String... args)
null
values in the array.
If the array is null
the host controller JVM arguments are cleared and no new ones are addedargs
- the arguments to addpublic DomainCommandBuilder setHostControllerJavaOptions(Iterable<String> args)
null
values in the collection.
If the collection is null
the host controller JVM arguments are cleared and no new ones are addedargs
- the arguments to addpublic List<String> getHostControllerJavaOptions()
public DomainCommandBuilder addProcessControllerJavaOption(String arg)
null
values.arg
- the argument to addpublic DomainCommandBuilder addProcessControllerJavaOptions(String... args)
null
values.args
- the arguments to addpublic DomainCommandBuilder addProcessControllerJavaOptions(Iterable<String> args)
null
values.args
- the arguments to addpublic DomainCommandBuilder setProcessControllerJavaOptions(String... args)
null
values in the array.
If the array is null
the process controller JVM arguments are cleared and no new ones are addedargs
- the arguments to addpublic DomainCommandBuilder setProcessControllerJavaOptions(Iterable<String> args)
null
values in the collection.
If the collection is null
the process controller JVM arguments are cleared and no new ones are addedargs
- the arguments to addpublic List<String> getProcessControllerJavaOptions()
public DomainCommandBuilder setServerJavaHome(String javaHome)
javaHome
is not null
then the java executable will be resolved and used to launch the
servers in the domain. If the javaHome
is null
the same java executable will be used to launch
the servers in the domain that launched the process controller.javaHome
- the java home to set, can be null
to use the defaultpublic DomainCommandBuilder setServerJavaHome(Path javaHome)
javaHome
is not null
then the java executable will be resolved and used to launch the
servers in the domain. If the javaHome
is null
the same java executable will be used to launch
the servers in the domain that launched the process controller.javaHome
- the java home to set, can be null
to use the defaultpublic Path getServerJavaHome()
Java home
will be used.public List<String> buildArguments()
CommandBuilder
java
executable command.buildArguments
in interface CommandBuilder
public List<String> build()
CommandBuilder
java
executable, required to launch WildFly
instance.build
in interface CommandBuilder
public Path getJavaHome()
java.home
, should be used.public Path getBaseDirectory()
$JBOSS_HOME/standalone
.protected DomainCommandBuilder getThis()
public T setUseSecurityManager(boolean useSecMgr)
-secmgr
, should be used.useSecMgr
- true
to use the a security manager, otherwise false
public boolean useSecurityManager()
true
if a security manager should be used, otherwise false
public T addModuleDir(String moduleDir)
moduleDir
- the module directory to addIllegalArgumentException
- if the path is null
public T addModuleDirs(String... moduleDirs)
moduleDirs
- an array of module paths to addIllegalArgumentException
- if any of the module paths are invalid or null
public T addModuleDirs(Iterable<String> moduleDirs)
moduleDirs
- a collection of module paths to addIllegalArgumentException
- if any of the module paths are invalid or null
public T setModuleDirs(Iterable<String> moduleDirs)
moduleDirs
- the collection of module directories to useIllegalArgumentException
- if any of the module paths are invalid or null
public T setModuleDirs(String... moduleDirs)
moduleDirs
- the array of module directories to useIllegalArgumentException
- if any of the module paths are invalid or null
public String getModulePaths()
path separator
public Path getLogDirectory()
public T setLogDirectory(String path)
null
, the default, the log directory will be resolved.path
- the path to the log directory or null
to have the log directory resolvedIllegalArgumentException
- if the directory is not a valid directorypublic T setLogDirectory(Path path)
null
, the default, the log directory will be resolved.path
- the path to the log directory or null
to have the log directory resolvedIllegalArgumentException
- if the directory is not a valid directorypublic Path getConfigurationDirectory()
public T setConfigurationDirectory(String path)
null
, the default, the configuration directory will be resolved.path
- the path to the configuration directory or null
to have the configuration directory resolvedIllegalArgumentException
- if the directory is not a valid directorypublic T setConfigurationDirectory(Path path)
null
, the default, the configuration directory will be resolved.path
- the path to the configuration directory or null
to have the configuration directory resolvedIllegalArgumentException
- if the directory is not a valid directorypublic T addServerArgument(String arg)
null
.arg
- the argument to passpublic T addServerArguments(String... args)
null
arguments.args
- the arguments to addpublic T addServerArguments(Iterable<String> args)
null
arguments.args
- the arguments to addpublic T setAdminOnly()
--admin-only
.public T setBindAddressHint(String address)
jboss.bind.address
to the address given.
This will override any previous value set via 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.address
- the address to set the bind address topublic T setBindAddressHint(String interfaceName, String address)
jboss.bind.address.$INTERFACE
to the address given where $INTERFACE
is
the interfaceName
parameter. For example in the default configuration passing management
for the
interfaceName
parameter would result in the system property jboss.bind.address.management
being
set to the address provided.
This will override any previous value set via 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.interfaceName
- the name of the interface of the binding addressaddress
- the address to bind the management interface topublic T setMulticastAddressHint(String address)
jboss.default.multicast.address
to the address given.
This will override any previous value set via 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.address
- the address to set the multicast system property topublic T addPropertiesFile(String file)
file
- the file to addIllegalArgumentException
- if the file does not exist or is not a regular filepublic T addPropertiesFile(Path file)
file
- the file to addIllegalArgumentException
- if the file does not exist or is not a regular filepublic T setPropertiesFile(String file)
null
to remove the file. Note that the file must exist.
This will override any previous values set.
file
- the properties file to use or null
IllegalArgumentException
- if the file does not exist or is not a regular filepublic T setPropertiesFile(Path file)
null
to remove the file. Note that the file must exist.
This will override any previous values set.
file
- the properties file to use or null
IllegalArgumentException
- if the file does not exist or is not a regular filepublic Path getWildFlyHome()
protected String getJavaCommand()
Java home
directory.protected String getJavaCommand(Path javaHome)
javaHome
- the path to the Java home directoryprotected String getLoggingPropertiesArgument(String fileName)
fileName
- the name of the configuration fileprotected String getBootLogArgument(String fileName)
fileName
- the name of the filepublic String getModulesJarName()
jboss-modules.jar
for launching the server.jboss-modules.jar
protected Path normalizePath(String path)
path
- the name of the relative pathprotected Path normalizePath(Path parent, String path)
parent
- the parent pathpath
- the pathpublic List<String> getServerArguments()
protected String getServerArg(String key)
key
- the key to the argumentnull
@Deprecated protected static Path resolveJavaHome(Path javaHome)
protected static Path validateAndNormalizeDir(String path, boolean allowNull)
Copyright © 2023 JBoss by Red Hat. All rights reserved.