io.probedock.client.common.config.ServerListConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of probe-dock-java Show documentation
Show all versions of probe-dock-java Show documentation
Base code to write Probe Dock clients in Java
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