Package org.gcube.smartgears
Class ServiceConfiguration
java.lang.Object
org.gcube.smartgears.ServiceConfiguration
The configuration of a service, read from "service.yaml" in its
WEB-INF/classes, the file
the provisioning writes for each environment.
The file is a YAML mapping of sections, 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 key without a value is left out. A missing file, or one that is not a mapping of sections, is an error: a service does not start silently with default values.
The class is in the war of the service, so get() reads the file of that service and keeps it
for the life of the application.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ServiceConfigurationget()Returns the configuration of the service, read from "service.yaml" the first time.requiredSection(String name) Returns a section the service cannot work without.Returns a section of the configuration.
-
Field Details
-
FILENAME
The name of the configuration file of the service, on its class path.- See Also:
-
-
Method Details
-
get
Returns the configuration of the service, read from "service.yaml" the first time.- Returns:
- the configuration of the service
- Throws:
IllegalStateException- if the file is missing, cannot be read or is not a mapping of sections
-
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
-
requiredSection
Returns a section the service cannot work without.- Parameters:
name- the name of the section- Returns:
- its keys and values
- Throws:
IllegalStateException- if the file has no such section
-