HTRACE-180 Move the GUI to a top-level subproject. (stack via cmccabe)

Create new module named htrace-webapp to house webapp. Add a pom to it
that generates a WAR file. Move the web dir from htrace-htraced to this
new module at src/main/web Added a web.xml so WAR builds. Changed the
symlink over in htrace-htraced/go/gobuild.sh to point at the new
location.  Fixed a bug where the java REST client was looking for
htraced in the wrong location.
diff --git a/.gitignore b/.gitignore
index 8735de5..4baf9e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
 *~
 *.swp
 dependency-reduced-pom.xml
-htrace-htraced/src/go/build
-htrace-htraced/src/go/pkg
+htrace-htraced/go/build
+htrace-htraced/go/pkg
+htrace-htraced/go/web
 htrace-htraced/bin
diff --git a/htrace-htraced/go/gobuild.sh b/htrace-htraced/go/gobuild.sh
index 259e6a7..121d55b 100755
--- a/htrace-htraced/go/gobuild.sh
+++ b/htrace-htraced/go/gobuild.sh
@@ -108,7 +108,7 @@
     go install ${TAGS} -ldflags "${FLAGS}" -v org/apache/htrace/... "$@"
     # Make a symlink to web src dir so can do development in-situ out
     # of build dir. This is ugly but blame go build.
-    ln -fs "../src/web" "${GOBIN}/../"
+    ln -fs "../../htrace-webapp/src/main/web" "${GOBIN}/../"
     ;;
 bench)
     go test org/apache/htrace/... ${TAGS} -test.bench=. "$@"
diff --git a/htrace-htraced/pom.xml b/htrace-htraced/pom.xml
index 09324b1..d775850 100644
--- a/htrace-htraced/pom.xml
+++ b/htrace-htraced/pom.xml
@@ -179,6 +179,13 @@
       <classifier>tests</classifier>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.htrace</groupId>
+      <artifactId>htrace-webapp</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+      <scope>provided</scope>
+    </dependency>
     <!-- Global deps. -->
     <dependency>
       <groupId>commons-logging</groupId>
diff --git a/htrace-htraced/src/test/java/org/apache/htrace/util/HTracedProcess.java b/htrace-htraced/src/test/java/org/apache/htrace/util/HTracedProcess.java
index 5fa5d95..3e800d2 100644
--- a/htrace-htraced/src/test/java/org/apache/htrace/util/HTracedProcess.java
+++ b/htrace-htraced/src/test/java/org/apache/htrace/util/HTracedProcess.java
@@ -166,7 +166,7 @@
    * @return Path to the htraced binary.
    */
   public static File getPathToHTraceBinaryFromTopLevel(final File topLevel) {
-    return new File(new File(new File(new File(new File(topLevel, "htrace-htraced"), "src"), "go"),
-      "build"), "htraced");
+    return new File(new File(new File(new File(topLevel, "htrace-htraced"), "go"), "build"),
+      "htraced");
   }
 }
