summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Yang <yangyanyj@chinamobile.com>2019-08-14 07:05:02 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-14 07:05:02 +0000
commit8a7fc950a7317fa1087c6eed18600d27542b5ad6 (patch)
treefad0b56751d0b4efb12ff6af11c09ecc17fe6400
parent113ab1e5900f0d18d2b69c0f982cf56587c11703 (diff)
parent985ec5787f1131b629b8eed01e1bf1734998e2dd (diff)
Merge "System.out is replace by a logger"
-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 {