summaryrefslogtreecommitdiffstats
path: root/components/datalake-handler/feeder
diff options
context:
space:
mode:
authorRama-Huawei <rama.subba.reddy.s@huawei.com>2019-08-07 11:32:17 +0530
committerRama-Huawei <rama.subba.reddy.s@huawei.com>2019-08-07 11:37:59 +0530
commit985ec5787f1131b629b8eed01e1bf1734998e2dd (patch)
tree12d7853a96dff53dd79cdc459fa44321269f9bbf /components/datalake-handler/feeder
parentfdc2d73a151965696157718d04b1b0f57c4a747a (diff)
System.out is replace by a logger
Issue-ID: DCAEGEN2-1468 Signed-off-by: Rama-Huawei <rama.subba.reddy.s@huawei.com> Change-Id: Iefdbfd3480f831ce734e748ac0680ed53c60f0fb
Diffstat (limited to 'components/datalake-handler/feeder')
-rw-r--r--components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/service/db/MongodbService.java6
-rw-r--r--components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/util/DruidSupervisorGenerator.java27
2 files changed, 12 insertions, 21 deletions
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 8677c6f6..eb8a3a16 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 @@ public class MongodbService implements DbStoreService {
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 class MongodbService implements DbStoreService {
}
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 8a177cc7..51d3168e 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.VelocityContext;
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 @@ import java.util.Map.Entry;
@Getter
public class DruidSupervisorGenerator {
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
Template template = null;
VelocityContext context;
@@ -90,7 +94,6 @@ public class DruidSupervisorGenerator {
while (fields.hasNext()) {
Entry<String, JsonNode> field = fields.next();
- // System.out.println("--------"+field.getKey()+"--------");
printNode(prefix + "." + field.getKey(), field.getValue());
}
@@ -113,25 +116,13 @@ public class DruidSupervisorGenerator {
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 {