public class StandaloneCommandBuilder extends Object implements CommandBuilder
| Modifier and Type | Field and Description |
|---|---|
protected org.wildfly.core.launcher.Environment |
environment |
| Modifier and Type | Method and Description |
|---|---|
StandaloneCommandBuilder |
addJavaOption(String jvmArg)
Adds a JVM argument to the command ignoring
null arguments. |
StandaloneCommandBuilder |
addJavaOptions(Iterable<String> javaOpts)
Adds the collection of JVM arguments to the command.
|
StandaloneCommandBuilder |
addJavaOptions(String... javaOpts)
Adds the array of JVM arguments to the command.
|
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.
|
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.
|
StandaloneCommandBuilder |
addSecurityProperties(Map<String,String> properties)
Adds all the security properties to be passed to the server.
|
StandaloneCommandBuilder |
addSecurityProperty(String key)
Adds a security property to be passed to the server with a
null value. |
StandaloneCommandBuilder |
addSecurityProperty(String key,
String value)
Adds a security property 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.
|
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.
|
List<String> |
getJavaOptions()
Returns the JVM arguments.
|
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. |
String |
getReadOnlyServerConfiguration()
Returns the configuration file
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.
|
String |
getServerConfiguration()
Returns the configuration file
set or null if one was not set. |
protected StandaloneCommandBuilder |
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 StandaloneCommandBuilder |
of(Path wildflyHome)
Creates a command builder for a standalone instance of WildFly.
|
static StandaloneCommandBuilder |
of(String wildflyHome)
Creates a command builder for a standalone instance of WildFly.
|
protected static Path |
resolveJavaHome(Path javaHome)
Deprecated.
|
T |
setAdminOnly()
Sets the server argument
--admin-only. |
StandaloneCommandBuilder |
setBaseDirectory(Path baseDir)
Sets the base directory to use.
|
StandaloneCommandBuilder |
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. |
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.
|
StandaloneCommandBuilder |
setDebug()
Sets the debug argument for the JVM with a default port of
8787. |
StandaloneCommandBuilder |
setDebug(boolean suspend,
int port)
Sets the debug JPDA remote socket debugging argument.
|
StandaloneCommandBuilder |
setDebug(int port)
Sets the debug argument for the JVM.
|
StandaloneCommandBuilder |
setJavaHome(Path javaHome)
Sets the Java home where the Java executable can be found.
|
StandaloneCommandBuilder |
setJavaHome(String javaHome)
Sets the Java home where the Java executable can be found.
|
StandaloneCommandBuilder |
setJavaOptions(Iterable<String> javaOpts)
Sets the JVM arguments to use.
|
StandaloneCommandBuilder |
setJavaOptions(String... javaOpts)
Sets the JVM arguments to use.
|
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.
|
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.
|
StandaloneCommandBuilder |
setModulesLockless(boolean b)
Set to
true to use JBoss Modules lockless mode. |
StandaloneCommandBuilder |
setModulesMetrics(boolean b)
Set to
true to gather metrics for JBoss Modules. |
T |
setMulticastAddressHint(String address)
Sets the system property
jboss.default.multicast.address to the address given. |
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. |
StandaloneCommandBuilder |
setServerConfiguration(String configFile)
Sets the configuration file for the server.
|
StandaloneCommandBuilder |
setServerReadOnlyConfiguration(String configFile)
Sets the configuration file for the server.
|
protected void |
setSingleServerArg(String key,
String value) |
T |
setStartSuspended()
Sets the server argument
--start-mode=suspend. |
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 StandaloneCommandBuilder of(Path wildflyHome)
wildflyHome - the path to the WildFly home directorypublic static StandaloneCommandBuilder of(String wildflyHome)
wildflyHome - the path to the WildFly home directorypublic StandaloneCommandBuilder addJavaOption(String jvmArg)
null arguments.jvmArg - the JVM argument to addpublic StandaloneCommandBuilder addJavaOptions(String... javaOpts)
javaOpts - the array of JVM arguments to add, null arguments are ignoredpublic StandaloneCommandBuilder addJavaOptions(Iterable<String> javaOpts)
javaOpts - the collection of JVM arguments to add, null arguments are ignoredpublic StandaloneCommandBuilder setJavaOptions(Iterable<String> javaOpts)
null values in the collection.
If the collection is null the JVM arguments will be cleared and no new arguments will be added.javaOpts - the JVM arguments to usepublic StandaloneCommandBuilder setJavaOptions(String... javaOpts)
null values in the array.
If the array is null the JVM arguments will be cleared and no new arguments will be added.javaOpts - the JVM arguments to usepublic List<String> getJavaOptions()
public StandaloneCommandBuilder setDebug()
8787.public StandaloneCommandBuilder setDebug(int port)
port - the port to listen onpublic StandaloneCommandBuilder setDebug(boolean suspend, int port)
suspend - true to suspend otherwise falseport - the port to listen onpublic StandaloneCommandBuilder setBaseDirectory(String baseDir)
$JBOSS_HOME/standalone.baseDir - the base directory or null to resolve the base directorypublic StandaloneCommandBuilder setBaseDirectory(Path baseDir)
$JBOSS_HOME/standalone.baseDir - the base directory or null to resolve the base directorypublic StandaloneCommandBuilder setJavaHome(String javaHome)
javaHome - the Java home or null to use te system property java.homepublic StandaloneCommandBuilder setJavaHome(Path javaHome)
javaHome - the Java home or null to use te system property java.homepublic StandaloneCommandBuilder setModulesLockless(boolean b)
true to use JBoss Modules lockless mode.b - true to use lockless modepublic StandaloneCommandBuilder setModulesMetrics(boolean b)
true to gather metrics for JBoss Modules.b - true to gather metrics for JBoss Modules.public StandaloneCommandBuilder setServerConfiguration(String configFile)
configuration directory. A value of null will remove the configuration file.
This will override any previous value set via addServerArgument(String).configFile - the configuration file name or null to remove the configuration filepublic String getServerConfiguration()
set or null if one was not set.null if not setpublic StandaloneCommandBuilder setServerReadOnlyConfiguration(String configFile)
configuration directory. A value of null will remove the configuration file.
This will override any previous value set via addServerArgument(String).configFile - the configuration file name or null to remove the configuration filepublic String getReadOnlyServerConfiguration()
set or null if one was not set.null if not setpublic StandaloneCommandBuilder addSecurityProperty(String key)
null value.key - the property keypublic StandaloneCommandBuilder addSecurityProperty(String key, String value)
key - the property keyvalue - the property valuepublic StandaloneCommandBuilder addSecurityProperties(Map<String,String> properties)
properties - a map of the properties to add, null values are allowed in the mappublic List<String> buildArguments()
CommandBuilderjava executable command.buildArguments in interface CommandBuilderpublic List<String> build()
CommandBuilderjava executable, required to launch WildFly
instance.build in interface CommandBuilderpublic Path getJavaHome()
java.home, should be used.public Path getBaseDirectory()
$JBOSS_HOME/standalone.protected StandaloneCommandBuilder getThis()
public T setUseSecurityManager(boolean useSecMgr)
-secmgr, should be used.useSecMgr - true to use the a security manager, otherwise falsepublic boolean useSecurityManager()
true if a security manager should be used, otherwise falsepublic T addModuleDir(String moduleDir)
moduleDir - the module directory to addIllegalArgumentException - if the path is nullpublic T addModuleDirs(String... moduleDirs)
moduleDirs - an array of module paths to addIllegalArgumentException - if any of the module paths are invalid or nullpublic T addModuleDirs(Iterable<String> moduleDirs)
moduleDirs - a collection of module paths to addIllegalArgumentException - if any of the module paths are invalid or nullpublic T setModuleDirs(Iterable<String> moduleDirs)
moduleDirs - the collection of module directories to useIllegalArgumentException - if any of the module paths are invalid or nullpublic T setModuleDirs(String... moduleDirs)
moduleDirs - the array of module directories to useIllegalArgumentException - if any of the module paths are invalid or nullpublic String getModulePaths()
path separatorpublic 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 setStartSuspended()
--start-mode=suspend.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 nullIllegalArgumentException - 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 nullIllegalArgumentException - 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.jarprotected 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 © 2016 JBoss by Red Hat. All rights reserved.