keith-turner commented on a change in pull request #1083: [WIP] POC for Command 
module with centralized Command Pattern logic
URL: https://github.com/apache/fluo/pull/1083#discussion_r364839337
 
 

 ##########
 File path: 
modules/command/src/main/java/org/apache/fluo/command/ConfigCommand.java
 ##########
 @@ -36,30 +36,34 @@
       description = "Override configuration set in properties file. Expected 
format: -o <key>=<value>")
   private List<String> properties = new ArrayList<>();
 
-  List<String> getProperties() {
-    return properties;
-  }
-
-  void overrideFluoConfig(FluoConfiguration config) {
+  private void overrideFluoConfig(FluoConfiguration config) {
     for (String prop : getProperties()) {
       String[] propArgs = prop.split("=", 2);
       if (propArgs.length == 2) {
         String key = propArgs[0].trim();
         String value = propArgs[1].trim();
         if (key.isEmpty() || value.isEmpty()) {
-          throw new IllegalArgumentException("Invalid command line -o option: 
" + prop);
+          throw new FluoCommandException("Invalid command line -o option: " + 
prop);
         } else {
           config.setProperty(key, value);
         }
       } else {
-        throw new IllegalArgumentException("Invalid command line -o option: " 
+ prop);
+        throw new FluoCommandException("Invalid command line -o option: " + 
prop);
       }
     }
   }
 
-  public static ConfigOpts parse(String programName, String[] args) {
-    ConfigOpts opts = new ConfigOpts();
-    parse(programName, opts, args);
-    return opts;
+  FluoConfiguration getConfig() {
+    FluoConfiguration config = CommandUtil.resolveFluoConfig();
+    overrideFluoConfig(config);
+    return config;
+  }
+
+  public List<String> getProperties() {
+    return properties;
+  }
+
+  public void setProperties(List<String> properties) {
 
 Review comment:
   Could have `@VisibleForTesting` annotation.  Also could `public` be removed?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to