Class StatusCache

java.lang.Object
de.iip_ecosphere.platform.configuration.cfg.StatusCache

public class StatusCache extends Object
Simple pre-processing cache of StatusMessage for UI display.
Author:
Holger Eichelberger, SSE
  • Field Details

    • serviceStates

      private static Map<String,Map<String,String>> serviceStates
    • statusCallback

      private static de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<de.iip_ecosphere.platform.transport.status.StatusMessage> statusCallback
  • Constructor Details

    • StatusCache

      public StatusCache()
  • Method Details

    • ensureServicePerDevice

      private static Map<String,String> ensureServicePerDevice(de.iip_ecosphere.platform.transport.status.StatusMessage message)
      Ensures the existence of a device-state map for the service message message.
      Parameters:
      message - the message
      Returns:
      the device-state map
    • handleServiceStateChange

      private static void handleServiceStateChange(de.iip_ecosphere.platform.transport.status.StatusMessage message)
      Handles a service state change.
      Parameters:
      message - the message indicating the service status change
    • getServiceStates

      public static void getServiceStates(String sId, Consumer<StatusCache.ServiceDeviceState> consumer)
      Returns the states of service sId on all known devices. If a device is not mentioned, the service is not running there.
      Parameters:
      sId - the service id
      consumer - a consumer receiving the data
    • start

      public static void start()
      Starts the status cache.
    • stop

      public static void stop()
      Stops the status cache.