All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.probedock.client.common.config.ServerListConfiguration Maven / Gradle / Ivy

The newest version!
package io.probedock.client.common.config;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Probe Dock server list.
 *
 * @author Simon Oulevay 
 */
public class ServerListConfiguration {

	private Map servers;

	public ServerListConfiguration() {
		servers = new HashMap<>();
	}

	public void configureServer(String name, Map data) {
		ServerConfiguration server = servers.get(name);

		if (server == null) {
			server = new ServerConfiguration(name);
			servers.put(name, server);
		}

		server.configureWith(data);
	}

	public ServerConfiguration get(String name) {
		return servers.get(name);
	}

	public boolean isEmpty() {
		return servers.isEmpty();
	}

	public Set getServerNames() {
		return Collections.unmodifiableSet(servers.keySet());
	}

	@Override
	public String toString() {
		final StringBuilder builder = new StringBuilder("Server list:");

		for (final ServerConfiguration server : servers.values()) {
			builder.append("\n- ").append(server);
		}

		return builder.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy