Class StatusCache
- java.lang.Object
-
- de.iip_ecosphere.platform.configuration.StatusCache
-
public class StatusCache extends java.lang.ObjectSimple pre-processing cache ofStatusMessagefor UI display.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatusCache.ServiceDeviceStateDenotes the state of a service on a certain device.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>serviceStatesprivate static de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<de.iip_ecosphere.platform.transport.status.StatusMessage>statusCallback
-
Constructor Summary
Constructors Constructor Description StatusCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.Map<java.lang.String,java.lang.String>ensureServicePerDevice(de.iip_ecosphere.platform.transport.status.StatusMessage message)Ensures the existence of a device-state map for the service messagemessage.static voidgetServiceStates(java.lang.String sId, java.util.function.Consumer<StatusCache.ServiceDeviceState> consumer)Returns the states of servicesIdon all known devices.private static voidhandleServiceStateChange(de.iip_ecosphere.platform.transport.status.StatusMessage message)Handles a service state change.static voidstart()Starts the status cache.static voidstop()Stops the status cache.
-
-
-
Field Detail
-
serviceStates
private static java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> serviceStates
-
statusCallback
private static de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<de.iip_ecosphere.platform.transport.status.StatusMessage> statusCallback
-
-
Method Detail
-
ensureServicePerDevice
private static java.util.Map<java.lang.String,java.lang.String> ensureServicePerDevice(de.iip_ecosphere.platform.transport.status.StatusMessage message)
Ensures the existence of a device-state map for the service messagemessage.- 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(java.lang.String sId, java.util.function.Consumer<StatusCache.ServiceDeviceState> consumer)Returns the states of servicesIdon all known devices. If a device is not mentioned, the service is not running there.- Parameters:
sId- the service idconsumer- a consumer receiving the data
-
start
public static void start()
Starts the status cache.
-
stop
public static void stop()
Stops the status cache.
-
-