Class ServiceConfiguration
java.lang.Object
org.gcube.informationsystem.resourceregistry.configuration.ServiceConfiguration
The configuration of the service, read from "service.yaml" in
WEB-INF/classes.
The file is a YAML mapping of sections (database, redis), each a mapping of
keys to scalar values. Every value is read as its string form, so a quoted and an unquoted
scalar give the same value. A missing file is an error.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the root of the deployed webapp, found from where "service.yaml" is read (<webapp>/WEB-INF/classes/"service.yaml").Returns a section of the configuration.
-
Field Details
-
FILENAME
Name of the configuration file of the service, on the classpath.- See Also:
-
-
Constructor Details
-
ServiceConfiguration
public ServiceConfiguration()Reads "service.yaml" from the classpath.- Throws:
IllegalStateException- if the file is missing or is not a mapping of sections
-
-
Method Details
-
getWebappRoot
Returns the root of the deployed webapp, found from where "service.yaml" is read (<webapp>/WEB-INF/classes/"service.yaml").- Returns:
- the root, or
nullwhen "service.yaml" is not read from a directory of the file system (e.g. from a jar)
-
section
Returns a section of the configuration.- Parameters:
name- the name of the section- Returns:
- its keys and values, or
nullwhen the file has no such section
-