For use on a slave HC to get all the server groups used by the host

@param hostResource the host resource
@return the server configs on this host
358997
public Set<ServerConfigInfo> getServerConfigsOnSlave(Resource hostResource){
        Set<ServerConfigInfo> groups = new HashSet<>();
        for (ResourceEntry entry : hostResource.getChildren(SERVER_CONFIG)) {
            groups.add(new ServerConfigInfoImpl(entry.getModel()));
        }
        return groups;
    }
887409
private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root)  {
        if (requiresMapping) {
            map(root);
            requiresMapping = false;
        }
        Set<String> mapped = hostsToGroups.get(host);
        if (mapped == null) {
            // Unassigned host. Treat like an unassigned profile or socket-binding-group;
            // i.e. available to all server group scoped roles.
            // Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs
            Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));
            if (hostResource != null) {
                ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);
                if (!dcModel.hasDefined(REMOTE)) {
                    mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)
                }
            }
        }
        return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)
                : HostServerGroupEffect.forMappedHost(address, mapped, host);

    }
231275
public static Client getClient(ClientConfig config, String[] servers,
            int port) throws Exception {
        config.setTopologyChangeAware(true); // Set client to be topology-aware
        final Client client = ClientFactory.createClient(config);
        for (String server : servers) {
            // Try connecting servers one by one until we have a success
            try {
                client.createConnection(server.trim(), port);
                break;
            } catch(IOException e) {
                // Only swallow the exceptions from Java network or connection problems
                // Unresolved hostname exceptions will be thrown
            }
        }
        if (client.getConnectedHostList().isEmpty()) {
            throw new Exception("Unable to connect to any servers.");
        }
        return client;
    }
583386
public static br_replicateconfig[] replicate(nitro_service client, br_replicateconfig[] resources) throws Exception
	{
		if(resources == null)
			throw new Exception("Null resource array");
		
		
		if(resources.length == 1)
			return ((br_replicateconfig[]) resources[0].perform_operation(client, "replicate"));
		
		return ((br_replicateconfig[]) perform_operation_bulk_request(client, resources, "replicate"));
	}
1356033
private DnsServerAddressStream getNameServersFromCache(String hostname) {
        int len = hostname.length();

        if (len == 0) {
            // We never cache for root servers.
            return null;
        }

        // We always store in the cache with a trailing '.'.
        if (hostname.charAt(len - 1) != '.') {
            hostname += ".";
        }

        int idx = hostname.indexOf('.');
        if (idx == hostname.length() - 1) {
            // We are not interested in handling '.' as we should never serve the root servers from cache.
            return null;
        }

        // We start from the closed match and then move down.
        for (;;) {
            // Skip '.' as well.
            hostname = hostname.substring(idx + 1);

            int idx2 = hostname.indexOf('.');
            if (idx2 <= 0 || idx2 == hostname.length() - 1) {
                // We are not interested in handling '.TLD.' as we should never serve the root servers from cache.
                return null;
            }
            idx = idx2;

            DnsServerAddressStream entries = authoritativeDnsServerCache().get(hostname);
            if (entries != null) {
                // The returned List may contain unresolved InetSocketAddress instances that will be
                // resolved on the fly in query(....).
                return entries;
            }
        }
    }
474291
public static Builder getNodeConfig(String clusterName, String nodeName,
            String networkHost, String homePath, boolean nodeIngest) {
        return Settings.builder()
                // .put("path.metric", dataPath).put("http.port", httpRange)
                // .put("transport.tcp.port", transportRange)
                .put("node.name", nodeName).put("cluster.name", clusterName)
                .put("network.host", networkHost).put("path.home", homePath)
                .put("transport.type", "netty4")
                // .put("discovery.type", "none")
                .put("http.type", "netty4").put("node.ingest", nodeIngest);
    }
992896
private SortedSet<ServerGroup> deriveGroups(List<HostInfo> hosts) {
        serverGroups.clear();
        for (HostInfo host : hosts) {
            List<ServerInstance> serverInstances = host.getServerInstances();
            for (ServerInstance server : serverInstances) {
                String group = server.getGroup();
                String profile = server.getProfile();
                ServerGroup serverGroup = serverGroups.get(group);
                if (serverGroup == null) {
                    serverGroup = new ServerGroup(group, profile);
                    serverGroup.fill(hosts);
                    serverGroups.put(group, serverGroup);
                }
            }
        }
        return new TreeSet<ServerGroup>(serverGroups.values());
    }
1258525
public java.util.List<Host> getHosts() {
        if (hosts == null) {
            hosts = new com.amazonaws.internal.SdkInternalList<Host>();
        }
        return hosts;
    }
53547
public Configuration getConfiguration() {
		if (configuration == null) {
			try {
				configuration = new PropertiesConfiguration(getClass().getResource("/nextserver.properties"));
			} catch (ConfigurationException e) {
				throw new RuntimeException(e);
			}
		}		
		return configuration;
	}
