class KeyspaceHelper {

    public static Set<String> getDatacentersForKeyspace(Metadata metadata, String keyspace)
    {
        Set<String> datacenters = new HashSet<>();

        Map<String, String> replication = metadata.getKeyspace(keyspace).getReplication();
        String replicationClass = replication.get(REPLICATION_CLASS);

        if (replicationClass.endsWith("NetworkTopologyStrategy"))
        {
            for (String key : replication.keySet())
            {
                if (!REPLICATION_CLASS.equals(key))
                {
                    datacenters.add(key);
                }
            }
        }
        else
        {
            for (Host host : metadata.getAllHosts())
            {
                datacenters.add(host.getDatacenter());
            }
        }

        return datacenters;
    }

    private  KeyspaceHelper();

}