A workaround to consolidate the server-config and server resource model representations
TODO: https://issues.jboss.org/browse/WFLY-4910

@param servers
431063
private void normalizeModel(List<Server> servers) {

        for (Server server : servers) {
            ServerInstance serverInstance = getServerInstance(new ServerRef(server.getHostName(), server.getName()));
            server.setServerState(serverInstance.getServerState());
            server.setSuspendState(serverInstance.getSuspendState());
        }
    }
901308
@Override
    public void setConfigs(List<String> configs) {
        configList.clear();
        if (configs != null) {
            configList.addAll(configs);
        }
    }
361559
public static void configurePorts(ServerBuilder server, List<Port> ports) {
        requireNonNull(server, "server");
        requireNonNull(ports, "ports");
        ports.forEach(p -> {
            final String ip = p.getIp();
            final String iface = p.getIface();
            final int port = p.getPort();
            final List<SessionProtocol> protocols = p.getProtocols();

            if (ip == null) {
                if (iface == null) {
                    server.port(new ServerPort(port, protocols));
                } else {
                    try {
                        final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses();
                        while (e.hasMoreElements()) {
                            server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port),
                                                       protocols));
                        }
                    } catch (SocketException e) {
                        throw new IllegalStateException("Failed to find an iface: " + iface, e);
                    }
                }
            } else if (iface == null) {
                if (NetUtil.isValidIpV4Address(ip) || NetUtil.isValidIpV6Address(ip)) {
                    final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip);
                    try {
                        server.port(new ServerPort(new InetSocketAddress(
                                InetAddress.getByAddress(bytes), port), protocols));
                    } catch (UnknownHostException e) {
                        // Should never happen.
                        throw new Error(e);
                    }
                } else {
                    throw new IllegalStateException("invalid IP address: " + ip);
                }
            } else {
                throw new IllegalStateException("A port cannot have both IP and iface: " + p);
            }
        });
    }
1359781
public synchronized void setWriteServer(final Server writeServer) {
        logger.debug("[setWriteServer] uri = {}", (writeServer == null) ? "NULL" : writeServer.getDataUri());

        if (this.writeServer != null && writeServer != null && this.writeServer.equals(writeServer)) return;

        this.writeServer = writeServer;
        refreshServers();
    }
211942
private void synchronizeHosts(final AsyncCallback<Boolean> callback) {
        ModelNode op = new ModelNode();
        op.get(ADDRESS).setEmptyList();
        op.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
        op.get(CHILD_TYPE).set("host");

        Footer.PROGRESS_ELEMENT.reset();

        dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() {
            @Override
            public void onFailure(Throwable caught) {
                Footer.PROGRESS_ELEMENT.finish();
                callback.onFailure(caught);
            }

            @Override
            public void onSuccess(DMRResponse result) {
                ModelNode response = result.get();
                if (response.isFailure()) {
                    Footer.PROGRESS_ELEMENT.finish();
                    callback.onFailure(new RuntimeException("Failed to synchronize host model: " + response.getFailureDescription()));
                } else {
                    List<Property> properties = response.get(RESULT).asPropertyList();
                    List<String> hostNames = new ArrayList<String>(properties.size());
                    for (Property property : properties) {
                        hostNames.add(property.getName());
                        if (property.getValue().hasDefined("master") && property.getValue().get("master").asBoolean()) {
                            domainController = property.getName();
                        }
                    }

                    Footer.PROGRESS_ELEMENT.finish();

                    // synchronize servers
                    synchronizeServerModel(hostNames, callback);
                }
            }

        });

    }
327567
private static void serverOptionInit() {
        Map<String, Object> mapConfig = Config.getInstance().getJsonMapConfigNoCache(SERVER_CONFIG_NAME);
        ServerOption.serverOptionInit(mapConfig, getServerConfig());
    }
980033
public OperationFuture<List<Server>> removeAutoscalePolicyOnServer(Server... servers) {
        return removeAutoscalePolicyOnServer(Arrays.asList(servers));
    }
536069
private void setServerLayout(final List<CmsSite> sites) {

        m_workplaceServerGroup = new CmsEditableGroup(m_serverLayout, new Supplier<Component>() {

            public Component get() {

                CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, null);
                return row;
            }
        }, "Add");

        for (String server : OpenCms.getSiteManager().getWorkplaceServers()) {
            CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, server);
            m_workplaceServerGroup.addRow(row);
        }
    }
449116
private static void createAll()
    {
        if (_configs!=null)
        {
            synchronized(_configs)
            {
                _servers=new Vector();
                for(int i=0;i<_configs.size();i++)
                {
                    try
                    {
                        Server server = new Server((String)_configs.get(i));
                        _servers.add(server);
                    }
                    catch(Exception e)
                    {
                        log.warn(_configs.get(i)+" configuration problem: ",e);
                    }
                }
            }
        }
    }
919640
public void setServerGroupReplicationConfigurations(java.util.Collection<ServerGroupReplicationConfiguration> serverGroupReplicationConfigurations) {
        if (serverGroupReplicationConfigurations == null) {
            this.serverGroupReplicationConfigurations = null;
            return;
        }

        this.serverGroupReplicationConfigurations = new java.util.ArrayList<ServerGroupReplicationConfiguration>(serverGroupReplicationConfigurations);
    }
763204
public List<Server> getEligibleServers(List<Server> servers, Object loadBalancerKey) {
        if (loadBalancerKey == null) {
            return ImmutableList.copyOf(Iterables.filter(servers, this.getServerOnlyPredicate()));            
        } else {
            List<Server> results = Lists.newArrayList();
            for (Server server: servers) {
                if (this.apply(new PredicateKey(loadBalancerKey, server))) {
                    results.add(server);
                }
            }
            return results;            
        }
    }
1095580
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL)
    protected synchronized void setServerStarted(ServerStarted serverStarted) {
        isServerStarted = true;

        // Start SystemModule if everything else is ready
        startManagementEJB();
    }
930948
public void setServerCustomizers(
			Collection<? extends NettyServerCustomizer> serverCustomizers) {
		Assert.notNull(serverCustomizers, "ServerCustomizers must not be null");
		this.serverCustomizers = new ArrayList<>(serverCustomizers);
	}
496783
public void setHsmConfigurations(java.util.Collection<HsmConfiguration> hsmConfigurations) {
        if (hsmConfigurations == null) {
            this.hsmConfigurations = null;
            return;
        }

        this.hsmConfigurations = new com.amazonaws.internal.SdkInternalList<HsmConfiguration>(hsmConfigurations);
    }
478038
public void setServerReplicationConfigurations(java.util.Collection<ServerReplicationConfiguration> serverReplicationConfigurations) {
        if (serverReplicationConfigurations == null) {
            this.serverReplicationConfigurations = null;
            return;
        }

        this.serverReplicationConfigurations = new java.util.ArrayList<ServerReplicationConfiguration>(serverReplicationConfigurations);
    }
1091941
public void setDirectoryServers(List<String> servers){
        if(servers == null || servers.size() == 0){
            return;
        }
        directoryServers = new DirectoryServers(servers);
        connection.setDirectoryServers(directoryServers.getNextDirectoryServer());
    }
1017458
public void setLoadBalancers(java.util.Collection<LoadBalancer> loadBalancers) {
        if (loadBalancers == null) {
            this.loadBalancers = null;
            return;
        }

        this.loadBalancers = new java.util.ArrayList<LoadBalancer>(loadBalancers);
    }