if (outputWritersNode.isMissingNode()) {
} else if (outputWritersNode.isArray()) {
for (JsonNode outputWriterNode : outputWritersNode) {
try {
String className = outputWriterNode.path("@class").asText();
OutputWriter outputWriter = (OutputWriter) Class.forName(className).newInstance();
JsonNode deprecatedEnabledNode = outputWriterNode.path("enabled");
if (!deprecatedEnabledNode.isMissingNode()) {
logger.warn("OutputWriter {}, deprecated usage of attribute 'enabled', settings{ \"enabled\":... } should be used instead");
outputWriter.setEnabled(deprecatedEnabledNode.asBoolean());
}
JsonNode settingsNode = outputWriterNode.path("settings");
if (settingsNode.isMissingNode()) {
} else if (settingsNode.isObject()) {
ObjectMapper mapper = new ObjectMapper();
@SuppressWarnings("unchecked")
Map<String, Object> settings = mapper.treeToValue(settingsNode, Map.class);
outputWriter.setSettings(settings);
if (settings.containsKey("enabled")) {
outputWriter.setEnabled(Boolean.valueOf(String.valueOf(settings.get("enabled"))));
}
} else {
logger.warn("Ignore invalid node {}", outputWriterNode);
}
logger.trace("Add {}", outputWriter);