diff --git a/htrace-webapp/README.md b/htrace-webapp/README.md
new file mode 100644
index 0000000..3f11b79
--- /dev/null
+++ b/htrace-webapp/README.md
@@ -0,0 +1,21 @@
+<!--
+ 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.
+-->
+
+htrace-webapp
+============
+
+htrace-webapp provides a web interface to an htrace server.
diff --git a/htrace-webapp/pom.xml b/htrace-webapp/pom.xml
new file mode 100644
index 0000000..b5cd156
--- /dev/null
+++ b/htrace-webapp/pom.xml
@@ -0,0 +1,104 @@
+<?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. -->
+<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>
+
+  <artifactId>htrace-webapp</artifactId>
+  <packaging>war</packaging>
+
+  <parent>
+    <artifactId>htrace</artifactId>
+    <groupId>org.apache.htrace</groupId>
+    <version>3.3.0-incubating-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <name>htrace-webapp</name>
+  <description>A webapp for an htrace server</description>
+  <url>http://incubator.apache.org/projects/htrace.html</url>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <webXml>src/main/web/WEB-INF/web.xml</webXml>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <descriptorRefs>
+            <descriptorRef>project</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-gpg-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <!-- explicitly define maven-deploy-plugin after other to force exec order -->
+        <artifactId>maven-deploy-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- Module deps. -->
+    <dependency>
+      <groupId>org.apache.htrace</groupId>
+      <artifactId>htrace-core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.htrace</groupId>
+      <artifactId>htrace-core</artifactId>
+      <version>${project.version}</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>dist</id>
+      <build>
+        <plugins>
+          <plugin>
+            <!--Make it so assembly:single does nothing in here-->
+            <artifactId>maven-assembly-plugin</artifactId>
+            <configuration>
+              <skipAssembly>true</skipAssembly>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/htrace-webapp/src/main/web/WEB-INF/web.xml b/htrace-webapp/src/main/web/WEB-INF/web.xml
new file mode 100644
index 0000000..38c7a98
--- /dev/null
+++ b/htrace-webapp/src/main/web/WEB-INF/web.xml
@@ -0,0 +1,20 @@
+<?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 version="3.0" 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_3_0.xsd">
+
+ <display-name>HTrace</display-name>
+<description>WebApp that goes against an htrace server.
+</description>
+</web-app>
diff --git a/htrace-htraced/src/web/app/about_view.js b/htrace-webapp/src/main/web/app/about_view.js
similarity index 100%
rename from htrace-htraced/src/web/app/about_view.js
rename to htrace-webapp/src/main/web/app/about_view.js
diff --git a/htrace-htraced/src/web/app/modal.js b/htrace-webapp/src/main/web/app/modal.js
similarity index 100%
rename from htrace-htraced/src/web/app/modal.js
rename to htrace-webapp/src/main/web/app/modal.js
diff --git a/htrace-htraced/src/web/app/predicate.js b/htrace-webapp/src/main/web/app/predicate.js
similarity index 100%
rename from htrace-htraced/src/web/app/predicate.js
rename to htrace-webapp/src/main/web/app/predicate.js
diff --git a/htrace-htraced/src/web/app/predicate_view.js b/htrace-webapp/src/main/web/app/predicate_view.js
similarity index 100%
rename from htrace-htraced/src/web/app/predicate_view.js
rename to htrace-webapp/src/main/web/app/predicate_view.js
diff --git a/htrace-htraced/src/web/app/query_results.js b/htrace-webapp/src/main/web/app/query_results.js
similarity index 100%
rename from htrace-htraced/src/web/app/query_results.js
rename to htrace-webapp/src/main/web/app/query_results.js
diff --git a/htrace-htraced/src/web/app/router.js b/htrace-webapp/src/main/web/app/router.js
similarity index 100%
rename from htrace-htraced/src/web/app/router.js
rename to htrace-webapp/src/main/web/app/router.js
diff --git a/htrace-htraced/src/web/app/search_result.js b/htrace-webapp/src/main/web/app/search_result.js
similarity index 100%
rename from htrace-htraced/src/web/app/search_result.js
rename to htrace-webapp/src/main/web/app/search_result.js
diff --git a/htrace-htraced/src/web/app/search_results.js b/htrace-webapp/src/main/web/app/search_results.js
similarity index 100%
rename from htrace-htraced/src/web/app/search_results.js
rename to htrace-webapp/src/main/web/app/search_results.js
diff --git a/htrace-htraced/src/web/app/search_results_view.js b/htrace-webapp/src/main/web/app/search_results_view.js
similarity index 100%
rename from htrace-htraced/src/web/app/search_results_view.js
rename to htrace-webapp/src/main/web/app/search_results_view.js
diff --git a/htrace-htraced/src/web/app/search_view.js b/htrace-webapp/src/main/web/app/search_view.js
similarity index 100%
rename from htrace-htraced/src/web/app/search_view.js
rename to htrace-webapp/src/main/web/app/search_view.js
diff --git a/htrace-htraced/src/web/app/server_info.js b/htrace-webapp/src/main/web/app/server_info.js
similarity index 100%
rename from htrace-htraced/src/web/app/server_info.js
rename to htrace-webapp/src/main/web/app/server_info.js
diff --git a/htrace-htraced/src/web/app/span.js b/htrace-webapp/src/main/web/app/span.js
similarity index 100%
rename from htrace-htraced/src/web/app/span.js
rename to htrace-webapp/src/main/web/app/span.js
diff --git a/htrace-htraced/src/web/app/span_details_view.js b/htrace-webapp/src/main/web/app/span_details_view.js
similarity index 100%
rename from htrace-htraced/src/web/app/span_details_view.js
rename to htrace-webapp/src/main/web/app/span_details_view.js
diff --git a/htrace-htraced/src/web/app/span_group_widget.js b/htrace-webapp/src/main/web/app/span_group_widget.js
similarity index 100%
rename from htrace-htraced/src/web/app/span_group_widget.js
rename to htrace-webapp/src/main/web/app/span_group_widget.js
diff --git a/htrace-htraced/src/web/app/span_widget.js b/htrace-webapp/src/main/web/app/span_widget.js
similarity index 100%
rename from htrace-htraced/src/web/app/span_widget.js
rename to htrace-webapp/src/main/web/app/span_widget.js
diff --git a/htrace-htraced/src/web/app/string.js b/htrace-webapp/src/main/web/app/string.js
similarity index 100%
rename from htrace-htraced/src/web/app/string.js
rename to htrace-webapp/src/main/web/app/string.js
diff --git a/htrace-htraced/src/web/app/time_cursor.js b/htrace-webapp/src/main/web/app/time_cursor.js
similarity index 100%
rename from htrace-htraced/src/web/app/time_cursor.js
rename to htrace-webapp/src/main/web/app/time_cursor.js
diff --git a/htrace-htraced/src/web/app/tree.js b/htrace-webapp/src/main/web/app/tree.js
similarity index 100%
rename from htrace-htraced/src/web/app/tree.js
rename to htrace-webapp/src/main/web/app/tree.js
diff --git a/htrace-htraced/src/web/app/triangle_button.js b/htrace-webapp/src/main/web/app/triangle_button.js
similarity index 100%
rename from htrace-htraced/src/web/app/triangle_button.js
rename to htrace-webapp/src/main/web/app/triangle_button.js
diff --git a/htrace-htraced/src/web/app/widget_manager.js b/htrace-webapp/src/main/web/app/widget_manager.js
similarity index 100%
rename from htrace-htraced/src/web/app/widget_manager.js
rename to htrace-webapp/src/main/web/app/widget_manager.js
diff --git a/htrace-htraced/src/web/custom.css b/htrace-webapp/src/main/web/custom.css
similarity index 100%
rename from htrace-htraced/src/web/custom.css
rename to htrace-webapp/src/main/web/custom.css
diff --git a/htrace-htraced/src/web/image/owl.png b/htrace-webapp/src/main/web/image/owl.png
similarity index 100%
rename from htrace-htraced/src/web/image/owl.png
rename to htrace-webapp/src/main/web/image/owl.png
Binary files differ
diff --git a/htrace-htraced/src/web/index.html b/htrace-webapp/src/main/web/index.html
similarity index 100%
rename from htrace-htraced/src/web/index.html
rename to htrace-webapp/src/main/web/index.html
diff --git a/htrace-htraced/src/web/lib/backbone-1.1.2.js b/htrace-webapp/src/main/web/lib/backbone-1.1.2.js
similarity index 100%
rename from htrace-htraced/src/web/lib/backbone-1.1.2.js
rename to htrace-webapp/src/main/web/lib/backbone-1.1.2.js
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css.map b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css.map
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css.map
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.css.map
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.min.css b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.min.css
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap-theme.min.css
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap-theme.min.css
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.css b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.css
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.css
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.css
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.css.map b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.css.map
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.css.map
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.css.map
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.min.css b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.min.css
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/css/bootstrap.min.css
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/css/bootstrap.min.css
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/js/bootstrap.js b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/bootstrap.js
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/js/bootstrap.js
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/bootstrap.js
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/js/bootstrap.min.js b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/bootstrap.min.js
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/js/bootstrap.min.js
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/bootstrap.min.js
diff --git a/htrace-htraced/src/web/lib/bootstrap-3.3.1/js/npm.js b/htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/npm.js
similarity index 100%
rename from htrace-htraced/src/web/lib/bootstrap-3.3.1/js/npm.js
rename to htrace-webapp/src/main/web/lib/bootstrap-3.3.1/js/npm.js
diff --git a/htrace-htraced/src/web/lib/jquery-2.1.4.js b/htrace-webapp/src/main/web/lib/jquery-2.1.4.js
similarity index 100%
rename from htrace-htraced/src/web/lib/jquery-2.1.4.js
rename to htrace-webapp/src/main/web/lib/jquery-2.1.4.js
diff --git a/htrace-htraced/src/web/lib/moment-2.10.3.js b/htrace-webapp/src/main/web/lib/moment-2.10.3.js
similarity index 100%
rename from htrace-htraced/src/web/lib/moment-2.10.3.js
rename to htrace-webapp/src/main/web/lib/moment-2.10.3.js
diff --git a/htrace-htraced/src/web/lib/underscore-1.7.0.js b/htrace-webapp/src/main/web/lib/underscore-1.7.0.js
similarity index 100%
rename from htrace-htraced/src/web/lib/underscore-1.7.0.js
rename to htrace-webapp/src/main/web/lib/underscore-1.7.0.js
diff --git a/pom.xml b/pom.xml
index c1a8d25..52f0825 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,7 @@
   <modules>
     <module>htrace-c</module>
     <module>htrace-core</module>
+    <module>htrace-webapp</module>
     <module>htrace-zipkin</module>
     <module>htrace-hbase</module>
     <module>htrace-flume</module>
@@ -167,6 +168,10 @@
                 <exclude>**/web/lib/**</exclude>
                 <exclude>**/*.min.js</exclude>
                 <exclude>**/d3.min.js</exclude>
+                <exclude>**/backbone-*.js</exclude>
+                <exclude>**/jquery-*.js</exclude>
+                <exclude>**/moment-*.js</exclude>
+                <exclude>**/underscore-*.js</exclude>
                 <!-- Pulled down sources -->
                 <exclude>**/build/src/**</exclude>
                 <exclude>**/build/pkg/**</exclude>