public abstract class BaseClientBuilderOptions
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.lang.String> |
cfgOverrides
Unmodifiable list of P2J client bootstrap configs
|
private java.lang.String |
classPath
Class path.
|
private java.lang.String |
command
Java launcher executable name.
|
private java.lang.String |
configFile
Client configuration file.
|
private static java.util.regex.Pattern |
DEBUGGER_SUSPEND_PATTERN
The search pattern for the debugger suspend option
|
private static java.lang.String |
DEFAULT_COMMAND
Default command.
|
private static java.lang.String |
DEFAULT_PATH
Runtime calculated path to our main jar file.
|
private static java.lang.String |
DEFAULT_WORK_DIR
Default working directory.
|
private java.util.List<java.lang.String> |
defaultJvmArguments
JVM arguments.
|
private java.util.Map<java.lang.String,java.lang.String> |
envProperties
The operating system environment variables to be set at the spawned OS process.
|
private java.lang.String |
libPath
Native library path.
|
private static CentralLogger |
LOG
Logger.
|
private static java.lang.Class<?> |
MAIN_CLASS
Main class, must have a main method
|
private java.lang.ThreadLocal<java.util.List<java.lang.String>> |
runtimeJvmArguments
JVM arguments overrides.
|
private boolean |
secure
Secure socket flag.
|
private java.lang.String |
spawner
Spawner executable name.
|
private boolean |
spawnerDebugEnabled
Using optional logging in native spawn code.
|
private java.lang.String |
suspendOption
Storage for debugger suspend option
|
private java.lang.String |
workingDirectory
User's working directory.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseClientBuilderOptions(java.util.Map<java.lang.String,java.lang.String> env)
Initialize.
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
addJarsToClasspath()
Reads the classpath and the extra jars from directory, appends each entry to the default path and
checks if the file exists before compiling the final classpath.
|
java.util.List<java.lang.String> |
getCfgOverrides()
Get P2J client's bootstrap config.
|
java.lang.String |
getClassPath()
Get classpath
|
java.lang.String |
getCommand()
Get command
|
java.lang.String |
getConfigFile()
Get configuration file name.
|
private static java.lang.String |
getDefaultPath()
Get default path as the p2j.jar file location.
|
java.util.Map<java.lang.String,java.lang.String> |
getEnvProperties()
Get the
envProperties. |
java.util.List<java.lang.String> |
getJvmArguments()
Get JVM arguments
|
java.lang.String |
getLibPath()
Get native library path.
|
java.lang.Class<?> |
getMainClass()
Get the Java process main class.
|
java.lang.String |
getSpawner()
Get spawner command.
|
java.lang.String |
getSuspendOption()
Returns the debugger suspend option.
|
java.lang.String |
getWorkingDirectory()
Get user working directory.
|
boolean |
isSecure()
Get the security mode.
|
boolean |
isSpawnerDebugEnabled()
Check if native log option is required.
|
private java.lang.String |
parseDebuggerSuspendOption(java.lang.String jvmArgs,
java.lang.String defaultValue)
Get the debugger suspend option from the jvm arguments string, otherwise return null.
|
(package private) static java.lang.String |
quotedString(java.lang.String text)
When the string contains space characters a quoted string is build.
|
(package private) abstract <T> T |
read(ConfigItem<T> clientConfig,
T defaultValue)
A convenience method to read the client config with the specified default value.
|
(package private) abstract <T> T |
read(ConfigItem<T> clientConfig,
T defaultValue,
java.lang.String placeholderValue)
A convenience method to read the client config with the specified default value.
|
(package private) abstract java.lang.String |
readCfgOverrides(java.lang.String defaultValue)
Reads and returns the value of clientConfig/cfgOverrides.
|
void |
reset()
Resets the thread local value of
runtimeJvmArguments. |
private java.util.Map<java.lang.String,java.lang.String> |
resolveEnvVars(java.util.Map<java.lang.String,java.lang.String> env)
Reads the map of env vars from directory and merges it with the map of runtime env vars.
|
private java.util.List<java.lang.String> |
resolveJvmArgs(java.lang.String jvmConfig)
Parses the JVM arguments line from directory, adds the necessary 'headless' argument if missing and
returns the arguments as an unmodifiable list.
|
(package private) void |
updateJvmArgument(java.lang.String key,
java.lang.String value)
Update jvmArguments with new key and value pair.
|
private static final CentralLogger LOG
private static final java.lang.String DEFAULT_COMMAND
private static final java.lang.Class<?> MAIN_CLASS
private static final java.lang.String DEFAULT_PATH
private static final java.lang.String DEFAULT_WORK_DIR
private static final java.util.regex.Pattern DEBUGGER_SUSPEND_PATTERN
private final boolean secure
private final java.lang.String command
private final java.lang.String workingDirectory
private final java.lang.String classPath
private final java.lang.String libPath
private final java.lang.String spawner
private final java.lang.String configFile
private final boolean spawnerDebugEnabled
private final java.util.List<java.lang.String> defaultJvmArguments
private final java.lang.ThreadLocal<java.util.List<java.lang.String>> runtimeJvmArguments
private final java.lang.String suspendOption
private final java.util.Map<java.lang.String,java.lang.String> envProperties
private final java.util.List<java.lang.String> cfgOverrides
protected BaseClientBuilderOptions(java.util.Map<java.lang.String,java.lang.String> env)
env - Map of additional environment properties, in the key=value form.public void reset()
runtimeJvmArguments.public java.util.Map<java.lang.String,java.lang.String> getEnvProperties()
envProperties.public boolean isSecure()
true use a secured connection false otherwise.public java.lang.String getCommand()
public java.lang.String getClassPath()
public java.lang.String getLibPath()
public java.lang.String getWorkingDirectory()
public java.lang.String getConfigFile()
public java.util.List<java.lang.String> getJvmArguments()
public java.lang.String getSpawner()
public java.lang.Class<?> getMainClass()
public boolean isSpawnerDebugEnabled()
true use a extra logger in native code false otherwise.public java.lang.String getSuspendOption()
public java.util.List<java.lang.String> getCfgOverrides()
static java.lang.String quotedString(java.lang.String text)
text - Text to search for spaces.void updateJvmArgument(java.lang.String key,
java.lang.String value)
key - The key of a target jvm argumentvalue - Its new valueabstract <T> T read(ConfigItem<T> clientConfig, T defaultValue)
T - The type of the client config.clientConfig - The client config to read.defaultValue - The default value returned if no value found in directory.abstract <T> T read(ConfigItem<T> clientConfig, T defaultValue, java.lang.String placeholderValue)
T - The type of the client config.clientConfig - The client config to read.defaultValue - The default value returned if no value found in directory.placeholderValue - The value to replace the placeholder in the directory node name for the config.abstract java.lang.String readCfgOverrides(java.lang.String defaultValue)
defaultValue - The default value returned if no value found in directory.private java.lang.String parseDebuggerSuspendOption(java.lang.String jvmArgs,
java.lang.String defaultValue)
jvmArgs - The jvm arguments stringdefaultValue - The default valueprivate static java.lang.String getDefaultPath()
private java.lang.String addJarsToClasspath()
private java.util.Map<java.lang.String,java.lang.String> resolveEnvVars(java.util.Map<java.lang.String,java.lang.String> env)
env - The map of env vars.private java.util.List<java.lang.String> resolveJvmArgs(java.lang.String jvmConfig)
jvmConfig - The JVM arguments as read from directory.