falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject git commit: FALCON-80 Option in falcon-start to not start embedded activemq. Contributed by Shwetha GS
Date Mon, 12 Aug 2013 11:22:59 GMT
Updated Branches:
  refs/heads/master 58b2a7c60 -> 9aa2c63a7


FALCON-80 Option in falcon-start to not start embedded activemq. Contributed by Shwetha GS


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/9aa2c63a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/9aa2c63a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/9aa2c63a

Branch: refs/heads/master
Commit: 9aa2c63a71e2c1d54963bbbee0b7ad19aa908c06
Parents: 58b2a7c
Author: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Authored: Mon Aug 12 16:08:33 2013 +0530
Committer: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Committed: Mon Aug 12 16:08:33 2013 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 src/bin/falcon-start                            |  4 +-
 .../src/main/java/org/apache/falcon/Main.java   | 67 +++++++++++++++-----
 3 files changed, 56 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/9aa2c63a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 95e8b3a..45dd9f9 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,8 @@ Trunk (Unreleased)
   NEW FEATURES
 
   IMPROVEMENTS
+    FALCON-80 Option in falcon-start to not start embedded activemq.
+    (Shwetha GS via Srikanth Sundarrajan)
 
   OPTIMIZATIONS
     FALCON-67 Remove ant dependency in oozie workflows. (Shwetha GS via

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/9aa2c63a/src/bin/falcon-start
----------------------------------------------------------------------
diff --git a/src/bin/falcon-start b/src/bin/falcon-start
index 185aede..c22d4c8 100755
--- a/src/bin/falcon-start
+++ b/src/bin/falcon-start
@@ -44,13 +44,13 @@ else
 fi
 
 pushd ${BASEDIR} > /dev/null
-JAVA_PROPERTIES="-Dactivemq.base=${BASEDIR}/logs -Dconfig.location=${BASEDIR}/conf"
+JAVA_PROPERTIES="-Dconfig.location=${BASEDIR}/conf"
 while [[ ${1} =~ ^\-D ]]; do
   JAVA_PROPERTIES="${JAVA_PROPERTIES} ${1}"
   shift
 done
 TIME=`date +%Y%m%d%H%M%s`
-nohup ${JAVA_BIN} ${JAVA_PROPERTIES} -cp ${FALCONCPPATH} org.apache.falcon.Main ${BASEDIR}/server/webapp/falcon.war
2> ${BASEDIR}/logs/falcon.out.$TIME &
+nohup ${JAVA_BIN} ${JAVA_PROPERTIES} -cp ${FALCONCPPATH} org.apache.falcon.Main -app ${BASEDIR}/server/webapp/falcon.war
-mqbase ${BASEDIR}/logs/data $* 2> ${BASEDIR}/logs/falcon.out.$TIME &
 echo $! > ${BASEDIR}/logs/falcon.pid
 popd > /dev/null
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/9aa2c63a/webapp/src/main/java/org/apache/falcon/Main.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/falcon/Main.java b/webapp/src/main/java/org/apache/falcon/Main.java
index 9eb9e8a..3ffe220 100644
--- a/webapp/src/main/java/org/apache/falcon/Main.java
+++ b/webapp/src/main/java/org/apache/falcon/Main.java
@@ -19,6 +19,11 @@
 package org.apache.falcon;
 
 import org.apache.activemq.broker.BrokerService;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
 import org.apache.falcon.util.BuildProperties;
 import org.apache.falcon.util.EmbeddedServer;
 
@@ -27,30 +32,62 @@ import org.apache.falcon.util.EmbeddedServer;
  */
 public final class Main {
 
+    private static final String APP_PATH = "app";
+    private static final String EMBEDDED_ACTIVEMQ = "embeddedmq";
+    private static final String ACTIVEMQ_BASE = "mqbase";
+
     /**
      * Prevent users from constructing this.
      */
     private Main() {
     }
 
-    public static void main(String[] args) throws Exception {
+    private static CommandLine parseArgs(String[] args) throws ParseException {
+        Options options = new Options();
+        Option opt;
+
+        opt = new Option(APP_PATH, true, "Application Path");
+        opt.setRequired(false);
+        options.addOption(opt);
+
+        opt = new Option(EMBEDDED_ACTIVEMQ, true, "Should start embedded activemq?");
+        opt.setRequired(false);
+        options.addOption(opt);
 
+        opt = new Option(ACTIVEMQ_BASE, true, "Activemq data directory");
+        opt.setRequired(false);
+        options.addOption(opt);
+
+        return new GnuParser().parse(options, args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        CommandLine cmd = parseArgs(args);
         String projectVersion = BuildProperties.get().getProperty("project.version");
-        String appPath;
-        String dataDir;
-        if (args.length < 1) {
-            appPath = "webapp/target/falcon-webapp-" + projectVersion;
-            dataDir = "target/";
-        } else {
-            appPath = args[0];
-            dataDir = System.getProperty("activemq.base") + "/data";
+        String appPath = "webapp/target/falcon-webapp-" + projectVersion;
+        String dataDir = "target/";
+        boolean startActiveMq = true;
+
+        if (cmd.hasOption(APP_PATH)) {
+            appPath = cmd.getOptionValue(APP_PATH);
+        }
+
+        if (cmd.hasOption(EMBEDDED_ACTIVEMQ)) {
+            startActiveMq = Boolean.valueOf(cmd.getOptionValue(EMBEDDED_ACTIVEMQ));
+        }
+
+        if (cmd.hasOption(ACTIVEMQ_BASE)) {
+            dataDir = cmd.getOptionValue(ACTIVEMQ_BASE);
+        }
+
+        if (startActiveMq) {
+            BrokerService broker = new BrokerService();
+            broker.setUseJmx(false);
+            broker.setDataDirectory(dataDir);
+            broker.addConnector("vm://localhost");
+            broker.addConnector("tcp://localhost:61616");
+            broker.start();
         }
-        BrokerService broker = new BrokerService();
-        broker.setUseJmx(false);
-        broker.setDataDirectory(dataDir);
-        broker.addConnector("vm://localhost");
-        broker.addConnector("tcp://localhost:61616");
-        broker.start();
 
         EmbeddedServer server = new EmbeddedServer(15000, appPath);
         server.start();


Mime
View raw message