331631
public void setServerGroupLaunchConfigurations(java.util.Collection<ServerGroupLaunchConfiguration> serverGroupLaunchConfigurations) {
        if (serverGroupLaunchConfigurations == null) {
            this.serverGroupLaunchConfigurations = null;
            return;
        }

        this.serverGroupLaunchConfigurations = new java.util.ArrayList<ServerGroupLaunchConfiguration>(serverGroupLaunchConfigurations);
    }
757845
public CmsResourceTypeConfig getResourceType(String typeName) {

        for (CmsResourceTypeConfig type : getResourceTypes()) {
            if (typeName.equals(type.getTypeName())) {
                return type;
            }
        }
        return null;
    }
1017202
public void initWithHosts(Map<Host, HostConnectionPool<CL>> hPools) {

		// Get the list of tokens for these hosts
		//tokenSupplier.initWithHosts(hPools.keySet());
		List<HostToken> allHostTokens = tokenSupplier.getTokens(hPools.keySet());
		Map<HostToken, HostConnectionPool<CL>> tokenPoolMap = new HashMap<HostToken, HostConnectionPool<CL>>();
	        
		// Update inner state with the host tokens.
		for (HostToken hToken : allHostTokens) {
			hostTokens.put(hToken.getHost(), hToken);
			tokenPoolMap.put(hToken, hPools.get(hToken.getHost()));
		}

		// Initialize Local selector
		Map<HostToken, HostConnectionPool<CL>> localPools = getHostPoolsForRack(tokenPoolMap, localRack);
		localSelector.initWithHosts(localPools);
		if (localSelector.isTokenAware() && localRack != null) {
		   replicationFactor.set(calculateReplicationFactor(allHostTokens));
		}

		// Initialize Remote selectors
		Set<String> remoteRacks = new HashSet<String>();
		for (Host host : hPools.keySet()) {
			String rack = host.getRack();
			if (localRack != null && !localRack.isEmpty() && rack != null && !rack.isEmpty() && !localRack.equals(rack)) {
				remoteRacks.add(rack);
			}
		}

		for (String rack : remoteRacks) {
			Map<HostToken, HostConnectionPool<CL>> dcPools = getHostPoolsForRack(tokenPoolMap, rack);
			HostSelectionStrategy<CL> remoteSelector = selectorFactory.vendPoolSelectionStrategy();
			remoteSelector.initWithHosts(dcPools);
			remoteRackSelectors.put(rack, remoteSelector);
		}

		remoteDCNames.swapWithList(remoteRackSelectors.keySet());

        topology.set(createTokenPoolTopology(allHostTokens));
	}
124352
private String[] getMappedServers(final ServerInformationCatalog serverInformationCatalog,
            final Map<String, String> mappedServers) {

        if (serverInformationCatalog.containsServer(HadoopResource.DEFAULT_CLUSTERREFERENCE)) {
            mappedServers.put("(default)", HadoopResource.DEFAULT_CLUSTERREFERENCE);
        }

        final String[] serverNames = serverInformationCatalog.getServerNames();
        for (int i = 0; i < serverNames.length; i++) {
            final String serverName = serverNames[i];
            if (!serverName.equals(HadoopResource.DEFAULT_CLUSTERREFERENCE)) {
                mappedServers.put(serverName, serverName);
            }
        }
        return mappedServers.keySet().toArray(new String[serverNames.length]);
    }
291477
@Override
    public List<Host> getSeedHosts() {
        List<Host> hosts = new ArrayList<Host>();
        if (seeds != null) {
            for (String seed : seeds.split(",")) {
                seed = seed.trim();
                if (seed.length() > 0) {
                    hosts.add(new Host(seed, this.port));
                }
            }
        }
        return hosts;
    }
1186958
static List<Instance> convertProviderToInstances(ProviderConfig providerConfig) {
        @SuppressWarnings("unchecked")
        List<ServerConfig> servers = providerConfig.getServer();
        if (servers != null && !servers.isEmpty()) {
            List<Instance> instances = new ArrayList<Instance>();
            for (ServerConfig server : servers) {
                Instance instance = new Instance();
                instance.setClusterName(DEFAULT_CLUSTER);
                instance.setServiceName(providerConfig.getInterfaceId());

                // set host port
                String host = server.getVirtualHost();
                if (host == null) {
                    host = server.getHost();
                    if (NetUtils.isLocalHost(host) || NetUtils.isAnyHost(host)) {
                        host = SystemInfo.getLocalHost();
                    }
                }
                instance.setIp(host);
                instance.setPort(server.getPort());

                // set meta data
                Map<String, String> metaData = RegistryUtils.convertProviderToMap(providerConfig, server);
                instance.setMetadata(metaData);

                instances.add(instance);
            }
            return instances;
        }
        return null;
    }
174357
@Deprecated
    @Override
    public HostConfiguration getHostConfiguration() {
        HostConfiguration hostconfig = new HostConfiguration();
        hostconfig.setHost(this.httphost);
        return hostconfig;
    }
634689
public static hostcpu get(nitro_service client, hostcpu resource) throws Exception
	{
		resource.validate("get");
		return ((hostcpu[]) resource.get_resources(client))[0];
	}