Search in sources :

Example 1 with ServerDiagnosticsTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode in project milo by eclipse.

the class ObjectNodeLoader method loadNode158.

private void loadNode158() {
    ServerDiagnosticsTypeNode node = new ServerDiagnosticsTypeNode(this.context, Identifiers.Server_ServerDiagnostics, new QualifiedName(0, "ServerDiagnostics"), new LocalizedText("en", "ServerDiagnostics"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), UByte.valueOf(0));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasComponent, Identifiers.Server_ServerDiagnostics_ServerDiagnosticsSummary.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasComponent, Identifiers.Server_ServerDiagnostics_SamplingIntervalDiagnosticsArray.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasComponent, Identifiers.Server_ServerDiagnostics_SubscriptionDiagnosticsArray.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasComponent, Identifiers.Server_ServerDiagnostics_SessionsDiagnosticsSummary.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasProperty, Identifiers.Server_ServerDiagnostics_EnabledFlag.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasTypeDefinition, Identifiers.ServerDiagnosticsType.expanded(), true));
    node.addReference(new Reference(Identifiers.Server_ServerDiagnostics, Identifiers.HasComponent, Identifiers.Server.expanded(), false));
    this.nodeManager.addNode(node);
}
Also used : ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)

Example 2 with ServerDiagnosticsTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode in project milo by eclipse.

the class ObjectNodeLoader method loadNode152.

private void loadNode152() {
    ServerDiagnosticsTypeNode node = new ServerDiagnosticsTypeNode(this.context, Identifiers.ServerType_ServerDiagnostics, new QualifiedName(0, "ServerDiagnostics"), new LocalizedText("en", "ServerDiagnostics"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), UByte.valueOf(0));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasComponent, Identifiers.ServerType_ServerDiagnostics_ServerDiagnosticsSummary.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasComponent, Identifiers.ServerType_ServerDiagnostics_SubscriptionDiagnosticsArray.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasComponent, Identifiers.ServerType_ServerDiagnostics_SessionsDiagnosticsSummary.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasProperty, Identifiers.ServerType_ServerDiagnostics_EnabledFlag.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasTypeDefinition, Identifiers.ServerDiagnosticsType.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));
    node.addReference(new Reference(Identifiers.ServerType_ServerDiagnostics, Identifiers.HasComponent, Identifiers.ServerType.expanded(), false));
    this.nodeManager.addNode(node);
}
Also used : ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) Reference(org.eclipse.milo.opcua.sdk.core.Reference) QualifiedName(org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName) LocalizedText(org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)

Example 3 with ServerDiagnosticsTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode in project milo by eclipse.

