Repository: incubator-edgent
Updated Branches:
  refs/heads/develop e4c3d3df9 -> cf5580553


[Edgent-439] enable console port override

add override via system property edgent.console.port

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

Branch: refs/heads/develop
Commit: b78b50cb222c122478af351a0d19ac7f2dc42674
Parents: 05faa33
Author: Dale LaBossiere <dlab...@us.ibm.com>
Authored: Sun Dec 10 18:06:30 2017 -0500
Committer: Dale LaBossiere <dlab...@us.ibm.com>
Committed: Sun Dec 10 18:06:30 2017 -0500

----------------------------------------------------------------------
 .../org/apache/edgent/console/server/HttpServer.java  | 14 ++++++++++----
 .../providers/development/DevelopmentProvider.java    |  6 +++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b78b50cb/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
----------------------------------------------------------------------
diff --git 
a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java 
b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
index 302200d..2449b38 100644
--- 
a/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
+++ 
b/console/server/src/main/java/org/apache/edgent/console/server/HttpServer.java
@@ -19,6 +19,8 @@ under the License.
 
 package org.apache.edgent.console.server;
 
+import java.io.File;
+
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
@@ -27,8 +29,12 @@ import 
org.eclipse.jetty.server.handler.ContextHandlerCollection;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.webapp.WebAppContext;
 
-import java.io.File;
-
+/**
+ * The "Edgent Console".
+ * <p>
+ * The Console's HTTP server starts with a random available port unless
+ * a port is specified via the {@code edgent.console.port} system property. 
+ */
 public class HttpServer {
 
        /**
@@ -41,8 +47,8 @@ public class HttpServer {
         * The static class that creates the singleton HttpServer object.
         */
     private static class HttpServerHolder {
-        // use port 0 so we know the server will always start
-        private static final Server JETTYSERVER = new Server(0);
+        // use port 0 if system prop not set, so we know the server will 
always start
+        private static final Server JETTYSERVER = new 
Server(Integer.getInteger("edgent.console.port", 0));
         private static final WebAppContext WEBAPP = new WebAppContext();
         private static final HttpServer INSTANCE = new HttpServer();
         private static boolean INITIALIZED = false;

http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/b78b50cb/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
----------------------------------------------------------------------
diff --git 
a/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
 
b/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
index 67106f6..e84f17b 100644
--- 
a/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
+++ 
b/providers/development/src/main/java/org/apache/edgent/providers/development/DevelopmentProvider.java
@@ -44,7 +44,11 @@ import com.google.gson.JsonObject;
  * <UL>
  * <LI>
  * starting an embedded web-server providing the Edgent development console
- * that shows live graphs for running applications.
+ * that shows live graphs for running applications.  
+ * The console {@link HttpServer} is registered as a service with
+ * the provider and is accessible via {@link #getServices()}.
+ * The console's HTTP server starts with a random available port unless
+ * a port is specified via the {@code edgent.console.port} system property.
  * </LI>
  * <LI>
  * Creating a metrics registry with metrics registered

Reply via email to