Merge "System.out is replace by a logger"
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/service/db/MongodbService.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/service/db/MongodbService.java
index 8677c6f..eb8a3a1 100644
--- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/service/db/MongodbService.java
+++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/service/db/MongodbService.java
@@ -109,14 +109,14 @@
builder.sslEnabled(Boolean.TRUE.equals(mongodb.getEncrypt()));// getEncrypt() can be null
}
MongoClientOptions options = builder.build();
- List<ServerAddress> addrs = new ArrayList<ServerAddress>();
+ List<ServerAddress> addrs = new ArrayList<>();
addrs.add(new ServerAddress(host, port)); // FIXME should be a list of address
try {
if (StringUtils.isNoneBlank(userName) && StringUtils.isNoneBlank(password)) {
credential = MongoCredential.createCredential(userName, databaseName, password.toCharArray());
- List<MongoCredential> credentialList = new ArrayList<MongoCredential>();
+ List<MongoCredential> credentialList = new ArrayList<>();
credentialList.add(credential);
mongoClient = new MongoClient(addrs, credentialList, options);
} else {
@@ -148,7 +148,7 @@
}
public void saveJsons(EffectiveTopic effectiveTopic, List<JSONObject> jsons) {
- if (dbReady == false)//TOD throw exception
+ if (!dbReady)//TOD throw exception
return;
List<Document> documents = new ArrayList<>(jsons.size());
for (JSONObject json : jsons) {
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/util/DruidSupervisorGenerator.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/util/DruidSupervisorGenerator.java
index 8a177cc..51d3168 100644
--- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/util/DruidSupervisorGenerator.java
+++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/util/DruidSupervisorGenerator.java
@@ -28,6 +28,8 @@
import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedWriter;
import java.io.FileWriter;
@@ -59,6 +61,8 @@
@Getter
public class DruidSupervisorGenerator {
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
Template template = null;
VelocityContext context;
@@ -90,7 +94,6 @@
while (fields.hasNext()) {
Entry<String, JsonNode> field = fields.next();
- // System.out.println("--------"+field.getKey()+"--------");
printNode(prefix + "." + field.getKey(), field.getValue());
}
@@ -113,25 +116,13 @@
private void printFlattenSpec(JsonNodeType type, String path) {
String name = path.substring(2).replace('.', ':');
// lets see what type the node is
- System.out.println("{");
- System.out.println("\"type\": \"path\",");
- System.out.println("\"name\": \"" + name + "\",");
- System.out.println("\"expr\": \"" + path + "\"");
- System.out.println("},");
+ log.info("{");
+ log.info("\"type\": \"path\",");
+ log.info("\"name\": \"" + name + "\",");
+ log.info("\"expr\": \"" + path + "\"");
+ log.info("},");
dimensions.add(new String[]{name, path});
- /*
- //for dimensionsSpec
- if (JsonNodeType.NUMBER.equals(type)) {
- System.out.println("{");
- System.out.println("\"type\": \"long\",");
- System.out.println("\"name\": \"" + name + "\",");
- System.out.println("},");
- } else {
- System.out.println("\"" + name + "\",");
-
- }
- */
}
public void doTopic(String topic) throws IOException {