private Set<String> toHostnameSet(String hostnamesString) { Set<String> hostnames = new HashSet<>(); for (String hostname : StringUtilities.split(hostnamesString)) { if ( ! hostname.trim().isEmpty()) hostnames.add(hostname.trim()); } return hostnames; }
/** Returns a host filter from three comma and-or space separated string lists. The strings may be null or empty. */ public static HostFilter from(String hostNames, String flavors, String clusterTypes, String clusterIds) { return new HostFilter( StringUtilities.split(hostNames), StringUtilities.split(flavors), StringUtilities.split(clusterTypes).stream().map(ClusterSpec.Type::from).collect(Collectors.toSet()), StringUtilities.split(clusterIds).stream().map(ClusterSpec.Id::from).collect(Collectors.toSet())); }
/** Returns a node filter which matches a comma or space-separated list of types */ public static NodeTypeFilter from(String types, NodeFilter next) { return new NodeTypeFilter(StringUtilities.split(types).stream().map(NodeType::valueOf).collect(Collectors.toSet()), next); }
/** Returns a copy of the given filter which only matches for the given parent */ public static ParentHostFilter from(String parentNames, NodeFilter filter) { return new ParentHostFilter(StringUtilities.split(parentNames).stream().collect(Collectors.toSet()), filter); }
/** Returns a node filter which matches a comma or space-separated list of states */ public static StateFilter from(String states, NodeFilter next) { return new StateFilter(StringUtilities.split(states).stream().map(Node.State::valueOf).collect(Collectors.toSet()), next); }
public static ApplicationFilter from(String applicationIds, NodeFilter next) { return new ApplicationFilter(StringUtilities.split(applicationIds).stream().map(ApplicationFilter::toApplicationId).collect(Collectors.toSet()), next); }