@PublicAPI public class ForkEnvironment extends Object implements Serializable
javaHome
, javaArguments
, classpath
, ...Modifier and Type | Field and Description |
---|---|
static String |
DOCKER_FORK_WINDOWS2LINUX |
Constructor and Description |
---|
ForkEnvironment() |
ForkEnvironment(ForkEnvironment forkEnvironment)
Copy constructor.
|
ForkEnvironment(String workingDir) |
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalClasspath(String... values)
Add one or more classpath entries to the forked JVM classpath
|
void |
addAdditionalClasspath(String value)
Add a new additional Classpath value.
|
void |
addJVMArgument(String value)
Add a new JVM argument value.
|
void |
addPreJavaCommand(String commandOrParameter)
Add an item to the list of (command + argument) which will be prepended to the java command
|
String |
addSystemEnvironmentVariable(String name,
String value)
Add a new system environment variables value from its name and value.
|
static String |
convertToLinuxClassPath(String windowsClassPath) |
static String |
convertToLinuxPath(String windowsPath) |
static String |
convertToLinuxPathInJVMArgument(String jvmArgument) |
boolean |
equals(Object o) |
List<String> |
getAdditionalClasspath()
Return a copy of the additional classpath, empty list if no arguments.
|
Script<?> |
getEnvScript()
Get the environment script.
|
String |
getJavaHome()
Returns the javaHome.
|
List<String> |
getJVMArguments()
Return a copy of the JVM arguments, empty list if no arguments.
|
List<String> |
getPreJavaCommand()
Returns the list of (command + argument) which will be prepended to the java command
e.g.
|
Map<String,String> |
getSystemEnvironment()
Return a copy of the system environment, empty map if no variables.
|
String |
getSystemEnvironmentVariable(String name)
Get the system environment variable value associated with the given name.
|
String |
getWorkingDir()
Return the working Directory.
|
int |
hashCode() |
boolean |
isDockerWindowsToLinux()
Returns true if the current fork environment aims at running a linux docker container on a windows host
|
void |
setDockerWindowsToLinux(boolean dockerWindowsToLinux)
Set true if the current fork environment aims at running a linux docker container on a windows host
|
void |
setEnvScript(Script<?> script)
Set the environment script value to the given script value.
|
void |
setJavaHome(String javaHome)
Sets the javaHome to the given javaHome value.
|
void |
setPreJavaCommand(List<String> preJavaCommand)
Sets the list of (command + argument) which will be prepended to the java command
|
void |
setWorkingDir(String workingDir)
Set the working directory value to the given workingDir value.
|
String |
toString() |
public static final String DOCKER_FORK_WINDOWS2LINUX
public ForkEnvironment()
public ForkEnvironment(ForkEnvironment forkEnvironment)
forkEnvironment
- the object to copypublic ForkEnvironment(String workingDir)
public String getJavaHome()
public void setJavaHome(String javaHome)
javaHome
- the javaHome to set.public String getWorkingDir()
public void setWorkingDir(String workingDir)
workingDir
- the working directory to setpublic Map<String,String> getSystemEnvironment()
public String getSystemEnvironmentVariable(String name)
name
- the name of the variable value to getnull
if the variable does not exist.public String addSystemEnvironmentVariable(String name, String value)
name
- the name of the variable to addvalue
- the the value associated to the given nameIllegalArgumentException
- if name is nullpublic List<String> getJVMArguments()
public void addJVMArgument(String value)
value
- the value of the property to be added.IllegalArgumentException
- if value is null.public List<String> getAdditionalClasspath()
public void addAdditionalClasspath(String... values)
values
- one or more classpath entriespublic void addAdditionalClasspath(String value)
value
- the additional Classpath to add.IllegalArgumentException
- if value is null.public List<String> getPreJavaCommand()
public void setPreJavaCommand(List<String> preJavaCommand)
preJavaCommand
- a list containing the command + arguments, e.g. ["docker", "run", "--rm"]public void addPreJavaCommand(String commandOrParameter)
commandOrParameter
- the command (e.g. "docker") or an argument (e.g. "run")public Script<?> getEnvScript()
public void setEnvScript(Script<?> script)
This script allows the user to programmatically set system variables, JVM arguments, additional classpath, etc.
Use the binding variable name forkEnvironment
to fill this object in this given script.
script
- the script to setpublic boolean isDockerWindowsToLinux()
public void setDockerWindowsToLinux(boolean dockerWindowsToLinux)
dockerWindowsToLinux
- public static String convertToLinuxPathInJVMArgument(String jvmArgument)