@Override
    public void configurationUpdated(SystemModel configurationObject) {
      SystemModelInterrogator interrogator = new SystemModelInterrogator(ports);
      Optional<ReposeCluster> cluster = interrogator.getLocalCluster(configurationObject);
      Optional<Node> node = interrogator.getLocalNode(configurationObject);

      if (cluster.isPresent() && node.isPresent()) {
        localDomain = cluster.get();
        localHost = node.get();

        List<Destination> destinations = new ArrayList<>();

        destinations.addAll(localDomain.getDestinations().getEndpoint());
        destinations.addAll(localDomain.getDestinations().getTarget());
        for (Destination powerApiHost : destinations) {
          configuredHosts.put(powerApiHost.getId(), powerApiHost);
        }

        isInitialized = true;

        healthCheckServiceProxy.resolveIssue(SYSTEM_MODEL_CONFIG_HEALTH_REPORT);
      } else {
        LOG.error(
            "Unable to identify the local host in the system model - please check your system-model.cfg.xml");
        healthCheckServiceProxy.reportIssue(
            SYSTEM_MODEL_CONFIG_HEALTH_REPORT,
            "Unable to identify the "
                + "local host in the system model - please check your system-model.cfg.xml",
            Severity.BROKEN);
      }
    }
Пример #2
0
 private void addDestinations(List<? extends Destination> destList) {
   for (Destination dest : destList) {
     destinations.put(dest.getId(), dest);
   }
 }