You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by gi...@git.apache.org on 2017/08/25 21:58:09 UTC

[GitHub] keith-turner commented on a change in pull request #916: Fixes #914 Allow passing config to oracle/worker cmds

keith-turner commented on a change in pull request #916: Fixes #914 Allow passing config to oracle/worker cmds
URL: https://github.com/apache/fluo/pull/916#discussion_r135360530
 
 

 ##########
 File path: modules/command/src/main/java/org/apache/fluo/command/CommandOpts.java
 ##########
 @@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.fluo.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParameterException;
+import org.apache.fluo.api.config.FluoConfiguration;
+
+public class CommandOpts {
+
+  @Parameter(names = {"-D"}, description = "Sets configuration property. Expected format: <name>=<value>")
+  private List<String> properties = new ArrayList<>();
+
+  @Parameter(names = {"-h", "-help", "--help"}, help = true, description = "Prints help")
+  boolean help;
+
+  List<String> getProperties() {
+    return properties;
+  }
+
+  void overrideConfig(FluoConfiguration config) {
+    for (String prop : getProperties()) {
+      String[] propArgs = prop.split("=");
+      if (propArgs.length == 2) {
 
 Review comment:
   if its not length 2, then maybe throw an exception?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services