public ForestConfigurationImpl readForestConfig() {
List<ForestImpl> forests = new ArrayList<>();
JsonNode results = ((DatabaseClientImpl) client).getServices()
.getResource(null, "internal/forestinfo", null, null, new JacksonHandle())
.get();
for ( JsonNode forestNode : results ) {
String id = forestNode.get("id").asText();
String name = forestNode.get("name").asText();
String database = forestNode.get("database").asText();
String host = forestNode.get("host").asText();
String openReplicaHost = null;
if ( forestNode.get("openReplicaHost") != null ) openReplicaHost = forestNode.get("openReplicaHost").asText();
String requestHost = null;
if ( forestNode.get("requestHost") != null ) requestHost = forestNode.get("requestHost").asText();
String alternateHost = null;
if ( forestNode.get("alternateHost") != null ) alternateHost = forestNode.get("alternateHost").asText();
if ( requestHost != null && alternateHost != null )
alternateHost = null;
boolean isUpdateable = "all".equals(forestNode.get("updatesAllowed").asText());
boolean isDeleteOnly = false;
forests.add(
new ForestImpl(host, openReplicaHost, requestHost, alternateHost, database, name, id, isUpdateable, isDeleteOnly)
);
}
return new ForestConfigurationImpl(forests.toArray(new ForestImpl[forests.size()]));
}