java.lang.Object
test.de.iip_ecosphere.platform.ecsRuntime.kubernetes.TransportK8S

public class TransportK8S extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private de.iip_ecosphere.platform.support.ServerAddress
     
    private de.iip_ecosphere.platform.transport.connectors.TransportConnector
     
    private static boolean
     
    private de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType
     
    private static String
     
    private static String
     
    private static de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.K8SJavaProxy
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    TransportK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType proxyType, de.iip_ecosphere.platform.support.ServerAddress addr, String serverIP, String serverPort, boolean tlsCheck)
    Creates a transport K8S java proxy instance, it will be either MasterProxy or WorkerProxy.
  • Method Summary

    Modifier and Type
    Method
    Description
    de.iip_ecosphere.platform.support.ServerAddress
    Returns the server address.
    de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType
    Returns the proxyType of K8S java proxy.
    private byte[]
    getResponseMessage(byte[] responseBody, String formattedHeaderResponse)
    Prepare the response for each message in the stream.
    Returns the server IP address.
    Returns the server port.
    boolean
    Returns the Transport stop status.
    private byte[]
    sendToK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received)
    Asserts that expected and the received value in callback contain the same values.
    private static byte[]
    sendToMasterTransport(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received)
    Asserts that expected and the received value in callback contain the same values.
    private byte[]
    sendWatchToK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received, de.iip_ecosphere.platform.transport.connectors.TransportConnector connector)
    Asserts that expected and the received value in callback contain the same values.
    void
    setAddr(de.iip_ecosphere.platform.support.ServerAddress addr)
    Set the server address.
    void
    setProxyType(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType proxyType)
    Set the proxyType of K8S java proxy.
    void
    setServerIP(String serverIP)
    Set the server IP address.
    void
    setServerPort(String serverPort)
    Set the server port.
    void
    setStopped(boolean isStopped)
    Set the Transport stop status.
    void
    start(TransportK8STLS transportK8STLS)
    The start method to run the server proxy.

    Methods inherited from class java.lang.Object

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

    • serverIP

      private static String serverIP
    • serverPort

      private static String serverPort
    • transportK8SJavaProxy

      private static de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.K8SJavaProxy transportK8SJavaProxy
    • isStopped

      private static boolean isStopped
    • addr

      private de.iip_ecosphere.platform.support.ServerAddress addr
    • proxyType

      private de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType proxyType
    • cl1

      private de.iip_ecosphere.platform.transport.connectors.TransportConnector cl1
  • Constructor Details

    • TransportK8S

      public TransportK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType proxyType, de.iip_ecosphere.platform.support.ServerAddress addr, String serverIP, String serverPort, boolean tlsCheck)
      Creates a transport K8S java proxy instance, it will be either MasterProxy or WorkerProxy.
      Parameters:
      proxyType - the type of the proxy (MasterProxy or WorkerProxy)
      addr - the address of the transport proxy
      serverIP - the IP Address of the server
      serverPort - the port of the server
      tlsCheck - check to use tls security
  • Method Details

    • getAddr

      public de.iip_ecosphere.platform.support.ServerAddress getAddr()
      Returns the server address.
      Returns:
      the server address
    • setAddr

      public void setAddr(de.iip_ecosphere.platform.support.ServerAddress addr)
      Set the server address.
      Parameters:
      addr - the server address
    • getServerIP

      public String getServerIP()
      Returns the server IP address.
      Returns:
      the server IP address
    • setServerIP

      public void setServerIP(String serverIP)
      Set the server IP address.
      Parameters:
      serverIP - the server IP address
    • getServerPort

      public String getServerPort()
      Returns the server port.
      Returns:
      the server port
    • setServerPort

      public void setServerPort(String serverPort)
      Set the server port.
      Parameters:
      serverPort - the server port
    • getProxyType

      public de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType getProxyType()
      Returns the proxyType of K8S java proxy.
      Returns:
      the proxyType of K8S java proxy
    • setProxyType

      public void setProxyType(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.ProxyType proxyType)
      Set the proxyType of K8S java proxy.
      Parameters:
      proxyType - the proxyType of K8S java proxy
    • isStopped

      public boolean isStopped()
      Returns the Transport stop status.
      Returns:
      the Transport stop status
    • setStopped

      public void setStopped(boolean isStopped) throws IOException
      Set the Transport stop status.
      Parameters:
      isStopped - the Transport stop status
      Throws:
      IOException
    • start

      public void start(TransportK8STLS transportK8STLS)
      The start method to run the server proxy.
      Parameters:
      transportK8STLS - the tls security information
    • sendToMasterTransport

      private static byte[] sendToMasterTransport(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received)
      Asserts that expected and the received value in callback contain the same values.
      Parameters:
      received - transport Message
      Returns:
      the response from the master transport
    • sendToK8S

      private byte[] sendToK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received)
      Asserts that expected and the received value in callback contain the same values.
      Parameters:
      received - transport Message
      Returns:
      the response from the K8S apiserver;
    • sendWatchToK8S

      private byte[] sendWatchToK8S(de.iip_ecosphere.platform.ecsRuntime.kubernetes.proxy.TransportMessage received, de.iip_ecosphere.platform.transport.connectors.TransportConnector connector) throws IOException
      Asserts that expected and the received value in callback contain the same values.
      Parameters:
      received - transport Message
      connector - the connector to send the watch stream messages
      Returns:
      the response from the K8S apiserver;
      Throws:
      IOException
    • getResponseMessage

      private byte[] getResponseMessage(byte[] responseBody, String formattedHeaderResponse)
      Prepare the response for each message in the stream.
      Parameters:
      responseBody - the response to prepare
      formattedHeaderResponse - the response header if it is the first response
      Returns:
      the responseBody the prepared response to send