incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [17/18] git commit: Fixing the blur status pages.
Date Thu, 15 Jan 2015 14:38:05 GMT
Fixing the blur status pages.


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

Branch: refs/heads/master
Commit: dcd1bc0e0e4077f0a03b3d3dbd3c130a0c5997f1
Parents: 1d38470
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu Jan 15 09:37:22 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu Jan 15 09:37:22 2015 -0500

----------------------------------------------------------------------
 blur-status/pom.xml                             |   37 +-
 .../org/apache/blur/gui/HttpJettyServer.java    |   29 +-
 .../main/java/org/apache/blur/gui/Testing.java  |   28 +
 .../src/main/resources/webapp/WEB-INF/web.xml   |   24 +
 .../src/main/resources/webapp/config.html       |   81 +
 .../main/resources/webapp/css/bootstrap.min.css |    9 +
 .../src/main/resources/webapp/css/bs-docs.css   |  951 +++
 .../src/main/resources/webapp/index.html        |  124 +
 .../src/main/resources/webapp/js/Blur.js        | 6664 +++++++++++++++++
 .../src/main/resources/webapp/js/Blur_types.js  | 3258 ++++++++
 .../src/main/resources/webapp/js/d3.v2.js       | 7061 ++++++++++++++++++
 .../src/main/resources/webapp/js/d3.v2.min.js   |   32 +
 .../resources/webapp/js/jquery-1.9.1.min.js     |   27 +
 .../src/main/resources/webapp/js/thrift.js      |  775 ++
 .../src/main/resources/webapp/metrics.html      |  110 +
 .../src/main/resources/webapp/traces.html       |  302 +
 blur-status/src/main/webapp/WEB-INF/web.xml     |   25 -
 blur-status/src/main/webapp/config.html         |   81 -
 .../src/main/webapp/css/bootstrap.min.css       |    9 -
 blur-status/src/main/webapp/css/bs-docs.css     |  951 ---
 blur-status/src/main/webapp/index.html          |  124 -
 blur-status/src/main/webapp/js/Blur.js          | 6664 -----------------
 blur-status/src/main/webapp/js/Blur_types.js    | 3258 --------
 blur-status/src/main/webapp/js/d3.v2.js         | 7061 ------------------
 blur-status/src/main/webapp/js/d3.v2.min.js     |   32 -
 .../src/main/webapp/js/jquery-1.9.1.min.js      |   27 -
 blur-status/src/main/webapp/js/thrift.js        |  775 --
 blur-status/src/main/webapp/metrics.html        |  110 -
 blur-status/src/main/webapp/traces.html         |  302 -
 pom.xml                                         |    4 +-
 30 files changed, 19470 insertions(+), 19465 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dcd1bc0e/blur-status/pom.xml
----------------------------------------------------------------------
diff --git a/blur-status/pom.xml b/blur-status/pom.xml
index d0eb90d..80f7d2d 100644
--- a/blur-status/pom.xml
+++ b/blur-status/pom.xml
@@ -1,22 +1,14 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!--
-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.
--->
+<!-- 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. -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
@@ -39,6 +31,10 @@ under the License.
 
 	<dependencies>
 		<dependency>
+			<groupId>org.eclipse.jetty</groupId>
+			<artifactId>jetty-webapp</artifactId>
+		</dependency>
+		<dependency>
 			<groupId>org.apache.blur</groupId>
 			<artifactId>blur-thrift</artifactId>
 			<version>${project.version}</version>
@@ -58,10 +54,7 @@ under the License.
 			<artifactId>metrics-servlet</artifactId>
 			<version>${metrics.version}</version>
 		</dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-        </dependency>
+
 		<dependency>
 			<groupId>log4j</groupId>
 			<artifactId>log4j</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dcd1bc0e/blur-status/src/main/java/org/apache/blur/gui/HttpJettyServer.java
----------------------------------------------------------------------
diff --git a/blur-status/src/main/java/org/apache/blur/gui/HttpJettyServer.java b/blur-status/src/main/java/org/apache/blur/gui/HttpJettyServer.java
index 30b690a..8b8e4c4 100644
--- a/blur-status/src/main/java/org/apache/blur/gui/HttpJettyServer.java
+++ b/blur-status/src/main/java/org/apache/blur/gui/HttpJettyServer.java
@@ -18,17 +18,16 @@ package org.apache.blur.gui;
  */
 import java.io.File;
 import java.io.IOException;
-import java.util.Properties;
 
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-
-import com.yammer.metrics.reporting.MetricsServlet;
-import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.webapp.WebAppContext;
 
+import com.yammer.metrics.reporting.MetricsServlet;
+
 /**
  * Starts up a Jetty server to run the utility gui.
  */
@@ -98,23 +97,7 @@ public class HttpJettyServer {
     return context;
   }
 
