Class 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 Detail

      • services

        private java.util.List<YamlService> services
      • servers

        private java.util.List<YamlServer> servers
    • Constructor Detail

      • YamlArtifact

        public YamlArtifact()
    • 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 an YamlArtifact from 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