public static List contentNodesFromAppPackage()

in src/main/java/com/vispana/vespa/state/helpers/ContentNodesExtractor.java [16:43]


  public static List<Node> contentNodesFromAppPackage(
      final ApplicationPackage appPackage, final String configHostName) {
    Services services = Services.fromXml(appPackage.servicesContent());
    Hosts hosts = Hosts.fromXml(appPackage.hostsContent());

    if (services.getContent() == null) {
      throw new RuntimeException("No content found in services xml");
    }

    // content can not have both groups and nodes
    if (services.getContent().hasNodes()) {
      // is single node vespa setup
      if (services.getContent().getNodes().size() == 1) {
        return List.of(
            createNode(
                new Group(), services.getContent().getNodes().get(0), hosts, configHostName));
      }
      return services.getContent().getNodes().stream()
          .map(n -> createNode(new Group(), n, hosts, configHostName))
          .collect(Collectors.toList());
    }

    return services.getContent().getGroups().stream()
        .flatMap(
            group ->
                group.getNodes().stream().map(n -> createNode(group, n, hosts, configHostName)))
        .collect(Collectors.toList());
  }