-  private static String findBlurGuiInClassPath() {
-    Properties properties = System.getProperties();
-    String cp = (String) properties.get("java.class.path");
-    String[] split = cp.split(":");
-    for (String s : split) {
-      if (s.endsWith(".war")) {
-        return s;
-      }
-    }
-    return null;
-  }
-
   private String getWarFolder(Class<?> c) {
-    String findBlurGuiInClassPath = findBlurGuiInClassPath();
-    if (findBlurGuiInClassPath != null) {
-      return findBlurGuiInClassPath;
-    }
     String name = c.getName().replace('.', '/');
     String classResource = "/" + name + ".class";
     String pathToClassResource = c.getResource(classResource).toString();
@@ -124,10 +107,12 @@ public class HttpJettyServer {
       int index = pathToClassResource.indexOf(name);
       String pathToClasses = pathToClassResource.substring(0, index);
       int indexOfProjectName = pathToClasses.indexOf("/target/");
-      String str = pathToClasses.substring(0, indexOfProjectName) + "/src/main/webapp";
+      String str = pathToClasses.substring(0, indexOfProjectName) + "/src/main/resources/webapp";
       return str;
+    } else {
+      String path = pathToClassResource.substring(0, indexOfJar + 4) + "!/webapp";
+      return path;
     }
-    return null;
   }
 
   public void close() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dcd1bc0e/blur-status/src/main/java/org/apache/blur/gui/Testing.java
----------------------------------------------------------------------
diff --git a/blur-status/src/main/java/org/apache/blur/gui/Testing.java b/blur-status/src/main/java/org/apache/blur/gui/Testing.java
new file mode 100644
index 0000000..7bf2716
--- /dev/null
+++ b/blur-status/src/main/java/org/apache/blur/gui/Testing.java
@@ -0,0 +1,28 @@
+/**
+ * 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.blur.gui;
+
+import java.io.IOException;
+
+public class Testing {
+
+  public static void main(String[] args) throws IOException {
+    HttpJettyServer server = new HttpJettyServer(HttpJettyServer.class, 10000);
+    
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dcd1bc0e/blur-status/src/main/resources/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/blur-status/src/main/resources/webapp/WEB-INF/web.xml b/blur-status/src/main/resources/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..0efc4b6
--- /dev/null
+++ b/blur-status/src/main/resources/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	version="2.5">
+	<display-name>Blur</display-name>
+</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/dcd1bc0e/blur-status/src/main/resources/webapp/config.html
----------------------------------------------------------------------
diff --git a/blur-status/src/main/resources/webapp/config.html b/blur-status/src/main/resources/webapp/config.html
new file mode 100644
index 0000000..5e20675
--- /dev/null
+++ b/blur-status/src/main/resources/webapp/config.html
@@ -0,0 +1,81 @@
+<!--
+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.
+-->
+<html>
+<head>
+<title>Blur - Config</title>
+<meta charset="utf-8">
+<link href="css/bootstrap.min.css" rel="stylesheet">
+<link href="css/bs-docs.css" rel="stylesheet" media="screen">
+</head>
+
+<script src="js/jquery-1.9.1.min.js"></script>
+<script src="js/thrift.js"></script>
+<script src="js/Blur.js"></script>
+<script src="js/Blur_types.js"></script>
+<script>
+function displayPage() {
+    var transport = new Thrift.Transport("/blur");
+    var protocol  = new Thrift.Protocol(transport);
+    var client    = new BlurClient(protocol);
+        
+    try {
+	  var config = client.configuration();
+	  var body = $("#page_body");
+	  var keys = Object.keys(config).sort();
+      body.append("<h2>Configuration</h2>");
+      var s = "<table border=1 class=\"table-bordered table-striped table-condensed\"><tr><th>Name</th><th>Value</th></tr>";
+	  for (var i = 0; i < keys.length; i++) {
+        var key = keys[i];
+        s += "<tr><td>"+key+"</td><td>"+config[key]+"</td></tr>";
+      }
+      body.append(s + "</table>");
+    } catch(ouch){
+alert (ouch);
+    }
+}
+$(window).bind("load", displayPage);
+</script>
+<body>
+  <div class="navbar navbar-inverse navbar-fixed-top">
+    <div class="container">
+      <div class="navbar-header">
+        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </button>
+        <a class="navbar-brand" href="http://incubator.apache.org/blur">Apache Blur
(Incubator)</a>
+      </div>
+      <div class="collapse navbar-collapse">
+        <ul class="nav navbar-nav">
+          <li><a href="index.html">Home</a></li>
+          <li class="active"><a href="config.html">Configuration</a></li>
+          <li><a href="metrics.html">Metrics</a></li>
+          <li><a href="traces.html">Traces</a></li>
+        </ul>
+      </div>
+    </div>
+  </div>
+	<table class="table-bordered table-condensed">
+		<tr><td id="page_body"></td></tr>
+	</table>
+
+
+</body>
+</html>


Mime
View raw message