Replace switch statement with if in RestAPI Initialization
@@ -196,8 +196,7 @@ public class KnowledgeBaseConnector {
*/
@PostConstruct
public void connectToGraphDB() {
- switch (KnowledgeBaseConnector.forge) {
- case Constants.mvnForge: {
+ if (this.forge.equals(Constants.mvnForge)) {
logger.info("Establishing connection to the Graph Database at " + graphdbPath + "...");
try {
graphDao = RocksDBConnector.createReadOnlyRocksDBAccessObject(graphdbPath);
@@ -208,12 +207,10 @@ public class KnowledgeBaseConnector {
logger.info("...Graph database connection established successfully.");
}
}
- }
@PostConstruct
public void initKafkaProducer() {
- switch (this.forge) {
- case Constants.mvnForge: {
+ if (this.forge.equals(Constants.mvnForge)) {
ingestTopic = this.kafkaOutputTopic;
var producerProperties = new Properties();
producerProperties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaAddress);
@@ -225,4 +222,3 @@ public class KnowledgeBaseConnector {
}
}
}
-}
