@Override
  protected void mergeResponses(
      ControllerStatusDTO clientDto,
      Map<NodeIdentifier, ControllerStatusDTO> dtoMap,
      Set<NodeResponse> successfulResponses,
      Set<NodeResponse> problematicResponses) {
    ControllerStatusDTO mergedStatus = clientDto;
    for (final Map.Entry<NodeIdentifier, ControllerStatusDTO> entry : dtoMap.entrySet()) {
      final NodeIdentifier nodeId = entry.getKey();
      final ControllerStatusDTO nodeStatus = entry.getValue();

      final String nodeAddress = nodeId.getApiAddress() + ":" + nodeId.getApiPort();
      for (final BulletinDTO bulletin : nodeStatus.getBulletins()) {
        bulletin.setNodeAddress(nodeAddress);
      }
      for (final BulletinDTO bulletin : nodeStatus.getControllerServiceBulletins()) {
        bulletin.setNodeAddress(nodeAddress);
      }
      for (final BulletinDTO bulletin : nodeStatus.getReportingTaskBulletins()) {
        bulletin.setNodeAddress(nodeAddress);
      }

      if (nodeStatus == mergedStatus) {
        continue;
      }

      StatusMerger.merge(mergedStatus, nodeStatus);
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void mergeResponses(
      ProcessGroupStatusDTO clientDto,
      Map<NodeIdentifier, ProcessGroupStatusDTO> dtoMap,
      NodeIdentifier selectedNodeId) {
    final ProcessGroupStatusDTO mergedProcessGroupStatus = clientDto;
    mergedProcessGroupStatus.setNodeSnapshots(new ArrayList<NodeProcessGroupStatusSnapshotDTO>());

    final NodeProcessGroupStatusSnapshotDTO selectedNodeSnapshot =
        new NodeProcessGroupStatusSnapshotDTO();
    selectedNodeSnapshot.setStatusSnapshot(clientDto.getAggregateSnapshot().clone());
    selectedNodeSnapshot.setAddress(selectedNodeId.getApiAddress());
    selectedNodeSnapshot.setApiPort(selectedNodeId.getApiPort());
    selectedNodeSnapshot.setNodeId(selectedNodeId.getId());

    mergedProcessGroupStatus.getNodeSnapshots().add(selectedNodeSnapshot);

    for (final Map.Entry<NodeIdentifier, ProcessGroupStatusDTO> entry : dtoMap.entrySet()) {
      final NodeIdentifier nodeId = entry.getKey();
      final ProcessGroupStatusDTO nodeProcessGroupStatus = entry.getValue();
      if (nodeProcessGroupStatus == mergedProcessGroupStatus) {
        continue;
      }

      StatusMerger.merge(
          mergedProcessGroupStatus,
          nodeProcessGroupStatus,
          nodeId.getId(),
          nodeId.getApiAddress(),
          nodeId.getApiPort());
    }
  }