Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/760#discussion_r139170907
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/configuration/ConfigurationsUtils.java
---
@@ -226,6 +276,44 @@ public static void uploadConfigsToZookeeper(String
rootFilePath, CuratorFramewor
uploadConfigsToZookeeper(rootFilePath, rootFilePath, rootFilePath,
rootFilePath, rootFilePath, client);
}
+ public static void uploadConfigsToZookeeper(String rootFilePath,
CuratorFramework client,
+ ConfigurationType type) throws Exception {
+ uploadConfigsToZookeeper(rootFilePath, client, type, Optional.empty());
+ }
+
+ public static void uploadConfigsToZookeeper(String rootFilePath,
CuratorFramework client,
+ ConfigurationType type, Optional<String> configName) throws
Exception {
+ switch (type) {
+ case GLOBAL:
+ final byte[] globalConfig = readGlobalConfigFromFile(rootFilePath);
+ if (globalConfig.length > 0) {
+ setupStellarStatically(client, Optional.of(new
String(globalConfig)));
+
writeGlobalConfigToZookeeper(readGlobalConfigFromFile(rootFilePath), client);
+ }
+ break;
+ case PARSER:
--- End diff --
Couldn't this just be:
```
case PARSER:
case ENRICHMENT:
case INDEXING:
Map<String, byte[]> sensorConfigs =
readSensorConfigsFromFile(rootFilePath, type, configName);
for (String sensorType : sensorConfigs.keySet()) {
writeConfigToZookeeper(type, configName,
sensorConfigs.get(sensorType), client);
}
break;
```
Although I would ask that if we do that, that a comment indicating
fallthrough is intended is added.
---