Class TransportToWsConverter<T>

java.lang.Object
de.iip_ecosphere.platform.services.environment.services.TransportConverter<T>
de.iip_ecosphere.platform.services.environment.services.TransportToWsConverter<T>
Type Parameters:
T - the data type

public class TransportToWsConverter<T> extends TransportConverter<T>
Transport converter for websockets. Use createServer(ServerAddress) to create a server.
Author:
Holger Eichelberger, SSE
  • Field Details

    • SCHEMA

      public static final de.iip_ecosphere.platform.support.Schema SCHEMA
    • endpoint

      private de.iip_ecosphere.platform.support.Endpoint endpoint
    • sender

      private Sender<T> sender
    • notConnectedError

      private boolean notConnectedError
    • typeTranslator

      private de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T,String> typeTranslator
  • Constructor Details

    • TransportToWsConverter

      public TransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint)
      Creates a transport to web socket converter running the server in this instance. The type translator will be the default one from TransportToWsConverter(String, Class, Endpoint, TypeTranslator).
      Parameters:
      transportStream - the transport stream to listen on
      dataType - the data type to listen for
      endpoint - the server endpoint
    • TransportToWsConverter

      public TransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T,String> translator)
      Creates a transport to web socket converter running the server in this instance.
      Parameters:
      transportStream - the transport stream to listen on
      dataType - the data type to listen for
      endpoint - the server endpoint
      translator - the optional type translator
      See Also:
  • Method Details

    • createInstances

      public static <T> TransportConverter.ConverterInstances<T> createInstances(String transportStream, Class<T> cls, de.iip_ecosphere.platform.support.Server server, de.iip_ecosphere.platform.transport.connectors.TransportSetup setup, Service service)
      Creates a combined set of server/converter instances.
      Type Parameters:
      T - the data type
      Parameters:
      transportStream - the transport stream to create the converter for
      cls - the data class
      server - the server, may be existing or null
      setup - the transport setup
      service - the service to create the instances for
      Returns:
      the instances object for server/converter
    • createServer

      public static de.iip_ecosphere.platform.support.Server createServer(de.iip_ecosphere.platform.support.ServerAddress address)
      Creates a server instance for the given address.
      Parameters:
      address - the address
      Returns:
      the server instance
    • setExcludedFields

      public void setExcludedFields(Set<String> excludedFields)
      Description copied from class: TransportConverter
      Sets the excluded fields for TransportConverter.handleNew(Object).
      Overrides:
      setExcludedFields in class TransportConverter<T>
      Parameters:
      excludedFields - the excluded fields, may be null or empty for none
    • initializeSubmodel

      public void initializeSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder)
      Description copied from class: TransportConverter
      Initializes the submodel.
      Overrides:
      initializeSubmodel in class TransportConverter<T>
      Parameters:
      smBuilder - the submodel builder
    • start

      public void start(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aasSetup)
      Description copied from class: TransportConverter
      Starts the transport tracer.
      Overrides:
      start in class TransportConverter<T>
      Parameters:
      aasSetup - the AAS setup to use
    • stop

      public void stop()
      Stops the transport, deletes the AAS.
      Overrides:
      stop in class TransportConverter<T>
    • handleNew

      protected void handleNew(T data)
      Description copied from class: TransportConverter
      Handles a new trace record. Called upon arrival. [protected for mocking]
      Specified by:
      handleNew in class TransportConverter<T>
      Parameters:
      data - the trace record data
    • getLogger

      protected static de.iip_ecosphere.platform.support.logging.Logger getLogger()
      Returns the logger.
      Returns:
      the logger
    • getEndpoint

      public de.iip_ecosphere.platform.support.Endpoint getEndpoint()
      Description copied from class: TransportConverter
      Returns the server endpoint to connect to.
      Overrides:
      getEndpoint in class TransportConverter<T>
      Returns:
      the server endpoint, may be null for none, in particular if this connector is hosted by an AAS
    • createWatcher

      public TransportConverter.Watcher<T> createWatcher(int period)
      Description copied from class: TransportConverter
      Creates a watcher instance.
      Specified by:
      createWatcher in class TransportConverter<T>
      Parameters:
      period - the watching period in ms
      Returns:
      the watcher
    • getTypeTranslator

      public de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T,String> getTypeTranslator()
      Returns the type translator.
      Returns:
      the type translator