private void mergeEmbeddedJmxTransConfiguration(@Nonnull JsonNode configurationRootNode, @Nonnull EmbeddedJmxTrans embeddedJmxTrans) {
for (JsonNode queryNode : configurationRootNode.path("queries")) {
String objectName = queryNode.path("objectName").asText();
Query query = new Query(objectName);
embeddedJmxTrans.addQuery(query);
JsonNode resultAliasNode = queryNode.path("resultAlias");
if (resultAliasNode.isMissingNode()) {
} else if (resultAliasNode.isValueNode()) {
query.setResultAlias(resultAliasNode.asText());
} else {
logger.warn("Ignore invalid node {}", resultAliasNode);
}
JsonNode attributesNode = queryNode.path("attributes");
if (attributesNode.isMissingNode()) {
} else if (attributesNode.isArray()) {
Iterator<JsonNode> itAttributeNode = attributesNode.elements();
while (itAttributeNode.hasNext()) {
JsonNode attributeNode = itAttributeNode.next();
parseQueryAttributeNode(query, attributeNode);
}
} else {
logger.warn("Ignore invalid node {}", resultAliasNode);
}
JsonNode attributeNode = queryNode.path("attribute");
parseQueryAttributeNode(query, attributeNode);
List<OutputWriter> outputWriters = parseOutputWritersNode(queryNode);
query.getOutputWriters().addAll(outputWriters);
logger.trace("Add {}", query);
}
List<OutputWriter> outputWriters = parseOutputWritersNode(configurationRootNode);
embeddedJmxTrans.getOutputWriters().addAll(outputWriters);