public final class SysUtils
extends java.lang.Object
SysUtils
class provides utility methods to interact with the environment.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MICROTESK_HOME
Name of the environment variable that stores the path to MicroTESK home folder.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getArchDir(java.lang.String archDirs,
java.lang.String archName)
Gets the path to the directory of that holds files related to the specified architecture.
|
static java.lang.String |
getCurrentDir()
Results current directory path.
|
static java.lang.String |
getHomeDir()
Returns the path to MicroTESK home folder, which is stored
in the
MICROTESK_HOME environment variable. |
static java.lang.String |
getModelsJarPath()
Returns absolute path to the
models.jar file that stores compiled microprocessor
models. |
static java.net.URL |
getResourceUrl(java.lang.String resourceName)
Returns an URL for the specified resource file stored in
microtesk.jar . |
static java.lang.Object |
loadFromModel(java.lang.String className)
Loads a class with the specified name from
models.jar . |
static Model |
loadModel(java.lang.String modelName)
Loads a model with the specified name from
models.jar . |
static Plugin |
loadPlugin(java.lang.String className)
Loads a plug-in implemented by the specified class from
microtesk.jar . |
public static final java.lang.String MICROTESK_HOME
public static java.lang.String getHomeDir()
MICROTESK_HOME
environment variable.java.lang.IllegalStateException
- if the MICROTESK_HOME
environment variable
is not defined.public static java.lang.String getCurrentDir()
public static java.lang.String getModelsJarPath()
models.jar
file that stores compiled microprocessor
models. The file's relative file is $MICROTESK_HOME/lib/jars/models.jar
.models.jar
file.java.lang.IllegalStateException
- if the MICROTESK_HOME
environment variable
is not defined.public static Model loadModel(java.lang.String modelName)
models.jar
.modelName
- Model name.java.lang.IllegalArgumentException
- if the model name is null
or
if for some reason it cannot be loaded.public static java.lang.Object loadFromModel(java.lang.String className)
models.jar
.className
- Name of the class to be loaded.java.lang.IllegalArgumentException
- if the class name is null
or
if for some reason the class cannot be loaded.public static Plugin loadPlugin(java.lang.String className)
microtesk.jar
.className
- Name of the plug-in class.java.lang.IllegalArgumentException
- if the class name is null
or
if for some reason the class cannot be loaded.public static java.net.URL getResourceUrl(java.lang.String resourceName)
microtesk.jar
.resourceName
- Resource file name.java.lang.IllegalArgumentException
- if the argument is null
.public static java.lang.String getArchDir(java.lang.String archDirs, java.lang.String archName)
The path is extracted from a string that stores a map of architecture names and
corresponding paths. The string has the following format:
name1=path1:name2=path2:...:nameN=pathN
archDirs
- String that stores a map of architectures and their directories.archName
- Architecture name.null
if no such path is found.java.lang.IllegalArgumentException
- if any of the arguments is null
.java.lang.IllegalStateException
- if the MICROTESK_HOME
environment variable is undefined.