Class InstalledDependenciesSetup
java.lang.Object
de.iip_ecosphere.platform.support.setup.AbstractSetup
de.iip_ecosphere.platform.support.setup.InstalledDependenciesSetup
- All Implemented Interfaces:
PluginsSetup
Provides access to installed dependencies on the actual resource, e.g., the location of a specific Java version
or of Python. The instantiation process shall provide a YamlFile called
installedDependencies.yml linking
symbolic program/dependency names to installation folders where the respective binary can be found. The information
shall be taken from service dependencies in the configuration model.
Java versions shall be mapped to keys like "JAVAx" where x represents the Java major version, older
just without the leading "1.", newer as the major version, see getJavaKey() for the actual version.- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the default configuration file with extension (no path).static final StringJust the name of the default configuration file, no extension, no path.private static InstalledDependenciesSetupstatic final Stringstatic final Stringstatic final StringThe prefix for Conda program/dependency keys.static final StringThe prefix for Java program/dependency keys.static final StringThe prefix for Conda program/dependency keys.static final StringFields inherited from class de.iip_ecosphere.platform.support.setup.AbstractSetup
DEFAULT_OVERRIDE_FNAME, PARAM_PLUGINS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddDefaultEntry(String key, File value) Adds a default location entry.getEnvironmentMapping(String key, String dflt) Returns an environment mapping for the given environmentkey.static InstalledDependenciesSetupReturns a singleton instance viareadFromYaml().static StringReturns the program/dependency key for the actual Java version.getLocation(String key) Returns the location for a given program/dependency key.Returns the locations.static FileReturns a location fromgetInstance()viagetLocation(String), throws an exception if no such location is present.static InstalledDependenciesSetupReads the default yaml file, taking into account the system propertyPROPERTY_PATH, the current directory as additional resource folder and the file system root.static InstalledDependenciesSetupreadFromYaml(String fileName) Reads the given yaml file via theResourceLoader, taking into account the system propertyPROPERTY_PATH, the current directory as additional resource folder and the file system root.voidsetEnvMappings(Map<String, String> envMappings) Changes the locations.voidsetLocation(String key, File location) Sets a single location, but ensures the default values.voidsetLocations(Map<String, File> locations) Changes the locations.private voidSets up the default values.Methods inherited from class de.iip_ecosphere.platform.support.setup.AbstractSetup
getDefaultFileName, getPluginsFolder, isNotEmpty, readFromYaml, readFromYaml, readFromYaml, readFromYaml, readFromYaml, readFromYamlWithPath, readFromYamlWithPath, readFromYamlWithPath, readFromYamlWithPath, readMappingFromYaml, readMappingFromYaml, setDefaultFileName, setPluginsFolder, setPluginsFolderFile
-
Field Details
-
PROPERTY_PATH
- See Also:
-
DEFAULT_NAME
Just the name of the default configuration file, no extension, no path.- See Also:
-
DEFAULT_FNAME
Name of the default configuration file with extension (no path).- See Also:
-
KEY_PREFIX_JAVA
The prefix for Java program/dependency keys.- See Also:
-
KEY_PREFIX_PYTHON
The prefix for Conda program/dependency keys.- See Also:
-
KEY_PREFIX_CONDA
The prefix for Conda program/dependency keys.- See Also:
-
KEY_JAVA_8
- See Also:
-
KEY_JAVA_11
- See Also:
-
instance
-
locations
-
envMappings
-
-
Constructor Details
-
InstalledDependenciesSetup
public InstalledDependenciesSetup()Sets up default values before overriding.
-
-
Method Details
-
setupDefaults
private void setupDefaults()Sets up the default values. -
addDefaultEntry
Adds a default location entry. Does not override existing values.- Parameters:
key- the keyvalue- the value
-
getJavaKey
Returns the program/dependency key for the actual Java version.- Returns:
- the key
-
getLocations
Returns the locations.- Returns:
- the locations
-
getLocation
Returns the location for a given program/dependency key.- Parameters:
key- the key- Returns:
- the location, may be null for none
-
getEnvironmentMapping
Returns an environment mapping for the given environmentkey. Environment mappings are generic environment key/name mappings and could, e.g., be used to map a service-specific Python Conda environment to an implemented environment produced during container generation.- Parameters:
key- the keydflt- the default value to return if there is no mapping- Returns:
- the mapped value or
dflt
-
setLocations
Changes the locations. [required by SnakeYaml]- Parameters:
locations- the locations
-
setEnvMappings
Changes the locations. [required by SnakeYaml]- Parameters:
envMappings- the mappings
-
setLocation
Sets a single location, but ensures the default values.- Parameters:
key- the key to setlocation- the new location
-
readFromYaml
Reads the given yaml file via theResourceLoader, taking into account the system propertyPROPERTY_PATH, the current directory as additional resource folder and the file system root.- Parameters:
fileName- the file to read- Returns:
- the setup instance, if not found the default instance
-
readFromYaml
Reads the default yaml file, taking into account the system propertyPROPERTY_PATH, the current directory as additional resource folder and the file system root.- Returns:
- the setup instance, if not found the default instance
-
getInstance
Returns a singleton instance viareadFromYaml().- Returns:
- the instance
-
location
Returns a location fromgetInstance()viagetLocation(String), throws an exception if no such location is present.- Parameters:
key- the key to look for- Returns:
- the location
- Throws:
ExecutionException- if the key cannot be found
-