use of org.eclipse.milo.opcua.stack.core.AttributeId in project milo by eclipse.
the class SessionSecurityDiagnosticsVariable method onStartup.
@Override
protected void onStartup() {
ServerDiagnosticsTypeNode diagnosticsNode = (ServerDiagnosticsTypeNode) server.getAddressSpaceManager().getManagedNode(Identifiers.Server_ServerDiagnostics).orElseThrow(() -> new NoSuchElementException("NodeId: " + Identifiers.Server_ServerDiagnostics));
diagnosticsEnabled.set(diagnosticsNode.getEnabledFlag());
attributeObserver = (node, attributeId, value) -> {
if (attributeId == AttributeId.Value) {
DataValue dataValue = (DataValue) value;
Object o = dataValue.getValue().getValue();
if (o instanceof Boolean) {
diagnosticsEnabled.set((Boolean) o);
}
}
};
diagnosticsNode.getEnabledFlagNode().addAttributeObserver(attributeObserver);
node.getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
ExtensionObject xo = ExtensionObject.encode(server.getSerializationContext(), session.getSessionSecurityDiagnostics().getSessionSecurityDiagnosticsDataType());
return new DataValue(new Variant(xo));
}));
node.getSessionIdNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
NodeId value = session.getSessionSecurityDiagnostics().getSessionId();
return new DataValue(new Variant(value));
}));
node.getClientUserIdOfSessionNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String value = session.getSessionSecurityDiagnostics().getClientUserIdOfSession();
return new DataValue(new Variant(value));
}));
node.getClientUserIdHistoryNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String[] value = session.getSessionSecurityDiagnostics().getClientUserIdHistory();
return new DataValue(new Variant(value));
}));
node.getAuthenticationMechanismNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String value = session.getSessionSecurityDiagnostics().getAuthenticationMechanism();
return new DataValue(new Variant(value));
}));
node.getEncodingNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String value = session.getSessionSecurityDiagnostics().getEncoding();
return new DataValue(new Variant(value));
}));
node.getTransportProtocolNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String value = session.getSessionSecurityDiagnostics().getTransportProtocol();
return new DataValue(new Variant(value));
}));
node.getSecurityModeNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
MessageSecurityMode value = session.getSessionSecurityDiagnostics().getSecurityMode();
return new DataValue(new Variant(value));
}));
node.getSecurityPolicyUriNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
String value = session.getSessionSecurityDiagnostics().getSecurityPolicyUri();
return new DataValue(new Variant(value));
}));
node.getClientCertificateNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
ByteString value = session.getSessionSecurityDiagnostics().getClientCertificate();
return new DataValue(new Variant(value));
}));
}
Aggregations