Search in sources :

Example 1 with NodeSystemDiagnosticsSnapshotDTO

use of org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO in project nifi by apache.

the class StatusMerger method merge.

public static void merge(final SystemDiagnosticsDTO target, final SystemDiagnosticsDTO toMerge, final String nodeId, final String nodeAddress, final Integer nodeApiPort) {
    merge(target.getAggregateSnapshot(), toMerge.getAggregateSnapshot());
    List<NodeSystemDiagnosticsSnapshotDTO> nodeSnapshots = target.getNodeSnapshots();
    if (nodeSnapshots == null) {
        nodeSnapshots = new ArrayList<>();
    }
    final NodeSystemDiagnosticsSnapshotDTO nodeSnapshot = new NodeSystemDiagnosticsSnapshotDTO();
    nodeSnapshot.setAddress(nodeAddress);
    nodeSnapshot.setApiPort(nodeApiPort);
    nodeSnapshot.setNodeId(nodeId);
    nodeSnapshot.setSnapshot(toMerge.getAggregateSnapshot());
    nodeSnapshots.add(nodeSnapshot);
    target.setNodeSnapshots(nodeSnapshots);
}
Also used : NodeSystemDiagnosticsSnapshotDTO(org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO)

Example 2 with NodeSystemDiagnosticsSnapshotDTO

use of org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO in project nifi by apache.

the class SystemDiagnosticsEndpointMerger method mergeResponses.

@Override
protected void mergeResponses(SystemDiagnosticsDTO clientDto, Map<NodeIdentifier, SystemDiagnosticsDTO> dtoMap, NodeIdentifier selectedNodeId) {
    final SystemDiagnosticsDTO mergedSystemDiagnostics = clientDto;
    mergedSystemDiagnostics.setNodeSnapshots(new ArrayList<NodeSystemDiagnosticsSnapshotDTO>());
    final NodeSystemDiagnosticsSnapshotDTO selectedNodeSnapshot = new NodeSystemDiagnosticsSnapshotDTO();
    selectedNodeSnapshot.setSnapshot(clientDto.getAggregateSnapshot().clone());
    selectedNodeSnapshot.setAddress(selectedNodeId.getApiAddress());
    selectedNodeSnapshot.setApiPort(selectedNodeId.getApiPort());
    selectedNodeSnapshot.setNodeId(selectedNodeId.getId());
    mergedSystemDiagnostics.getNodeSnapshots().add(selectedNodeSnapshot);
    for (final Map.Entry<NodeIdentifier, SystemDiagnosticsDTO> entry : dtoMap.entrySet()) {
        final NodeIdentifier nodeId = entry.getKey();
        final SystemDiagnosticsDTO toMerge = entry.getValue();
        if (toMerge == clientDto) {
            continue;
        }
        StatusMerger.merge(mergedSystemDiagnostics, toMerge, nodeId.getId(), nodeId.getApiAddress(), nodeId.getApiPort());
    }
}
Also used : NodeIdentifier(org.apache.nifi.cluster.protocol.NodeIdentifier) NodeSystemDiagnosticsSnapshotDTO(org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO) SystemDiagnosticsDTO(org.apache.nifi.web.api.dto.SystemDiagnosticsDTO) Map(java.util.Map)

Aggregations

NodeSystemDiagnosticsSnapshotDTO (org.apache.nifi.web.api.dto.NodeSystemDiagnosticsSnapshotDTO)2 Map (java.util.Map)1 NodeIdentifier (org.apache.nifi.cluster.protocol.NodeIdentifier)1 SystemDiagnosticsDTO (org.apache.nifi.web.api.dto.SystemDiagnosticsDTO)1