You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ve...@apache.org on 2014/10/16 23:40:38 UTC
[2/5] git commit: FALCON-678 Falcon's default port has changed to
15443. Contributed by Balu Vellanki
FALCON-678 Falcon's default port has changed to 15443. Contributed by Balu Vellanki
Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/04efd178
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/04efd178
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/04efd178
Branch: refs/heads/master
Commit: 04efd178111f3e4caa73d754542341c56ca6c2f9
Parents: 78e486c
Author: Venkatesh Seetharam <ve...@apache.org>
Authored: Thu Oct 16 13:54:46 2014 -0700
Committer: Venkatesh Seetharam <ve...@apache.org>
Committed: Thu Oct 16 13:54:46 2014 -0700
----------------------------------------------------------------------
CHANGES.txt | 3 ++
docs/src/site/twiki/InstallationSteps.twiki | 8 ++--
prism/src/main/java/org/apache/falcon/Main.java | 41 +++++++++++++++-----
3 files changed, 39 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04efd178/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8b4ab1e..e2c976b 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -117,6 +117,9 @@ Trunk (Unreleased)
OPTIMIZATIONS
BUG FIXES
+ FALCON-678 Falcon's default port has changed to 15443 (Balu Vellanki via
+ Venkatesh Seetharam)
+
FALCON-482 Concurrent requests made using Proxy Oozie client fail
(Sowmya Ramesh via Venkatesh Seetharam)
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04efd178/docs/src/site/twiki/InstallationSteps.twiki
----------------------------------------------------------------------
diff --git a/docs/src/site/twiki/InstallationSteps.twiki b/docs/src/site/twiki/InstallationSteps.twiki
index 0e3bfcf..9cddcbb 100644
--- a/docs/src/site/twiki/InstallationSteps.twiki
+++ b/docs/src/site/twiki/InstallationSteps.twiki
@@ -176,9 +176,11 @@ export FALCON_SERVER_OPTS="-Djava.awt.headless=true -Djava.security.krb5.realm=
bin/falcon-start [-port <port>]
</verbatim>
-By default,
-* falcon server starts at port 15443 (https) by default . To change the port, use -port option
- * falcon.enableTLS can be set to true or false explicitly to enable SSL, if not port that end with 443 will automatically put falcon on https://
+By default,
+* If falcon.enableTLS is set to true explicitly or not set at all, falcon starts at port 15443 on https:// by default.
+* If falcon.enableTLS is set to false explicitly, falcon starts at port 15000 on http://.
+* To change the port, use -port option.
+ * If falcon.enableTLS is not set explicitly, port that ends with 443 will automatically put falcon on https://. Any other port will put falcon on http://.
* falcon server starts embedded active mq. To control this behaviour, set the following system properties using -D option in environment variable FALCON_OPTS:
* falcon.embeddedmq=<true/false> - Should server start embedded active mq, default true
* falcon.embeddedmq.port=<port> - Port for embedded active mq, default 61616
http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/04efd178/prism/src/main/java/org/apache/falcon/Main.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/Main.java b/prism/src/main/java/org/apache/falcon/Main.java
index 28a3c06..de9f657 100644
--- a/prism/src/main/java/org/apache/falcon/Main.java
+++ b/prism/src/main/java/org/apache/falcon/Main.java
@@ -24,6 +24,7 @@ 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.commons.lang.StringUtils;
import org.apache.falcon.util.BuildProperties;
import org.apache.falcon.util.EmbeddedServer;
import org.slf4j.Logger;
@@ -63,16 +64,45 @@ public final class Main {
CommandLine cmd = parseArgs(args);
String projectVersion = BuildProperties.get().getProperty("project.version");
String appPath = "webapp/target/falcon-webapp-" + projectVersion;
- int appPort = 15443;
if (cmd.hasOption(APP_PATH)) {
appPath = cmd.getOptionValue(APP_PATH);
}
+ final String enableTLSFlag = StartupProperties.get().getProperty("falcon.enableTLS");
+ final int appPort = getApplicationPort(cmd, enableTLSFlag);
+ final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
+ StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS));
+
+ startEmbeddedMQIfEnabled();
+
+ LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+ LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
+ LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+ EmbeddedServer server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
+ server.start();
+ }
+
+ private static int getApplicationPort(CommandLine cmd, String enableTLSFlag) {
+ final int appPort;
if (cmd.hasOption(APP_PORT)) {
appPort = Integer.valueOf(cmd.getOptionValue(APP_PORT));
+ } else {
+ // default : falcon.enableTLS is true
+ appPort = StringUtils.isEmpty(enableTLSFlag)
+ || enableTLSFlag.equals("true") ? 15443 : 15000;
}
+ return appPort;
+ }
+
+ private static boolean isTLSEnabled(String enableTLSFlag, int appPort) {
+ return Boolean.valueOf(StringUtils.isEmpty(enableTLSFlag)
+ ? System.getProperty("falcon.enableTLS", (appPort % 1000) == 443 ? "true" : "false")
+ : enableTLSFlag);
+ }
+
+ private static void startEmbeddedMQIfEnabled() throws Exception {
boolean startActiveMq = Boolean.valueOf(System.getProperty("falcon.embeddedmq", "true"));
if (startActiveMq) {
String dataDir = System.getProperty("falcon.embeddedmq.data", "target/");
@@ -87,14 +117,5 @@ public final class Main {
broker.setSchedulerSupport(true);
broker.start();
}
-
- boolean enableTLS = Boolean.valueOf(StartupProperties.get().getProperty("falcon.enableTLS",
- System.getProperty("falcon.enableTLS", (appPort % 1000) == 443 ? "true" : "false")));
- LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
- LOG.info("Server started with TLS ?" + enableTLS);
- LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
- StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS));
- EmbeddedServer server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
- server.start();
}
}