Merge branch 'develop' into release/1.2

This commit is contained in:
Robert von Burg 2022-12-02 07:20:57 +01:00
commit 6840fda3b3
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
2 changed files with 20 additions and 17 deletions

View File

@ -65,7 +65,7 @@
<jersey.version>2.34</jersey.version>
<gson.version>2.8.9</gson.version>
<hikaricp.version>5.0.0</hikaricp.version>
<postgresql.version>42.4.1</postgresql.version>
<postgresql.version>42.4.3</postgresql.version>
<antlr.version>4.9.3</antlr.version>
<annotation.version>1.3.2</annotation.version>
<activation.version>1.1.1</activation.version>

View File

@ -14,7 +14,6 @@ import java.util.stream.StreamSupport;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.execution.ExecutionHandler;
import li.strolch.handler.operationslog.OperationsLog;
import li.strolch.model.Locator;
import li.strolch.model.ParameterBag;
@ -118,23 +117,27 @@ public class PlcStateHandler {
tx.commitOnClose();
}
if (existingState != connectionState && this.container.hasComponent(OperationsLog.class)) {
OperationsLog operationsLog = this.container.getComponent(OperationsLog.class);
Locator msgLocator = locatorFor(TYPE_PLC, plcSession.plcId).append(
ConnectionState.class.getSimpleName());
operationsLog.updateState(realm, msgLocator, LogMessageState.Inactive);
if (connectionState == ConnectionState.Connected) {
operationsLog.addMessage(new LogMessage(realm, plcSession.plcId, msgLocator, LogSeverity.Info,
LogMessageState.Information, PlcGwSrvI18n.bundle, "execution.plc.connected").value(
"plc", plcSession.plcId));
} else {
operationsLog.addMessage(new LogMessage(realm, plcSession.plcId, msgLocator, LogSeverity.Error,
LogMessageState.Active, PlcGwSrvI18n.bundle, "execution.plc.connectionLost").value(
"plc", plcSession.plcId));
if (existingState != connectionState) {
if (this.container.hasComponent(OperationsLog.class)) {
OperationsLog operationsLog = this.container.getComponent(OperationsLog.class);
Locator msgLocator = locatorFor(TYPE_PLC, plcSession.plcId).append(
ConnectionState.class.getSimpleName());
operationsLog.updateState(realm, msgLocator, LogMessageState.Inactive);
if (connectionState == ConnectionState.Connected) {
operationsLog.addMessage(
new LogMessage(realm, plcSession.plcId, msgLocator, LogSeverity.Info,
LogMessageState.Information, PlcGwSrvI18n.bundle,
"execution.plc.connected").value("plc", plcSession.plcId));
} else {
operationsLog.addMessage(
new LogMessage(realm, plcSession.plcId, msgLocator, LogSeverity.Error,
LogMessageState.Active, PlcGwSrvI18n.bundle,
"execution.plc.connectionLost").value("plc", plcSession.plcId));
}
}
}
this.gwServerHandler.notifyConnectionState(plcSession.plcId, connectionState);
this.gwServerHandler.notifyConnectionState(plcSession.plcId, connectionState);
}
});
} catch (Exception e) {
logger.error("Failed to handle gateway connection state notification!", e);