Package nl.esciencecenter.xenon.utils
Class JavaJobDescription
- java.lang.Object
-
- nl.esciencecenter.xenon.schedulers.JobDescription
-
- nl.esciencecenter.xenon.utils.JavaJobDescription
-
public class JavaJobDescription extends JobDescription
A JobDescription specialized in Java applications. A JavaJobDescription will use the Java specific information provided by the user to build the command line arguments of the JobDescription.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from class nl.esciencecenter.xenon.schedulers.JobDescription
DEFAULT_START_TIME
-
-
Constructor Summary
Constructors Constructor Description JavaJobDescription()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addJavaArgument(java.lang.String javaArgument)
void
addJavaClasspathElement(java.lang.String element)
void
addJavaOption(java.lang.String option)
Adds a JVM option.void
addJavaSystemProperty(java.lang.String key, java.lang.String value)
Adds a system property to the current set of system properties.boolean
equals(java.lang.Object obj)
java.util.List<java.lang.String>
getArguments()
Constructs the command line arguments from the class path, the JVM options, the system properties, the main and the java arguments.java.util.List<java.lang.String>
getArguments(char pathSeparator)
Constructs the command line arguments from the class path, the JVM options, the system properties, the main and the java arguments.java.lang.String
getExecutable()
Returns the executable.java.util.List<java.lang.String>
getJavaArguments()
Returns the arguments for the main class.java.util.List<java.lang.String>
getJavaClasspath()
Returns the java class path.java.lang.String
getJavaMain()
Returns the main class of the java application.java.util.List<java.lang.String>
getJavaOptions()
Returns the JVM options.java.util.Map<java.lang.String,java.lang.String>
getJavaSystemProperties()
Returns the java system properties.int
hashCode()
void
setArguments(java.lang.String... arguments)
This method should not be used.void
setJavaArguments(java.lang.String... javaArguments)
Sets the arguments of the java main class.void
setJavaClasspath(java.lang.String... javaClasspath)
Sets the java class path.void
setJavaMain(java.lang.String main)
Sets the main class.void
setJavaOptions(java.lang.String... options)
Sets the JVM options.void
setJavaSystemProperties(java.util.Map<java.lang.String,java.lang.String> systemProperties)
Sets the system properties.java.lang.String
toString()
-
Methods inherited from class nl.esciencecenter.xenon.schedulers.JobDescription
addArgument, addEnvironment, addSchedulerArgument, getCoresPerTask, getEnvironment, getMaxMemory, getMaxRuntime, getName, getQueueName, getSchedulerArguments, getStartTime, getStderr, getStdin, getStdout, getTasks, getTasksPerNode, getTempSpace, getWorkingDirectory, isStartPerJob, isStartPerTask, setCoresPerTask, setEnvironment, setExecutable, setMaxMemory, setMaxRuntime, setName, setQueueName, setSchedulerArguments, setStartPerJob, setStartPerTask, setStartTime, setStderr, setStdin, setStdout, setTasks, setTasksPerNode, setTempSpace, setWorkingDirectory
-
-
-
-
Method Detail
-
getJavaOptions
public java.util.List<java.lang.String> getJavaOptions()
Returns the JVM options.- Returns:
- the JVM options.
-
setJavaOptions
public void setJavaOptions(java.lang.String... options)
Sets the JVM options.- Parameters:
options
- the JVM options.
-
addJavaOption
public void addJavaOption(java.lang.String option)
Adds a JVM option.- Parameters:
option
- the JVM option.
-
getJavaSystemProperties
public java.util.Map<java.lang.String,java.lang.String> getJavaSystemProperties()
Returns the java system properties.- Returns:
- the java system properties.
-
setJavaSystemProperties
public void setJavaSystemProperties(java.util.Map<java.lang.String,java.lang.String> systemProperties)
Sets the system properties. A system property should be passed as a key value pair <"a", "b">, not as <"-Da", "b">, Xenon will add the -D to the property.- Parameters:
systemProperties
- the system properties.
-
addJavaSystemProperty
public void addJavaSystemProperty(java.lang.String key, java.lang.String value)
Adds a system property to the current set of system properties. The key of the system property should not start with "-D".- Parameters:
key
- the key of the system property to be addedvalue
- the value belonging to the key of the system property to be added
-
getJavaMain
public java.lang.String getJavaMain()
Returns the main class of the java application.- Returns:
- the main class.
-
setJavaMain
public void setJavaMain(java.lang.String main)
Sets the main class.- Parameters:
main
- the main class.
-
getJavaArguments
public java.util.List<java.lang.String> getJavaArguments()
Returns the arguments for the main class.- Returns:
- the arguments for the main class
-
setJavaArguments
public void setJavaArguments(java.lang.String... javaArguments)
Sets the arguments of the java main class.- Parameters:
javaArguments
- the arguments of the java main class.
-
addJavaArgument
public void addJavaArgument(java.lang.String javaArgument)
-
setArguments
public void setArguments(java.lang.String... arguments)
This method should not be used. This method will throw an runtime exception when used. The methodssetJavaClasspath(String...)
,setJavaOptions(String[])
,setJavaSystemProperties(Map)
,setJavaMain(String)
andsetJavaArguments(String[])
should be used to construct the command line arguments.- Overrides:
setArguments
in classJobDescription
- Parameters:
arguments
- do not use
-
getArguments
public java.util.List<java.lang.String> getArguments()
Constructs the command line arguments from the class path, the JVM options, the system properties, the main and the java arguments.- Overrides:
getArguments
in classJobDescription
- Returns:
- the command line arguments
-
getArguments
public java.util.List<java.lang.String> getArguments(char pathSeparator)
Constructs the command line arguments from the class path, the JVM options, the system properties, the main and the java arguments.- Parameters:
pathSeparator
- the seperator to use in the classpath. Defaults to the unix path seperator ':'- Returns:
- the command line arguments
-
getExecutable
public java.lang.String getExecutable()
Returns the executable. If no executable is set the default executable will be "java".- Overrides:
getExecutable
in classJobDescription
- Returns:
- Returns the executable.
-
getJavaClasspath
public java.util.List<java.lang.String> getJavaClasspath()
Returns the java class path.- Returns:
- the java class path.
-
setJavaClasspath
public void setJavaClasspath(java.lang.String... javaClasspath)
Sets the java class path. Will automatically add separators when multiple elements are given.- Parameters:
javaClasspath
- the class path to be set.
-
addJavaClasspathElement
public void addJavaClasspathElement(java.lang.String element)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classJobDescription
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classJobDescription
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classJobDescription
-
-