the class SessionDiagnosticsVariable 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.getSessionDiagnostics().getSessionDiagnosticsDataType());
        return new DataValue(new Variant(xo));
    }));
    node.getSessionIdNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        NodeId value = session.getSessionDiagnostics().getSessionId();
        return new DataValue(new Variant(value));
    }));
    node.getSessionNameNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        String value = session.getSessionDiagnostics().getSessionName();
        return new DataValue(new Variant(value));
    }));
    node.getClientDescriptionNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getClientDescription());
        return new DataValue(new Variant(value));
    }));
    node.getServerUriNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        String value = session.getSessionDiagnostics().getServerUri();
        return new DataValue(new Variant(value));
    }));
    node.getEndpointUrlNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        String value = session.getSessionDiagnostics().getEndpointUrl();
        return new DataValue(new Variant(value));
    }));
    node.getLocaleIdsNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        String[] value = session.getSessionDiagnostics().getLocaleIds();
        return new DataValue(new Variant(value));
    }));
    node.getActualSessionTimeoutNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        Double value = session.getSessionDiagnostics().getActualSessionTimeout();
        return new DataValue(new Variant(value));
    }));
    node.getMaxResponseMessageSizeNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = session.getSessionDiagnostics().getMaxResponseMessageSize();
        return new DataValue(new Variant(value));
    }));
    node.getClientConnectionTimeNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        DateTime value = session.getSessionDiagnostics().getClientConnectionTime();
        return new DataValue(new Variant(value));
    }));
    node.getClientLastContactTimeNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        DateTime value = session.getSessionDiagnostics().getClientLastContactTime();
        return new DataValue(new Variant(value));
    }));
    node.getCurrentSubscriptionsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = session.getSessionDiagnostics().getCurrentSubscriptionsCount();
        return new DataValue(new Variant(value));
    }));
    node.getCurrentMonitoredItemsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = session.getSessionDiagnostics().getCurrentMonitoredItemsCount();
        return new DataValue(new Variant(value));
    }));
    node.getCurrentPublishRequestsInQueueNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = session.getSessionDiagnostics().getCurrentPublishRequestsInQueue();
        return new DataValue(new Variant(value));
    }));
    node.getTotalRequestCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getTotalRequestCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getUnauthorizedRequestCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(session.getSessionDiagnostics().getUnauthorizedRequestCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getReadCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getReadCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getHistoryReadCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getHistoryReadCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getWriteCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getWriteCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getHistoryUpdateCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getHistoryUpdateCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getCallCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getCallCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getCreateMonitoredItemsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getCreateMonitoredItemsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getModifyMonitoredItemsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getModifyMonitoredItemsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getSetMonitoringModeCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getSetMonitoringModeCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getSetTriggeringCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getSetTriggeringCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getDeleteMonitoredItemsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getDeleteMonitoredItemsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getCreateSubscriptionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getCreateSubscriptionCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getModifySubscriptionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getModifySubscriptionCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getSetPublishingModeCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getSetPublishingModeCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getPublishCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getPublishCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getRepublishCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getRepublishCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getTransferSubscriptionsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getTransferSubscriptionsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getDeleteSubscriptionsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getDeleteSubscriptionsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getAddNodesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getAddNodesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getAddReferencesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getAddReferencesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getDeleteNodesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getDeleteNodesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getDeleteReferencesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getDeleteReferencesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getBrowseCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getBrowseCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getBrowseNextCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getBrowseNextCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getTranslateBrowsePathsToNodeIdsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getTranslateBrowsePathsToNodeIdsCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getQueryFirstCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getQueryFirstCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getQueryNextCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getQueryNextCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getRegisterNodesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getRegisterNodesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
    node.getUnregisterNodesCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        ExtensionObject value = ExtensionObject.encode(server.getSerializationContext(), session.getSessionDiagnostics().getUnregisterNodesCount().getServiceCounter());
        return new DataValue(new Variant(value));
    }));
}
Also used : NodeId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) UInteger(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) SessionDiagnosticsVariableTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.SessionDiagnosticsVariableTypeNode) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) Util.diagnosticValueFilter(org.eclipse.milo.opcua.sdk.server.diagnostics.variables.Util.diagnosticValueFilter) DateTime(org.eclipse.milo.opcua.stack.core.types.builtin.DateTime) AbstractLifecycle(org.eclipse.milo.opcua.sdk.server.AbstractLifecycle) Session(org.eclipse.milo.opcua.sdk.server.Session) AttributeObserver(org.eclipse.milo.opcua.sdk.server.nodes.AttributeObserver) OpcUaServer(org.eclipse.milo.opcua.sdk.server.OpcUaServer) Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) Unsigned.uint(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned.uint) ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) AttributeId(org.eclipse.milo.opcua.stack.core.AttributeId) NoSuchElementException(java.util.NoSuchElementException) Identifiers(org.eclipse.milo.opcua.stack.core.Identifiers) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) DateTime(org.eclipse.milo.opcua.stack.core.types.builtin.DateTime) Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) NodeId(org.eclipse.milo.opcua.stack.core.types.builtin.NodeId) UInteger(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) NoSuchElementException(java.util.NoSuchElementException)

Example 4 with ServerDiagnosticsTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode in project milo by eclipse.

