Class ServerAddressHolder

java.lang.Object
de.iip_ecosphere.platform.support.iip_aas.config.ServerAddressHolder
Direct Known Subclasses:
NetworkManagerAas.ManagedServerAddressHolder, TlsServerAddressHolder

public class ServerAddressHolder extends Object
A proxy for ServerAddress as we do not want to have setters there.
Author:
Holger Eichelberger, SSE
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
     
    private static final de.iip_ecosphere.platform.support.json.Json
     
    private int
     
    private boolean
     
    private de.iip_ecosphere.platform.support.Schema
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance (deserialization).
    Creates an instance by copying data from a given instance.
    ServerAddressHolder(de.iip_ecosphere.platform.support.Schema schema, String host, int port)
    Creates an instance.
    ServerAddressHolder(de.iip_ecosphere.platform.support.ServerAddress addr)
    Creates an instance from a given instance (serialization).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the host value.
    int
    Returns the port value.
    de.iip_ecosphere.platform.support.Schema
    Returns the schema value.
    de.iip_ecosphere.platform.support.ServerAddress
    Returns a server address instance constructed from the data in this instance.
    boolean
    Returns whether the port is set to be determined dynamically.
    boolean
    Returns whether the server is already running and shall not be started.
    static de.iip_ecosphere.platform.support.ServerAddress
    Reads a ServerAddress from a JSON string.
    void
    Defines the host value.
    void
    setPort(int port)
    Defines the port value.
    void
    setRunning(boolean running)
    Changes whether the server is already running.
    void
    setSchema(de.iip_ecosphere.platform.support.Schema schema)
    Defines the schema value.
    static String
    toJson(de.iip_ecosphere.platform.support.ServerAddress address)
    Turns a ServerAddress into JSON.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAPPER

      private static final de.iip_ecosphere.platform.support.json.Json MAPPER
    • port

      private int port
    • host

      private String host
    • schema

      private de.iip_ecosphere.platform.support.Schema schema
    • running

      private boolean running
  • Constructor Details

    • ServerAddressHolder

      public ServerAddressHolder()
      Creates an instance (deserialization).
    • ServerAddressHolder

      public ServerAddressHolder(de.iip_ecosphere.platform.support.Schema schema, String host, int port)
      Creates an instance.
      Parameters:
      schema - the schema
      host - the host name
      port - the port
    • ServerAddressHolder

      public ServerAddressHolder(de.iip_ecosphere.platform.support.ServerAddress addr)
      Creates an instance from a given instance (serialization).
      Parameters:
      addr - the instance to take data from
    • ServerAddressHolder

      public ServerAddressHolder(ServerAddressHolder holder)
      Creates an instance by copying data from a given instance.
      Parameters:
      holder - the holder to copy from
  • Method Details

    • getPort

      public int getPort()
      Returns the port value.
      Returns:
      the port (may be negative, indicates ephemerial)
    • setPort

      public void setPort(int port)
      Defines the port value. [required by data mapper]
      Parameters:
      port - the new value of port (may be negative, indicates ephemerial)
    • getHost

      public String getHost()
      Returns the host value.
      Returns:
      the host
    • isEphmemeral

      public boolean isEphmemeral()
      Returns whether the port is set to be determined dynamically.
      Returns:
      true for ephemeral, false else
    • setHost

      public void setHost(String host)
      Defines the host value. [required by data mapper]
      Parameters:
      host - the new value of host
    • getSchema

      public de.iip_ecosphere.platform.support.Schema getSchema()
      Returns the schema value.
      Returns:
      the schema
    • setSchema

      public void setSchema(de.iip_ecosphere.platform.support.Schema schema)
      Defines the schema value. [required by data mapper]
      Parameters:
      schema - the new value of schema
    • isRunning

      public boolean isRunning()
      Returns whether the server is already running and shall not be started.
      Returns:
      whether we can assume that it is already running
    • setRunning

      public void setRunning(boolean running)
      Changes whether the server is already running. [snakeyaml]
      Parameters:
      running - whether we can assume that it is already running
    • getServerAddress

      public de.iip_ecosphere.platform.support.ServerAddress getServerAddress()
      Returns a server address instance constructed from the data in this instance.
      Returns:
      the server address
    • serverAddressFromJson

      public static de.iip_ecosphere.platform.support.ServerAddress serverAddressFromJson(Object json)
      Reads a ServerAddress from a JSON string.
      Parameters:
      json - the JSON value, usually a String
      Returns:
      the server address or null if reading fails
      See Also:
    • toJson

      public static String toJson(de.iip_ecosphere.platform.support.ServerAddress address)
      Turns a ServerAddress into JSON.
      Parameters:
      address - the address (may be null)
      Returns:
      the JSON string or an empty string in case of problems/no address
      See Also: