[10/11] asterixdb git commit: ASTERIXDB-1375 - New Query UI implementation

2016-08-19 Thread imaxon
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/asterix-app/src/main/resources/queryui/css/bootstrap.min.css
--
diff --git 
a/asterixdb/asterix-app/src/main/resources/queryui/css/bootstrap.min.css 
b/asterixdb/asterix-app/src/main/resources/queryui/css/bootstrap.min.css
new file mode 100644
index 000..4cf729e
--- /dev/null
+++ b/asterixdb/asterix-app/src/main/resources/queryui/css/bootstrap.min.css
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.3.6 (http://getbootstrap.com)
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css 
*/html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px
 dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 
0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em
 
40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;fo
 
nt-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html
 
input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html
 
input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em
 .625em .75em;margin:0 2px;border:1px solid 
silver}legend{padding:0;border:0}textarea{overflow:
 
auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*!
 Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css 
*/@media 
print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0
 
0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:"
 (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) 
")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px
 solid 
#999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px
 solid #000}.table{border-collapse:collapse!important}.table td,.table 
th{background-color:#fff!important}.table-bordered td,.table-bordered 
th{border:1px so
 lid #ddd!important}}@font-face{font-family:'Glyphicons 
Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix)
 format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) 
format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) 
format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) 
format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular)
 
format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons
 
Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\
 

[03/11] asterixdb git commit: ASTERIXDB-1375 - New Query UI implementation