the class ServerDiagnosticsSummaryVariable 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(), server.getDiagnosticsSummary().getServerDiagnosticsSummaryDataType());
        return new DataValue(new Variant(xo));
    }));
    node.getServerViewCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getCurrentViewCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getCurrentSessionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getCurrentSessionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getCumulatedSessionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getCumulatedSessionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getSecurityRejectedSessionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getSecurityRejectedSessionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getRejectedSessionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getRejectedSessionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getSessionTimeoutCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getSessionTimeoutCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getSessionAbortCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getSessionAbortCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getPublishingIntervalCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getPublishingIntervalCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getCurrentSubscriptionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getCurrentSubscriptionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getCumulatedSubscriptionCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = uint(server.getDiagnosticsSummary().getCumulatedSubscriptionCount().longValue());
        return new DataValue(new Variant(value));
    }));
    node.getSecurityRejectedRequestsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = server.getDiagnosticsSummary().getSecurityRejectedRequestCount();
        return new DataValue(new Variant(value));
    }));
    node.getRejectedRequestsCountNode().getFilterChain().addLast(diagnosticValueFilter(diagnosticsEnabled, ctx -> {
        UInteger value = server.getDiagnosticsSummary().getRejectedRequestCount();
        return new DataValue(new Variant(value));
    }));
}
Also used : ServerDiagnosticsSummaryTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.variables.ServerDiagnosticsSummaryTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) UInteger(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) Util.diagnosticValueFilter(org.eclipse.milo.opcua.sdk.server.diagnostics.variables.Util.diagnosticValueFilter) AbstractLifecycle(org.eclipse.milo.opcua.sdk.server.AbstractLifecycle) AttributeObserver(org.eclipse.milo.opcua.sdk.server.nodes.AttributeObserver) OpcUaServer(org.eclipse.milo.opcua.sdk.server.OpcUaServer) Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) Unsigned.uint(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.Unsigned.uint) ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) AttributeId(org.eclipse.milo.opcua.stack.core.AttributeId) NoSuchElementException(java.util.NoSuchElementException) Identifiers(org.eclipse.milo.opcua.stack.core.Identifiers) Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) DataValue(org.eclipse.milo.opcua.stack.core.types.builtin.DataValue) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) UInteger(org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UInteger) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) NoSuchElementException(java.util.NoSuchElementException)

Example 5 with ServerDiagnosticsTypeNode

use of org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode in project milo by eclipse.

the class SessionDiagnosticsVariableArray method onShutdown.

@Override
protected void onShutdown() {
    AttributeObserver observer = attributeObserver;
    if (observer != null) {
        ServerDiagnosticsTypeNode diagnosticsNode = (ServerDiagnosticsTypeNode) server.getAddressSpaceManager().getManagedNode(Identifiers.Server_ServerDiagnostics).orElseThrow(() -> new NoSuchElementException("NodeId: " + Identifiers.Server_ServerDiagnostics));
        diagnosticsNode.getEnabledFlagNode().removeAttributeObserver(observer);
        attributeObserver = null;
    }
    if (sessionListener != null) {
        server.getSessionManager().removeSessionListener(sessionListener);
        sessionListener = null;
    }
    sessionDiagnosticsVariables.forEach(Lifecycle::shutdown);
    sessionDiagnosticsVariables.clear();
    node.delete();
}
Also used : ServerDiagnosticsTypeNode(org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode) AttributeObserver(org.eclipse.milo.opcua.sdk.server.nodes.AttributeObserver) AbstractLifecycle(org.eclipse.milo.opcua.sdk.server.AbstractLifecycle) Lifecycle(org.eclipse.milo.opcua.sdk.server.Lifecycle) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

ServerDiagnosticsTypeNode (org.eclipse.milo.opcua.sdk.server.model.nodes.objects.ServerDiagnosticsTypeNode)16 NoSuchElementException (java.util.NoSuchElementException)14 AttributeObserver (org.eclipse.milo.opcua.sdk.server.nodes.AttributeObserver)14 AbstractLifecycle (org.eclipse.milo.opcua.sdk.server.AbstractLifecycle)10 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 OpcUaServer (org.eclipse.milo.opcua.sdk.server.OpcUaServer)7 Util.diagnosticValueFilter (org.eclipse.milo.opcua.sdk.server.diagnostics.variables.Util.diagnosticValueFilter)7 AttributeId (org.eclipse.milo.opcua.stack.core.AttributeId)7 Identifiers (org.eclipse.milo.opcua.stack.core.Identifiers)7 DataValue (org.eclipse.milo.opcua.stack.core.types.builtin.DataValue)7 ExtensionObject (org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject)7 Variant (org.eclipse.milo.opcua.stack.core.types.builtin.Variant)7 NodeId (org.eclipse.milo.opcua.stack.core.types.builtin.NodeId)6 Reference (org.eclipse.milo.opcua.sdk.core.Reference)5 LocalizedText (org.eclipse.milo.opcua.stack.core.types.builtin.LocalizedText)5 QualifiedName (org.eclipse.milo.opcua.stack.core.types.builtin.QualifiedName)5 Lifecycle (org.eclipse.milo.opcua.sdk.server.Lifecycle)4 Session (org.eclipse.milo.opcua.sdk.server.Session)4 ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3