Class YamlArtifact
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractYamlArtifact
-
- de.iip_ecosphere.platform.services.environment.YamlArtifact
-
public class YamlArtifact extends AbstractYamlArtifact
Information about an artifact containing services. The artifact is to be deployed. We assume that the underlying yaml file is generated, i.e., repeated information such as relations can be consistently specified.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<YamlServer>serversprivate java.util.List<YamlService>services
-
Constructor Summary
Constructors Constructor Description YamlArtifact()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description YamlServergetServer(java.lang.String id)Returns a YAML server information object based on the given id.java.util.List<YamlServer>getServers()Returns the server specification instances.YamlServicegetService(java.lang.String id)Returns a YAML service information object based on the given service id.java.util.List<YamlService>getServices()Returns the services.YamlServicegetServiceSafe(java.lang.String id)Returns a YAML service information object based on the given service id.static YamlArtifactreadFromYaml(java.io.InputStream in)Reads anYamlArtifactfrom a YAML input stream.static YamlArtifactreadFromYamlSafe(java.io.InputStream in)Reads from the given YAML input stream, closes the stream.voidsetServers(java.util.List<YamlServer> servers)Sets the server specification instances.voidsetServices(java.util.List<YamlService> services)Sets the service instances.-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractYamlArtifact
getApplication, getId, getName, getVersion, setApplication, setId, setName, setVersion
-
-
-
-
Field Detail
-
services
private java.util.List<YamlService> services
-
servers
private java.util.List<YamlServer> servers
-
-
Method Detail
-
getServices
public java.util.List<YamlService> getServices()
Returns the services.- Returns:
- the services
-
setServices
public void setServices(java.util.List<YamlService> services)
Sets the service instances. [required by SnakeYaml]- Parameters:
services- the services
-
getServers
public java.util.List<YamlServer> getServers()
Returns the server specification instances. [required by SnakeYaml]- Returns:
- the servers
-
setServers
public void setServers(java.util.List<YamlServer> servers)
Sets the server specification instances. [required by SnakeYaml]- Parameters:
servers- the servers
-
getService
public YamlService getService(java.lang.String id)
Returns a YAML service information object based on the given service id.- Parameters:
id- the service id- Returns:
- the YamlService, null if none was found
-
getServer
public YamlServer getServer(java.lang.String id)
Returns a YAML server information object based on the given id.- Parameters:
id- the server id- Returns:
- the YamlServer, null if none was found
-
getServiceSafe
public YamlService getServiceSafe(java.lang.String id)
Returns a YAML service information object based on the given service id.- Parameters:
id- the service id- Returns:
- the YamlService, a default instance if none was found
-
readFromYaml
public static YamlArtifact readFromYaml(java.io.InputStream in) throws java.io.IOException
Reads anYamlArtifactfrom a YAML input stream. The returned artifact may be invalid.- Parameters:
in- the input stream (may be null)- Returns:
- the artifact info
- Throws:
java.io.IOException- if the data cannot be read, the configuration class cannot be instantiated
-
readFromYamlSafe
public static YamlArtifact readFromYamlSafe(java.io.InputStream in)
Reads from the given YAML input stream, closes the stream. Logs errors and returns a default instance in case of failures.- Parameters:
in- the input stream (may be null)- Returns:
- the YAML artifact
-
-