keith-turner commented on a change in pull request #883: Fixes #842 Support 
multiple ways for running Fluo applications
URL: https://github.com/apache/incubator-fluo/pull/883#discussion_r130758128
 
 

 ##########
 File path: modules/command/src/main/java/org/apache/fluo/command/FluoExec.java
 ##########
 @@ -0,0 +1,78 @@
+/*
+ * 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.io.File;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Objects;
+
+import javax.inject.Provider;
+
+import com.google.common.base.Preconditions;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import org.apache.fluo.api.config.FluoConfiguration;
+import org.apache.fluo.core.client.FluoAdminImpl;
+
+public class FluoExec {
+
+  private static class FluoConfigModule extends AbstractModule {
+
+    private Class<?> clazz;
+    private FluoConfiguration fluoConfig;
+
+    FluoConfigModule(Class<?> clazz, FluoConfiguration fluoConfig) {
+      this.clazz = clazz;
+      this.fluoConfig = fluoConfig;
+    }
+
+    @Override
+    protected void configure() {
+      requestStaticInjection(clazz);
+      bind(FluoConfiguration.class).toProvider((Provider<FluoConfiguration>) 
() -> fluoConfig);
+    }
+  }
+
+  public static void main(String[] args) throws Exception {
+    if (args.length < 3) {
+      System.err.println("Usage: FluoExec <connectionPropsPath> 
<applicationName> <class> args...");
+      System.exit(-1);
+    }
+    final String connectionPropsPath = args[0];
+    final String applicationName = args[1];
+    final String className = args[2];
+    Objects.requireNonNull(connectionPropsPath);
+    File connectionPropsFile = new File(connectionPropsPath);
+    Preconditions.checkArgument(connectionPropsFile.exists(), 
connectionPropsPath
+        + " does not exist");
+
+    FluoConfiguration fluoConfig = new FluoConfiguration(connectionPropsFile);
+    fluoConfig.setApplicationName(applicationName);
+    CommandUtil.verifyAppInitialized(fluoConfig);
+    fluoConfig = FluoAdminImpl.mergeZookeeperConfig(fluoConfig);
 
 Review comment:
   Ok, I understand why the merge is needed now, trying to maintain the 
behavior of passing the `$FLUO_HOME/apps/app/conf/fluo.properties` file.   This 
is kinda unfortunate because it means we now have to connect to zookeeper 
before running the user code.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to