2016-08-19 Thread imaxon
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/asterix-app/src/main/resources/queryui/js/javascript.js
--
diff --git a/asterixdb/asterix-app/src/main/resources/queryui/js/javascript.js 
b/asterixdb/asterix-app/src/main/resources/queryui/js/javascript.js
new file mode 100644
index 000..ca87541
--- /dev/null
+++ b/asterixdb/asterix-app/src/main/resources/queryui/js/javascript.js
@@ -0,0 +1,748 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// TODO actually recognize syntax of TypeScript constructs
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+mod(require("../../lib/codemirror"));
+  else if (typeof define == "function" && define.amd) // AMD
+define(["../../lib/codemirror"], mod);
+  else // Plain browser env
+mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+function expressionAllowed(stream, state, backUp) {
+  return /^(?:operator|sof|keyword 
c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
+(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, 
stream.pos - (backUp || 0
+}
+
+CodeMirror.defineMode("javascript", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+  var statementIndent = parserConfig.statementIndent;
+  var jsonldMode = parserConfig.jsonld;
+  var jsonMode = parserConfig.json || jsonldMode;
+  var isTS = parserConfig.typescript;
+  var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\u]/;
+
+  // Tokenizer
+
+  var keywords = function(){
+function kw(type) {return {type: type, style: "keyword"};}
+var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
+var operator = kw("operator"), atom = {type: "atom", style: "atom"};
+
+var jsKeywords = {
+  "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, 
"finally": B,
+  "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, 
"throw": C, "debugger": C,
+  "var": kw("var"), "const": kw("var"), "let": kw("var"),
+  "function": kw("function"), "catch": kw("catch"),
+  "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": 
kw("default"),
+  "in": operator, "typeof": operator, "instanceof": operator,
+  "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": 
atom, "Infinity": atom,
+  "this": kw("this"), "class": kw("class"), "super": kw("atom"),
+  "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
+  "await": C, "async": kw("async")
+};
+
+// Extend the 'normal' keywords with the TypeScript language extensions
+if (isTS) {
+  var type = {type: "variable", style: "variable-3"};
+  var tsKeywords = {
+// object-like things
+"interface": kw("class"),
+"implements": C,
+"namespace": C,
+"module": kw("module"),
+"enum": kw("module"),
+
+// scope modifiers
+"public": kw("modifier"),
+"private": kw("modifier"),
+"protected": kw("modifier"),
+"abstract": kw("modifier"),
+
+// operators
+"as": operator,
+
+// types
+"string": type, "number": type, "boolean": type, "any": type
+  };
+
+  for (var attr in tsKeywords) {
+jsKeywords[attr] = tsKeywords[attr];
+  }
+}
+
+return jsKeywords;
+  }();
+
+  var isOperatorChar = /[+\-*&%=<>!?|~^]/;
+  var isJsonldKeyword = 
/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
+
+  function readRegexp(stream) {
+var escaped = false, next, inSet = false;
+while ((next = stream.next()) != null) {
+  if (!escaped) {
+if (next == "/" && !inSet) return;
+if (next == "[") inSet = true;
+else if (inSet && next == "]") inSet = false;
+  }
+  escaped = !escaped && next == "\\";
+}
+  }
+
+  // Used as scratch variables to communicate multiple values without
+  // consing up tons of objects.
+  var type, content;
+  function ret(tp, style, cont) {
+type = tp; content = cont;
+return style;
+  }
+  function tokenBase(stream, state) {
+var ch = stream.next();
+if (ch == '"' || ch == "'") {
+  state.tokenize = tokenString(ch);
+  return state.tokenize(stream, state);
+} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
+  return ret("number", "number");
+} else if (ch == "." && stream.match("..")) {
+  return ret("spread", "meta");
+} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+  return ret(ch);
+} else if (ch == "=" && stream.eat(">")) {
+  return ret("=>", "operator");
+} else if (ch == "0" && stream.eat(/x/i)) {
+  stream.eatWhile(/[\da-f]/i);
+  return ret("number", "number");
+} else if (ch == "0" && stream.eat(/o/i)) {
+  

[08/11] asterixdb git commit: ASTERIXDB-1375 - New Query UI implementation

2016-08-19 Thread imaxon
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/asterix-app/src/main/resources/queryui/fonts/glyphicons-halflings-regular.svg
--
diff --git 
a/asterixdb/asterix-app/src/main/resources/queryui/fonts/glyphicons-halflings-regular.svg
 
b/asterixdb/asterix-app/src/main/resources/queryui/fonts/glyphicons-halflings-regular.svg
new file mode 100644
index 000..94fb549
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/main/resources/queryui/fonts/glyphicons-halflings-regular.svg
@@ -0,0 +1,288 @@
+
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd; >
+http://www.w3.org/2000/svg;>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

[05/11] asterixdb git commit: ASTERIXDB-1375 - New Query UI implementation

2016-08-19 Thread imaxon
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/asterix-app/src/main/resources/queryui/js/aql-mode.js
--
diff --git a/asterixdb/asterix-app/src/main/resources/queryui/js/aql-mode.js 
b/asterixdb/asterix-app/src/main/resources/queryui/js/aql-mode.js
new file mode 100644
index 000..e7ef057
--- /dev/null
+++ b/asterixdb/asterix-app/src/main/resources/queryui/js/aql-mode.js
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+CodeMirror.defineMode("aql", function() {
+
+  var KEYWORD_MATCH = 
["return","select","for","from","at","in","let","with","where","order","by","asc","desc","group",
+
"keeping","limit","offset","distinct","dataset","or","and"];
+  var VAR_MATCH = /[$][a-zA-Z]+(\d*)/;
+  var DOT_MATCH = /[.](\S)*/;
+  var DOUBLE_QUOTE_MATCH = /["].*["]/;
+  var SINGLE_QUOTE_MATCH = /['].*[']/;
+  var BREAK_POINT = /(\s)/;
+  return {
+startState: function() {return {inString: false};},
+token: function(stream, state) {
+
+  if (state.newLine == undefined)state.newLine = true;
+
+  //match variable reference
+  if (stream.match(VAR_MATCH)) {
+return "variable-2";
+  }
+
+  if (stream.match(DOT_MATCH)) {
+return "variable-3";
+  }
+
+  //string variable match
+  if (stream.match(DOUBLE_QUOTE_MATCH)) {
+return "string";
+  }
+  if (stream.match(SINGLE_QUOTE_MATCH)) {
+return "string";
+  }
+
+  //keyword match
+  for (i in KEYWORD_MATCH){
+if (state.newLine && stream.match(KEYWORD_MATCH[i])){
+return "keyword";
+ }
+  }
+  if (stream.peek() === " " || stream.peek() === null){
+state.newLine = true;
+  }else{
+state.newLine = false;
+  }
+  stream.next();
+
+  }
+  };
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/asterix-app/src/main/resources/queryui/js/bootstrap.min.js
--
diff --git 
a/asterixdb/asterix-app/src/main/resources/queryui/js/bootstrap.min.js 
b/asterixdb/asterix-app/src/main/resources/queryui/js/bootstrap.min.js
new file mode 100644
index 000..e79c065
--- /dev/null
+++ b/asterixdb/asterix-app/src/main/resources/queryui/js/bootstrap.min.js
@@ -0,0 +1,7 @@
+/*!
+ * Bootstrap v3.3.6 (http://getbootstrap.com)
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under the MIT license
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires 
jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" 
")[0].split(".");if(b[0]<2&[1]<9||1==b[0]&&9==b[1]&[2]<1||b[0]>2)throw new 
Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but 
lower than version 3")}(jQuery),+function(a){"use strict";function b(){var 
a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd
 otransitionend",transition:"transitionend"};for(var c in b)if(void 
0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var
 c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var 
e=function(){c||a(d).trigger(a.support.transition.end)};return 
setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return
  a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 
0}})})}(jQuery),+function(a){"use strict";function b(b){return 
this.each(function(){var 
c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new 
d(this)),"string"==typeof b&[b].call(c)})}var 
c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.6",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function
 c(){g.detach().trigger("closed.bs.alert").remove()}var 

[11/11] asterixdb git commit: ASTERIXDB-1375 - New Query UI implementation

2016-08-19 Thread imaxon
ASTERIXDB-1375 - New Query UI implementation

Implemented UI using bootstrap according to specification
Wrote the client side logic using Angular JS
Using CodeMirror and custom mode to do syntax highlighting.
Modified HTTP API to support CORS.
Custom servlet to host new Web Ui on port 19006.
CHANGES
Changed resource folder name to "queryui"
Fixed SonarQube problems
Dynamic HTTP API port, instead of hardcoded value
... Jul 5 2016
Using JSONObject for Dynamic HTTP APi Port
Improved Animations
Added Collapsable side panal
Updated LICENSE file
... Aug 7 2016
Fixed Logger level to Error
... Aug 16 2016
Rebased
Change-Id: Id9aa6fb0a6bebaaa58f288e621dbfe76a604c689
Reviewed-on: https://asterix-gerrit.ics.uci.edu/935
Sonar-Qube: Jenkins 
Tested-by: Jenkins 
Integration-Tests: Jenkins 
Reviewed-by: Ian Maxon 


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

Branch: refs/heads/master
Commit: a4815d35375e249615e76679bbd8a0dd47f7b129
Parents: 7a180bc
Author: Kaveen Rodrigo 
Authored: Wed Aug 17 23:30:49 2016 +0530
Committer: Ian Maxon 
Committed: Fri Aug 19 16:00:24 2016 -0700

--
 .gitignore  |2 +
 asterixdb/LICENSE   |  160 +
 .../http/servlet/QueryWebInterfaceServlet.java  |  133 +
 .../api/http/servlet/RESTAPIServlet.java|4 +
 .../bootstrap/CCApplicationEntryPoint.java  |   19 +-
 .../queryui/css/bootstrap-theme.min.css |6 +
 .../resources/queryui/css/bootstrap.min.css |6 +
 .../main/resources/queryui/css/codemirror.css   |  337 +
 .../queryui/css/json-formatter.min.css  |6 +
 .../src/main/resources/queryui/css/master.css   |  241 +
 .../fonts/glyphicons-halflings-regular.eot  |  Bin 0 -> 20127 bytes
 .../fonts/glyphicons-halflings-regular.svg  |  288 +
 .../fonts/glyphicons-halflings-regular.ttf  |  Bin 0 -> 45404 bytes
 .../fonts/glyphicons-halflings-regular.woff |  Bin 0 -> 23424 bytes
 .../fonts/glyphicons-halflings-regular.woff2|  Bin 0 -> 18028 bytes
 .../queryui/img/asterixlogo-collapsed.png   |  Bin 0 -> 9255 bytes
 .../resources/queryui/img/finalasterixlogo.png  |  Bin 0 -> 37859 bytes
 .../main/resources/queryui/js/angular.min.js|  314 +
 .../src/main/resources/queryui/js/aql-mode.js   |   66 +
 .../main/resources/queryui/js/bootstrap.min.js  |7 +
 .../src/main/resources/queryui/js/codemirror.js | 8908 ++
 .../src/main/resources/queryui/js/javascript.js |  748 ++
 .../resources/queryui/js/jquery-1.12.4.min.js   |5 +
 .../resources/queryui/js/json-formatter.min.js  |7 +
 .../src/main/resources/queryui/js/main.js   |  245 +
 .../main/resources/queryui/js/ui-codemirror.js  |  150 +
 .../src/main/resources/queryui/queryui.html |  159 +
 .../config/AsterixExternalProperties.java   |8 +
 .../resources/conf/asterix-configuration.xml|7 +
 29 files changed, 11825 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/.gitignore
--
diff --git a/.gitignore b/.gitignore
index b4129bf..11d149b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,5 +48,7 @@ output
 tmp
 dist
 *~
+.DS_Store
 *.swp
 .m2*
+ß
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/a4815d35/asterixdb/LICENSE
--
diff --git a/asterixdb/LICENSE b/asterixdb/LICENSE
index 578fa00..427fa0a 100644
--- a/asterixdb/LICENSE
+++ b/asterixdb/LICENSE
@@ -346,3 +346,163 @@ Released under MIT License
 
 Source: https://github.com/anomal/RainbowVis-JS
 
+For portions of the AsterixDB QueryUI at:
+asterix-app/src/main/resources/queryui/js/jquery-1.12.4.min.js
+
+Copyright jQuery Foundation and other contributors, https://jquery.org/
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/jquery/jquery
+
+The following license applies to all parts of this software except as
+documented below:
+
+
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute,