incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1180754 [3/3] - in /incubator/ambari/branches/branch-0.0: ./ bin/ common/src/main/java/org/apache/hms/common/conf/ common/src/main/java/org/apache/hms/common/entity/manifest/ common/src/main/java/org/apache/hms/common/util/ controller/ con...
Date Mon, 10 Oct 2011 00:57:21 GMT
Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/index.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/index.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/index.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/index.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,78 @@
+<!doctype html>
+<html>
+  <head>
+    <title>CodeMirror 2: JavaScript mode</title>
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="javascript.js"></script>
+    <link rel="stylesheet" href="../../theme/default.css">
+    <link rel="stylesheet" href="../../css/docs.css">
+    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+  </head>
+  <body>
+    <h1>CodeMirror 2: JavaScript mode</h1>
+
+<div><textarea id="code" name="code">
+// Demo code (the actual new parser character stream implementation)
+
+function StringStream(string) {
+  this.pos = 0;
+  this.string = string;
+}
+
+StringStream.prototype = {
+  done: function() {return this.pos >= this.string.length;},
+  peek: function() {return this.string.charAt(this.pos);},
+  next: function() {
+    if (this.pos &lt; this.string.length)
+      return this.string.charAt(this.pos++);
+  },
+  eat: function(match) {
+    var ch = this.string.charAt(this.pos);
+    if (typeof match == "string") var ok = ch == match;
+    else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
+    if (ok) {this.pos++; return ch;}
+  },
+  eatWhile: function(match) {
+    var start = this.pos;
+    while (this.eat(match));
+    if (this.pos > start) return this.string.slice(start, this.pos);
+  },
+  backUp: function(n) {this.pos -= n;},
+  column: function() {return this.pos;},
+  eatSpace: function() {
+    var start = this.pos;
+    while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
+    return this.pos - start;
+  },
+  match: function(pattern, consume, caseInsensitive) {
+    if (typeof pattern == "string") {
+      function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
+      if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
+        if (consume !== false) this.pos += str.length;
+        return true;
+      }
+    }
+    else {
+      var match = this.string.slice(this.pos).match(pattern);
+      if (match &amp;&amp; consume !== false) this.pos += match[0].length;
+      return match;
+    }
+  }
+};
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true
+      });
+    </script>
+
+    <p>JavaScript mode supports a single configuration
+    option, <code>json</code>, which will set the mode to expect JSON
+    data rather than a JavaScript program.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
+  </body>
+</html>

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/javascript.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/javascript.js?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/javascript.js (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/javascript/javascript.js Mon Oct 10 00:57:19 2011
@@ -0,0 +1,352 @@
+CodeMirror.defineMode("javascript", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+  var jsonMode = parserConfig.json;
+
+  // 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"};
+    return {
+      "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
+      "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
+      "var": 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
+    };
+  }();
+
+  var isOperatorChar = /[+\-*&%=<>!?|]/;
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  function nextUntilUnescaped(stream, end) {
+    var escaped = false, next;
+    while ((next = stream.next()) != null) {
+      if (next == end && !escaped)
+        return false;
+      escaped = !escaped && next == "\\";
+    }
+    return escaped;
+  }
+
+  // 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 jsTokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"' || ch == "'")
+      return chain(stream, state, jsTokenString(ch));
+    else if (/[\[\]{}\(\),;\:\.]/.test(ch))
+      return ret(ch);
+    else if (ch == "0" && stream.eat(/x/i)) {
+      stream.eatWhile(/[\da-f]/i);
+      return ret("number", "number");
+    }      
+    else if (/\d/.test(ch)) {
+      stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
+      return ret("number", "number");
+    }
+    else if (ch == "/") {
+      if (stream.eat("*")) {
+        return chain(stream, state, jsTokenComment);
+      }
+      else if (stream.eat("/")) {
+        stream.skipToEnd();
+        return ret("comment", "comment");
+      }
+      else if (state.reAllowed) {
+        nextUntilUnescaped(stream, "/");
+        stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
+        return ret("regexp", "string");
+      }
+      else {
+        stream.eatWhile(isOperatorChar);
+        return ret("operator", null, stream.current());
+      }
+    }
+    else if (ch == "#") {
+        stream.skipToEnd();
+        return ret("error", "error");
+    }
+    else if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return ret("operator", null, stream.current());
+    }
+    else {
+      stream.eatWhile(/[\w\$_]/);
+      var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
+      return known ? ret(known.type, known.style, word) :
+                     ret("variable", "variable", word);
+    }
+  }
+
+  function jsTokenString(quote) {
+    return function(stream, state) {
+      if (!nextUntilUnescaped(stream, quote))
+        state.tokenize = jsTokenBase;
+      return ret("string", "string");
+    };
+  }
+
+  function jsTokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = jsTokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return ret("comment", "comment");
+  }
+
+  // Parser
+
+  var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
+
+  function JSLexical(indented, column, type, align, prev, info) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.prev = prev;
+    this.info = info;
+    if (align != null) this.align = align;
+  }
+
+  function inScope(state, varname) {
+    for (var v = state.localVars; v; v = v.next)
+      if (v.name == varname) return true;
+  }
+
+  function parseJS(state, style, type, content, stream) {
+    var cc = state.cc;
+    // Communicate our context to the combinators.
+    // (Less wasteful than consing up a hundred closures on every call.)
+    cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
+  
+    if (!state.lexical.hasOwnProperty("align"))
+      state.lexical.align = true;
+
+    while(true) {
+      var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
+      if (combinator(type, content)) {
+        while(cc.length && cc[cc.length - 1].lex)
+          cc.pop()();
+        if (cx.marked) return cx.marked;
+        if (type == "variable" && inScope(state, content)) return "variable-2";
+        return style;
+      }
+    }
+  }
+
+  // Combinator utils
+
+  var cx = {state: null, column: null, marked: null, cc: null};
+  function pass() {
+    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+  }
+  function cont() {
+    pass.apply(null, arguments);
+    return true;
+  }
+  function register(varname) {
+    var state = cx.state;
+    if (state.context) {
+      cx.marked = "def";
+      for (var v = state.localVars; v; v = v.next)
+        if (v.name == varname) return;
+      state.localVars = {name: varname, next: state.localVars};
+    }
+  }
+
+  // Combinators
+
+  var defaultVars = {name: "this", next: {name: "arguments"}};
+  function pushcontext() {
+    if (!cx.state.context) cx.state.localVars = defaultVars;
+    cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
+  }
+  function popcontext() {
+    cx.state.localVars = cx.state.context.vars;
+    cx.state.context = cx.state.context.prev;
+  }
+  function pushlex(type, info) {
+    var result = function() {
+      var state = cx.state;
+      state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
+    };
+    result.lex = true;
+    return result;
+  }
+  function poplex() {
+    var state = cx.state;
+    if (state.lexical.prev) {
+      if (state.lexical.type == ")")
+        state.indented = state.lexical.indented;
+      state.lexical = state.lexical.prev;
+    }
+  }
+  poplex.lex = true;
+
+  function expect(wanted) {
+    return function expecting(type) {
+      if (type == wanted) return cont();
+      else if (wanted == ";") return pass();
+      else return cont(arguments.callee);
+    };
+  }
+
+  function statement(type) {
+    if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
+    if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
+    if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
+    if (type == "{") return cont(pushlex("}"), block, poplex);
+    if (type == ";") return cont();
+    if (type == "function") return cont(functiondef);
+    if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
+                                      poplex, statement, poplex);
+    if (type == "variable") return cont(pushlex("stat"), maybelabel);
+    if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
+                                         block, poplex, poplex);
+    if (type == "case") return cont(expression, expect(":"));
+    if (type == "default") return cont(expect(":"));
+    if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
+                                        statement, poplex, popcontext);
+    return pass(pushlex("stat"), expression, expect(";"), poplex);
+  }
+  function expression(type) {
+    if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
+    if (type == "function") return cont(functiondef);
+    if (type == "keyword c") return cont(expression);
+    if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
+    if (type == "operator") return cont(expression);
+    if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
+    if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
+    return cont();
+  }
+  function maybeoperator(type, value) {
+    if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
+    if (type == "operator") return cont(expression);
+    if (type == ";") return;
+    if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
+    if (type == ".") return cont(property, maybeoperator);
+    if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
+  }
+  function maybelabel(type) {
+    if (type == ":") return cont(poplex, statement);
+    return pass(maybeoperator, expect(";"), poplex);
+  }
+  function property(type) {
+    if (type == "variable") {cx.marked = "property"; return cont();}
+  }
+  function objprop(type) {
+    if (type == "variable") cx.marked = "property";
+    if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
+  }
+  function commasep(what, end) {
+    function proceed(type) {
+      if (type == ",") return cont(what, proceed);
+      if (type == end) return cont();
+      return cont(expect(end));
+    }
+    return function commaSeparated(type) {
+      if (type == end) return cont();
+      else return pass(what, proceed);
+    };
+  }
+  function block(type) {
+    if (type == "}") return cont();
+    return pass(statement, block);
+  }
+  function vardef1(type, value) {
+    if (type == "variable"){register(value); return cont(vardef2);}
+    return cont();
+  }
+  function vardef2(type, value) {
+    if (value == "=") return cont(expression, vardef2);
+    if (type == ",") return cont(vardef1);
+  }
+  function forspec1(type) {
+    if (type == "var") return cont(vardef1, forspec2);
+    if (type == ";") return pass(forspec2);
+    if (type == "variable") return cont(formaybein);
+    return pass(forspec2);
+  }
+  function formaybein(type, value) {
+    if (value == "in") return cont(expression);
+    return cont(maybeoperator, forspec2);
+  }
+  function forspec2(type, value) {
+    if (type == ";") return cont(forspec3);
+    if (value == "in") return cont(expression);
+    return cont(expression, expect(";"), forspec3);
+  }
+  function forspec3(type) {
+    if (type != ")") cont(expression);
+  }
+  function functiondef(type, value) {
+    if (type == "variable") {register(value); return cont(functiondef);}
+    if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
+  }
+  function funarg(type, value) {
+    if (type == "variable") {register(value); return cont();}
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: jsTokenBase,
+        reAllowed: true,
+        cc: [],
+        lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
+        localVars: null,
+        context: null,
+        indented: 0
+      };
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (!state.lexical.hasOwnProperty("align"))
+          state.lexical.align = false;
+        state.indented = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      if (type == "comment") return style;
+      state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
+      return parseJS(state, style, type, content, stream);
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != jsTokenBase) return 0;
+      var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
+          type = lexical.type, closing = firstChar == type;
+      if (type == "vardef") return lexical.indented + 4;
+      else if (type == "form" && firstChar == "{") return lexical.indented;
+      else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
+      else if (lexical.info == "switch" && !closing)
+        return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
+      else if (lexical.align) return lexical.column + (closing ? 0 : 1);
+      else return lexical.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: ":{}"
+  };
+});
+
+CodeMirror.defineMIME("text/javascript", "javascript");
+CodeMirror.defineMIME("application/json", {name: "javascript", json: true});

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/index.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/index.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/index.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/index.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+  <head>
+    <title>CodeMirror 2: XML mode</title>
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="xml.js"></script>
+    <link rel="stylesheet" href="../../theme/default.css">
+    <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+    <link rel="stylesheet" href="../../css/docs.css">
+  </head>
+  <body>
+    <h1>CodeMirror 2: XML mode</h1>
+    <form><textarea id="code" name="code">
+&lt;html style="color: green"&gt;
+  &lt;!-- this is a comment --&gt;
+  &lt;head&gt;
+    &lt;title&gt;HTML Example&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
+    I mean&amp;quot;&lt;/em&gt;... but might not match your style.
+  &lt;/body&gt;
+&lt;/html&gt;
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: {name: "xml", htmlMode: true}});
+    </script>
+    <p>The XML mode supports two configuration parameters:</p>
+    <dl>
+      <dt><code>htmlMode (boolean)</code></dt>
+      <dd>This switches the mode to parse HTML instead of XML. This
+      means attributes do not have to be quoted, and some elements
+      (such as <code>br</code>) do not require a closing tag.</dd>
+      <dt><code>alignCDATA (boolean)</code></dt>
+      <dd>Setting this to true will force the opening tag of CDATA
+      blocks to not be indented.</dd>
+    </dl>
+
+    <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
+  </body>
+</html>

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/xml.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/xml.js?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/xml.js (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/mode/xml/xml.js Mon Oct 10 00:57:19 2011
@@ -0,0 +1,231 @@
+CodeMirror.defineMode("xml", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+  var Kludges = parserConfig.htmlMode ? {
+    autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
+                      "meta": true, "col": true, "frame": true, "base": true, "area": true},
+    doNotIndent: {"pre": true, "!cdata": true},
+    allowUnquoted: true
+  } : {autoSelfClosers: {}, doNotIndent: {"!cdata": true}, allowUnquoted: false};
+  var alignCDATA = parserConfig.alignCDATA;
+
+  // Return variables for tokenizers
+  var tagName, type;
+
+  function inText(stream, state) {
+    function chain(parser) {
+      state.tokenize = parser;
+      return parser(stream, state);
+    }
+
+    var ch = stream.next();
+    if (ch == "<") {
+      if (stream.eat("!")) {
+        if (stream.eat("[")) {
+          if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
+          else return null;
+        }
+        else if (stream.match("--")) return chain(inBlock("comment", "-->"));
+        else if (stream.match("DOCTYPE", true, true)) {
+          stream.eatWhile(/[\w\._\-]/);
+          return chain(inBlock("meta", ">"));
+        }
+        else return null;
+      }
+      else if (stream.eat("?")) {
+        stream.eatWhile(/[\w\._\-]/);
+        state.tokenize = inBlock("meta", "?>");
+        return "meta";
+      }
+      else {
+        type = stream.eat("/") ? "closeTag" : "openTag";
+        stream.eatSpace();
+        tagName = "";
+        var c;
+        while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
+        state.tokenize = inTag;
+        return "tag";
+      }
+    }
+    else if (ch == "&") {
+      stream.eatWhile(/[^;]/);
+      stream.eat(";");
+      return "atom";
+    }
+    else {
+      stream.eatWhile(/[^&<]/);
+      return null;
+    }
+  }
+
+  function inTag(stream, state) {
+    var ch = stream.next();
+    if (ch == ">" || (ch == "/" && stream.eat(">"))) {
+      state.tokenize = inText;
+      type = ch == ">" ? "endTag" : "selfcloseTag";
+      return "tag";
+    }
+    else if (ch == "=") {
+      type = "equals";
+      return null;
+    }
+    else if (/[\'\"]/.test(ch)) {
+      state.tokenize = inAttribute(ch);
+      return state.tokenize(stream, state);
+    }
+    else {
+      stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
+      return "word";
+    }
+  }
+
+  function inAttribute(quote) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.next() == quote) {
+          state.tokenize = inTag;
+          break;
+        }
+      }
+      return "string";
+    };
+  }
+
+  function inBlock(style, terminator) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.match(terminator)) {
+          state.tokenize = inText;
+          break;
+        }
+        stream.next();
+      }
+      return style;
+    };
+  }
+
+  var curState, setStyle;
+  function pass() {
+    for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
+  }
+  function cont() {
+    pass.apply(null, arguments);
+    return true;
+  }
+
+  function pushContext(tagName, startOfLine) {
+    var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
+    curState.context = {
+      prev: curState.context,
+      tagName: tagName,
+      indent: curState.indented,
+      startOfLine: startOfLine,
+      noIndent: noIndent
+    };
+  }
+  function popContext() {
+    if (curState.context) curState.context = curState.context.prev;
+  }
+
+  function element(type) {
+    if (type == "openTag") {curState.tagName = tagName; return cont(attributes, endtag(curState.startOfLine));}
+    else if (type == "closeTag") {
+      var err = false;
+      if (curState.context) {
+        err = curState.context.tagName != tagName;
+      } else {
+        err = true;
+      }
+      if (err) setStyle = "error";
+      return cont(endclosetag(err));
+    }
+    else if (type == "string") {
+      if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
+      if (curState.tokenize == inText) popContext();
+      return cont();
+    }
+    else return cont();
+  }
+  function endtag(startOfLine) {
+    return function(type) {
+      if (type == "selfcloseTag" ||
+          (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
+        return cont();
+      if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
+      return cont();
+    };
+  }
+  function endclosetag(err) {
+    return function(type) {
+      if (err) setStyle = "error";
+      if (type == "endTag") { popContext(); return cont(); }
+      setStyle = "error";
+      return cont(arguments.callee);
+    }
+  }
+
+  function attributes(type) {
+    if (type == "word") {setStyle = "attribute"; return cont(attributes);}
+    if (type == "equals") return cont(attvalue, attributes);
+    return pass();
+  }
+  function attvalue(type) {
+    if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
+    if (type == "string") return cont(attvaluemaybe);
+    return pass();
+  }
+  function attvaluemaybe(type) {
+    if (type == "string") return cont(attvaluemaybe);
+    else return pass();
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        state.startOfLine = true;
+        state.indented = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+
+      setStyle = type = tagName = null;
+      var style = state.tokenize(stream, state);
+      if ((style || type) && style != "comment") {
+        curState = state;
+        while (true) {
+          var comb = state.cc.pop() || element;
+          if (comb(type || style)) break;
+        }
+      }
+      state.startOfLine = false;
+      return setStyle || style;
+    },
+
+    indent: function(state, textAfter) {
+      var context = state.context;
+      if (context && context.noIndent) return 0;
+      if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
+      if (context && /^<\//.test(textAfter))
+        context = context.prev;
+      while (context && !context.startOfLine)
+        context = context.prev;
+      if (context) return context.indent + indentUnit;
+      else return 0;
+    },
+
+    compareStates: function(a, b) {
+      if (a.indented != b.indented) return false;
+      for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
+        if (!ca || !cb) return ca == cb;
+        if (ca.tagName != cb.tagName) return false;
+      }
+    },
+
+    electricChars: "/"
+  };
+});
+
+CodeMirror.defineMIME("application/xml", "xml");
+CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/overlay.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/overlay.js?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/overlay.js (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/overlay.js Mon Oct 10 00:57:19 2011
@@ -0,0 +1,51 @@
+// Utility function that allows modes to be combined. The mode given
+// as the base argument takes care of most of the normal mode
+// functionality, but a second (typically simple) mode is used, which
+// can override the style of text. Both modes get to parse all of the
+// text, but when both assign a non-null style to a piece of code, the
+// overlay wins, unless the combine argument was true, in which case
+// the styles are combined.
+
+CodeMirror.overlayParser = function(base, overlay, combine) {
+  return {
+    startState: function() {
+      return {
+        base: CodeMirror.startState(base),
+        overlay: CodeMirror.startState(overlay),
+        basePos: 0, baseCur: null,
+        overlayPos: 0, overlayCur: null
+      };
+    },
+    copyState: function(state) {
+      return {
+        base: CodeMirror.copyState(base, state.base),
+        overlay: CodeMirror.copyState(overlay, state.overlay),
+        basePos: state.basePos, baseCur: null,
+        overlayPos: state.overlayPos, overlayCur: null
+      };
+    },
+
+    token: function(stream, state) {
+      if (stream.start == state.basePos) {
+        state.baseCur = base.token(stream, state.base);
+        state.basePos = stream.pos;
+      }
+      if (stream.start == state.overlayPos) {
+        stream.pos = stream.start;
+        state.overlayCur = overlay.token(stream, state.overlay);
+        state.overlayPos = stream.pos;
+      }
+      stream.pos = Math.min(state.basePos, state.overlayPos);
+      if (stream.eol()) state.basePos = state.overlayPos = 0;
+
+      if (state.overlayCur == null) return state.baseCur;
+      if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
+      else return state.overlayCur;
+    },
+    
+    indent: function(state, textAfter) {
+      return base.indent(state.base, textAfter);
+    },
+    electricChars: base.electricChars
+  };
+};

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/runmode.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/runmode.js?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/runmode.js (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/runmode.js Mon Oct 10 00:57:19 2011
@@ -0,0 +1,27 @@
+CodeMirror.runMode = function(string, modespec, callback) {
+  var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
+  var isNode = callback.nodeType == 1;
+  if (isNode) {
+    var node = callback, accum = [];
+    callback = function(string, style) {
+      if (string == "\n")
+        accum.push("<br>");
+      else if (style)
+        accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + CodeMirror.htmlEscape(string) + "</span>");
+      else
+        accum.push(CodeMirror.htmlEscape(string));
+    }
+  }
+  var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
+  for (var i = 0, e = lines.length; i < e; ++i) {
+    if (i) callback("\n");
+    var stream = new CodeMirror.StringStream(lines[i]);
+    while (!stream.eol()) {
+      var style = mode.token(stream, state);
+      callback(stream.current(), style);
+      stream.start = stream.pos;
+    }
+  }
+  if (isNode)
+    node.innerHTML = accum.join("");
+};

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/cobalt.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/cobalt.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/cobalt.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/cobalt.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,17 @@
+.cm-s-cobalt { background: #002240; color: white; }
+.cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; }
+.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
+.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
+.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
+
+.cm-s-cobalt span.cm-comment { color: #08f; }
+.cm-s-cobalt span.cm-atom { color: #845dc4; }
+.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
+.cm-s-cobalt span.cm-keyword { color: #ffee80; }
+.cm-s-cobalt span.cm-string { color: #3ad900; }
+.cm-s-cobalt span.cm-meta { color: #ff9d00; }
+.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
+.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
+.cm-s-cobalt span.cm-error { color: #9d1e15; }
+.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
+.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/default.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/default.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/default.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/default.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,19 @@
+.cm-s-default span.cm-keyword {color: #708;}
+.cm-s-default span.cm-atom {color: #219;}
+.cm-s-default span.cm-number {color: #164;}
+.cm-s-default span.cm-def {color: #00f;}
+.cm-s-default span.cm-variable {color: black;}
+.cm-s-default span.cm-variable-2 {color: #05a;}
+.cm-s-default span.cm-variable-3 {color: #0a5;}
+.cm-s-default span.cm-property {color: black;}
+.cm-s-default span.cm-operator {color: black;}
+.cm-s-default span.cm-comment {color: #a50;}
+.cm-s-default span.cm-string {color: #a11;}
+.cm-s-default span.cm-string-2 {color: #f50;}
+.cm-s-default span.cm-meta {color: #555;}
+.cm-s-default span.cm-error {color: #f00;}
+.cm-s-default span.cm-qualifier {color: #555;}
+.cm-s-default span.cm-builtin {color: #30a;}
+.cm-s-default span.cm-bracket {color: #cc7;}
+.cm-s-default span.cm-tag {color: #170;}
+.cm-s-default span.cm-attribute {color: #00c;}

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/eclipse.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/eclipse.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/eclipse.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/eclipse.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,24 @@
+.cm-s-eclipse span.cm-meta {color: #FF1717;}
+.cm-s-eclipse span.cm-keyword { font-weight: bold; color: #7F0055; }
+.cm-s-eclipse span.cm-atom {color: #219;}
+.cm-s-eclipse span.cm-number {color: #164;}
+.cm-s-eclipse span.cm-def {color: #00f;}
+.cm-s-eclipse span.cm-variable {color: black;}
+.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
+.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
+.cm-s-eclipse span.cm-property {color: black;}
+.cm-s-eclipse span.cm-operator {color: black;}
+.cm-s-eclipse span.cm-comment {color: #3F7F5F;}
+.cm-s-eclipse span.cm-string {color: #2A00FF;}
+.cm-s-eclipse span.cm-string-2 {color: #f50;}
+.cm-s-eclipse span.cm-error {color: #f00;}
+.cm-s-eclipse span.cm-qualifier {color: #555;}
+.cm-s-eclipse span.cm-builtin {color: #30a;}
+.cm-s-eclipse span.cm-bracket {color: #cc7;}
+.cm-s-eclipse span.cm-tag {color: #170;}
+.cm-s-eclipse span.cm-attribute {color: #00c;}
+
+.CodeMirror-matchingbracket{
+	border:1px solid grey;
+	color:black !important;;
+}
\ No newline at end of file

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/elegant.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/elegant.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/elegant.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/elegant.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,9 @@
+.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
+.cm-s-elegant span.cm-comment {color: #262;font-style: italic;}
+.cm-s-elegant span.cm-meta {color: #555;font-style: italic;}
+.cm-s-elegant span.cm-variable {color: black;}
+.cm-s-elegant span.cm-variable-2 {color: #b11;}
+.cm-s-elegant span.cm-qualifier {color: #555;}
+.cm-s-elegant span.cm-keyword {color: #730;}
+.cm-s-elegant span.cm-builtin {color: #30a;}
+.cm-s-elegant span.cm-error {background-color: #fdd;}

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/neat.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/neat.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/neat.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/neat.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,8 @@
+.cm-s-neat span.cm-comment { color: #a86; }
+.cm-s-neat span.cm-keyword { font-weight: bold; color: blue; }
+.cm-s-neat span.cm-string { color: #a22; }
+.cm-s-neat span.cm-builtin { font-weight: bold; color: #077; }
+.cm-s-neat span.cm-special { font-weight: bold; color: #0aa; }
+.cm-s-neat span.cm-variable { color: black; }
+.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
+.cm-s-neat span.cm-meta {color: #555;}

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/night.css
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/night.css?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/night.css (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/lib/theme/night.css Mon Oct 10 00:57:19 2011
@@ -0,0 +1,20 @@
+/* Loosely based on the Midnight Textmate theme */
+
+.cm-s-night { background: #0a001f; color: #f8f8f8; }
+.cm-s-night span.CodeMirror-selected { background: #a8f !important; }
+.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
+.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
+.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
+
+.cm-s-night span.cm-comment { color: #6900a1; }
+.cm-s-night span.cm-atom { color: #845dc4; }
+.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
+.cm-s-night span.cm-keyword { color: #599eff; }
+.cm-s-night span.cm-string { color: #37f14a; }
+.cm-s-night span.cm-meta { color: #7678e2; }
+.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
+.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
+.cm-s-night span.cm-error { color: #9d1e15; }
+.cm-s-night span.cm-bracket { color: #8da6ce; }
+.cm-s-night span.cm-comment { color: #6900a1; }
+.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-blueprint.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-blueprint.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-blueprint.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-blueprint.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+  <body>
+    <section>
+      <h3>Managed Blue Prints</h3>
+
+      <table id="blueprint-list" class="display">
+        <thead>
+          <th>URL</th>
+        </thead>
+        <tbody>
+        </tbody>
+      </table>
+    </section>
+
+    <script type="text/javascript">
+      function renderBlueprint(list) {
+        var buffer = [];
+        var i=0;
+        buffer[i++]='<a href="/?func=manage-blueprint&list='+list['@url']+'">'+list['@url']+'</a>';
+        return buffer;
+      }
+
+      $(document).ready(function() {
+        $('#blueprint-list').dataTable({"bJQueryUI": true, "sPaginationType": "full_numbers"});
+        jQuery.getJSON('/v1/config/blueprint',
+          function(data) {
+            if(data["configManifest"].constructor.toString().indexOf("Array")==-1) {
+                $('#blueprint-list').dataTable().fnAddData(renderBlueprint(data["configManifest"]));
+            } else {
+              for(var list in data["configManifest"]) {
+                $('#blueprint-list').dataTable().fnAddData(renderBlueprint(data["configManifest"][list]));
+              }
+            }
+          }
+        );
+      });
+    </script>
+  </body>
+</html>

Modified: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-nodes.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-nodes.html?rev=1180754&r1=1180753&r2=1180754&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-nodes.html (original)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-nodes.html Mon Oct 10 00:57:19 2011
@@ -39,8 +39,12 @@
         $('#node-list').dataTable({"bJQueryUI": true, "sPaginationType": "full_numbers"});
         jQuery.getJSON('/v1/nodes/manifest',
           function(data) {
-            for(var list in data["nodesManifest"]) {
-              $('#node-list').dataTable().fnAddData(renderManifest(data["nodesManifest"][list]));
+            if(data["nodesManifest"].constructor.toString().indexOf("Array")==-1) {
+              $('#node-list').dataTable().fnAddData(renderManifest(data["nodesManifest"]));
+            } else {
+              for(var list in data["nodesManifest"]) {
+                $('#node-list').dataTable().fnAddData(renderManifest(data["nodesManifest"][list]));
+              }
             }
           }
         );

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-software.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-software.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-software.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/list-software.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML>
+<html>
+  <body>
+    <section>
+      <h3>Managed Software Stacks</h3>
+
+      <table id="software-list" class="display">
+        <thead>
+          <th>Name</th><th>Version</th>
+        </thead>
+        <tbody>
+        </tbody>
+      </table>
+    </section>
+
+    <script type="text/javascript">
+      function renderStack(list) {
+        var buffer = [];
+        var i=0;
+        var x=0;
+        buffer[i++]='<a href="/?func=manage-software&list='+list['@url']+'">'+list['@name']+'</a>';
+        buffer[i++]='<a href="/?func=manage-software&stack='+list['@url']+'">'+list['@version']+'</a>';
+        return buffer;
+      }
+
+      $(document).ready(function() {
+        $('#software-list').dataTable({"bJQueryUI": true, "sPaginationType": "full_numbers"});
+        jQuery.getJSON('/v1/software/stack',
+          function(data) {
+            if(data["softwareManifest"].constructor.toString().indexOf("Array")==-1) {
+              $('#software-list').dataTable().fnAddData(renderStack(data["softwareManifest"]));
+            } else {
+              for(var list in data["softwareManifest"]) {
+                $('#software-list').dataTable().fnAddData(renderStack(data["softwareManifest"][list]));
+              }
+            }
+          }
+        );
+      });
+    </script>
+  </body>
+</html>

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-blueprint.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-blueprint.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-blueprint.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-blueprint.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,201 @@
+<!DOCTYPE HTML>
+<html>
+  <script src="lib/codemirror.js"></script>
+  <link rel="stylesheet" href="lib/codemirror.css">
+  <script src="lib/mode/xml/xml.js"></script>
+  <link rel="stylesheet" href="lib/theme/night.css">
+  <style type="text/css">
+    .CodeMirror {
+      border: 1px solid #AAAAAA;
+      border-radius: 5px 5px 5px 5px;
+      height: 900px;
+    }
+    .CodeMirror-scroll {
+      height: 900px;
+    }
+  </style>
+  <body style="height:100%">
+    <section>
+      <h3>Manage Blue Print</h3>
+      <form class="form">
+        <p>
+          Blue print name<br>
+          <span id="name_display"></span><input type="hidden" id="name">
+          <span id="name_message" class="warn"></span>
+        </p>
+        <p>
+          Configuration steps<br>
+          <textarea id="blueprint"/>
+        </p>
+        <p>
+          <button type="submit" id="save" onclick="return verifySyntax()" value="save">Save</button>
+          <button type="submit" id="Delete" value="Delete" onclick="return confirmDelete()">Delete</button>
+          <button type="cancel" onclick="javasccript:window.location='/';">Cancel</button>
+        </p>
+      </form>
+    </section>
+    <script type="text/javascript">
+      var myCodeMirror;
+
+      function confirmDelete() {
+        var question = "Delete blueprint "+$.getUrlVar('list')+"?";
+        if(confirm(question)) {
+          deleteBlueprint($.getUrlVar('list'));
+          return false;
+        } else {
+          return false;
+        }
+      }
+
+
+      function deleteBlueprint(url) {
+        $.ajax({
+          type: 'DELETE',
+          url: url,
+          success: function(data) {
+            window.location.href = '/?func=list-blueprint';
+          },
+          error: function(xhr, textStatus, errorThrown) {
+            alert(textStatus);
+          }
+        });
+      }
+
+      function verifySyntax() {
+        var name = $('#name').val();
+        var blueprint = $('#blueprint').val();
+        var bailout = false;
+        if(name=="") {
+          $('#name_message').text("Name can not be empty.");
+          bailout = true;
+        }
+        if(blueprint=="") {
+          $('#blueprint_message').text("Blueprint can not be empty.");
+          bailout = true;
+        }
+        if(bailout) {
+          return false;
+        }
+        return saveBlueprint();
+      }
+
+      function formatXML(xml) {
+        var formatted = '';
+        var reg = /(>)(<)(\/*)/g;
+        xml = xml.replace(reg, '$1\r\n$2$3');
+        var pad = 0;
+        jQuery.each(xml.split('\r\n'), function(index, node) {
+          var indent = 0;
+          if (node.match( /.+<\/\w[^>]*>$/ )) {
+            indent = 0;
+          } else if (node.match( /^<\/\w/ )) {
+            if (pad != 0) {
+              pad -= 1;
+            }
+          } else if (node.match( /^<\w[^>]*[^\/]>.*$/ )) {
+            indent = 1;
+          } else {
+            indent = 0;
+          }
+
+          var padding = '';
+          for (var i = 0; i < pad; i++) {
+            padding += '  ';
+          }
+
+          formatted += padding + node + '\r\n';
+          pad += indent;
+        });
+        return formatted;
+      }
+
+      function formatJSON(val) {
+        var retval = '';
+        var str = val;
+        var pos = 0;
+        var strLen = str.length;
+        var indentStr = '    ';
+        var newLine = '\n';
+        var char = '';
+        var isString = false;
+        for (var i=0; i<strLen; i++) {
+          char = str.substring(i,i+1);
+          if (char == '"') {
+            isString = !isString;
+          }
+          if(!isString) {
+            if (char == '}' || char == ']') {
+              retval = retval + newLine;
+              pos = pos - 1;
+              for (var j=0; j<pos; j++) {
+                retval = retval + indentStr;
+              }
+            }
+          }
+          retval = retval + char;	
+          if(!isString) {
+            if (char == '{' || char == '[' || char == ',') {
+              retval = retval + newLine;
+              if (char == '{' || char == '[') {
+                pos = pos + 1;
+              }
+              for (var k=0; k<pos; k++) {
+                retval = retval + indentStr;
+              }
+            }
+          }
+        }
+	return retval;
+      }
+
+      function saveBlueprint() {
+        var prefix = window.location.protocol+'//'+window.location.hostname+':'+window.location.port;
+        var data = myCodeMirror.getValue();
+        var name = $('#name').val();
+        /*var blueprint = jQuery.parseJSON(data);
+        blueprint['url'] = prefix+'/v1/config/blueprint/'+name;
+        data = JSON.stringify(blueprint);*/
+        $.ajax({
+          type: 'PUT',
+          url: '/v1/config/blueprint/'+name,
+          contentType: "application/xml; charset=utf-8",
+          data: data,
+          success: function(data) {
+            var url = '/?func=list-blueprint';
+            window.location.href = url;
+          },
+          dataType:'json'
+        });
+        return false;
+      }
+
+      function basename(path) {
+        return path.replace(/\\/g,'/').replace( /.*\//, '' );
+      }
+
+      $(document).ready(function() {
+        var url = $.getUrlVar("list");
+        var name = basename(url);
+        $('#name_display').text(name);
+        $('#name').val(name);
+        /*$.getJSON(url,
+          function(data) {
+            $('#blueprint').val(formatJSON(JSON.stringify(data)));
+          }
+        );*/
+        $.ajax({
+          type: 'GET',
+          url: url,
+          success: function(data) {
+            $('#blueprint').text(formatXML(data));
+            myCodeMirror = CodeMirror.fromTextArea(document.getElementById("blueprint"), {
+              lineNumbers: false,
+              theme: "night"
+            });
+          },
+          dataType:'text'
+        });
+      });
+    </script>
+  </body>
+</html>

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-software.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-software.html?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-software.html (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/manage-software.html Mon Oct 10 00:57:19 2011
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+  <h2>Software Stack</h2>
+  <form class="form">
+    <p>URL <span id="url"></span></p>
+    <p>Name <span id="name"></span></p>
+    <p>Version <span id="version"></span></p>
+    <p id="roles"> Packages
+    </p>
+    <input type="button" name="Delete" value="Delete" onclick="return confirmDelete()"/>
+    <input type="button" name="cancel" value="Cancel" onclick="javascript:window.location='/';"/>
+  </form>
+  <script type="text/javascript">
+    function confirmDelete() {
+      var question = "Delete software stack "+$.getUrlVar('list')+"?";
+      if(confirm(question)) {
+        deleteStack($.getUrlVar('list'));
+        return false;
+      } else {
+        return false;
+      }
+    }
+
+
+    function deleteStack(url) {
+      $.ajax({
+        type: 'DELETE',
+        url: url,
+        success: function(data) {
+          window.location.href = '/?func=list-software';
+        },
+        error: function(xhr, textStatus, errorThrown) {
+          alert(textStatus);
+        }
+      });
+    }
+
+    $(document).ready(function() {
+      var url = $.getUrlVar("list");
+      $.getJSON(url, 
+        function(data) {
+          $('#url').text(data['@url']);
+          $('#name').text(data['@name']);
+          $('#version').text(data['@version']);
+          for(index in data['roles']) {
+            var role_item = document.createElement("ol");
+            role_item.innerHTML="Role "+data['roles'][index]['@name'];
+            var packages = [];
+            var i=0;
+            var list = document.createElement("ul");
+            for(packageIndex in data['roles'][index]['package']) {
+              var package = data['roles'][index]['package'][packageIndex];
+              var item = document.createElement("li");
+              item.innerHTML=package['name'];
+              list.appendChild(item);
+            }
+            role_item.appendChild(list);
+            $('#roles').append(role_item);
+          }
+        }
+      );
+    });
+  </script>
+</body>
+</html>

Modified: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/nav.html
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/nav.html?rev=1180754&r1=1180753&r2=1180754&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/nav.html (original)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/nav.html Mon Oct 10 00:57:19 2011
@@ -20,6 +20,13 @@
       <li><a href="/?func=list-software">Manage software stacks...</a></li>
     </ul>
   </li>
+  <li class="drawer">
+    <h2 class="drawer-handle">Blue Print</h2>
+    <ul>
+      <li><a href="/?func=create-blueprint">Define a blue print...</a></li>
+      <li><a href="/?func=list-blueprint">Manage blue print...</a></li>
+    </ul>
+  </li>
 </ul>
 <script type='text/javascript'>
 /*    $('#drawers').accordion({

Added: incubator/ambari/branches/branch-0.0/controller/src/main/webapps/wadl.xsl
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/controller/src/main/webapps/wadl.xsl?rev=1180754&view=auto
==============================================================================
--- incubator/ambari/branches/branch-0.0/controller/src/main/webapps/wadl.xsl (added)
+++ incubator/ambari/branches/branch-0.0/controller/src/main/webapps/wadl.xsl Mon Oct 10 00:57:19 2011
@@ -0,0 +1,633 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+    wadl.xsl (06-May-2011)
+    
+    Transforms Web Application Description Language (WADL) XML documents into HTML.
+
+    Mark Sawers <mark.sawers@ipc.com>
+    
+    Limitations:
+        * Ignores globally defined methods, referred to from a resource using a method reference element.
+          Methods must be embedded in a resource element.
+        * Ditto for globally defined representations. Representations must be embedded within request
+          and response elements.
+        * Ignores type and queryType attributes of resource element.
+        * Ignores resource_type element.
+        * Ignores profile attribute of representation element.
+        * Ignores path attribute and child link elements of param element.
+
+    Copyright (c) 2011 IPC Systems, Inc.
+
+    Parts of this work are adapted from Mark Notingham's wadl_documentation.xsl, at
+        https://github.com/mnot/wadl_stylesheets.
+    
+    This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License.
+    To view a copy of this license, visit 
+        http://creativecommons.org/licenses/by-sa/3.0/
+    or send a letter to 
+        Creative Commons
+        543 Howard Street, 5th Floor
+        San Francisco, California, 94105, USA
+ -->
+<xsl:stylesheet 
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+ xmlns:wadl="http://research.sun.com/wadl/2006/10"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+>
+
+<!-- Global variables -->
+<xsl:variable name="g_resourcesBase" select="wadl:application/wadl:resources/@base"/>
+
+<!-- Template for top-level doc element -->
+<xsl:template match="wadl:application">
+    <html>
+    <head>
+        <xsl:call-template name="getStyle"/>
+        <title><xsl:call-template name="getTitle"/></title>
+    </head>
+    <body>
+    <h1><xsl:call-template name="getTitle"/></h1>
+    <xsl:call-template name="getDoc">
+        <xsl:with-param name="base" select="$g_resourcesBase"/>
+    </xsl:call-template>
+    
+    <!-- Summary -->
+    <h2>Summary</h2>
+    <table>
+        <tr>
+            <th>Resource</th>
+            <th>Method</th>
+            <th>Description</th>
+        </tr>
+        <xsl:for-each select="wadl:resources/wadl:resource">
+            <xsl:call-template name="processResourceSummary">
+                <xsl:with-param name="resourceBase" select="$g_resourcesBase"/>
+                <xsl:with-param name="resourcePath" select="@path"/>
+                <xsl:with-param name="lastResource" select="position() = last()"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </table>
+    <p></p>
+    
+    <!-- Grammars -->
+    <xsl:if test="wadl:grammars/wadl:include">
+        <h2>Grammars</h2>
+        <p>
+            <xsl:for-each select="wadl:grammars/wadl:include">
+                <xsl:variable name="href" select="@href"/>
+                <a href="{$href}"><xsl:value-of select="$href"/></a>
+                <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+            </xsl:for-each>
+        </p>
+    </xsl:if>
+
+    <!-- Detail -->
+    <h2>Resources</h2>
+    <xsl:for-each select="wadl:resources">
+        <xsl:call-template name="getDoc">
+            <xsl:with-param name="base" select="$g_resourcesBase"/>
+        </xsl:call-template>
+        <br/>
+    </xsl:for-each>
+    
+    <xsl:for-each select="wadl:resources/wadl:resource">
+        <xsl:call-template name="processResourceDetail">
+            <xsl:with-param name="resourceBase" select="$g_resourcesBase"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+        </xsl:call-template>
+    </xsl:for-each>
+
+    </body>
+    </html>
+</xsl:template>
+
+<!-- Supporting templates (functions) -->
+
+<xsl:template name="processResourceSummary">
+    <xsl:param name="resourceBase"/>
+    <xsl:param name="resourcePath"/>
+    <xsl:param name="lastResource"/>
+
+    <xsl:if test="wadl:method">
+        <tr>
+            <!-- Resource -->
+            <td class="summary">
+                <xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
+                <a href="#{$id}">
+                    <xsl:call-template name="getFullResourcePath">
+                        <xsl:with-param name="base" select="$resourceBase"/>                
+                        <xsl:with-param name="path" select="$resourcePath"/>                
+                    </xsl:call-template>
+                </a>
+            </td>
+            <!-- Method -->
+            <td class="summary">
+                <xsl:for-each select="wadl:method">
+                    <xsl:variable name="name" select="@name"/>
+                    <xsl:variable name="id2"><xsl:call-template name="getId"/></xsl:variable>
+                    <a href="#{$id2}"><xsl:value-of select="$name"/></a>
+                    <xsl:for-each select="wadl:doc"><br/></xsl:for-each>
+                    <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+                </xsl:for-each>
+                <br/>
+            </td>
+            <!-- Description -->
+            <td class="summary">
+                <xsl:for-each select="wadl:method">
+                    <xsl:call-template name="getDoc">
+                        <xsl:with-param name="base" select="$resourceBase"/>
+                    </xsl:call-template>
+                    <br/>
+                    <xsl:if test="position() != last()"><br/></xsl:if>  <!-- Add a spacer -->
+                </xsl:for-each>
+            </td>
+        </tr>
+        <!-- Add separator if not the last resource -->
+        <xsl:if test="wadl:method and not($lastResource)">
+            <tr><td class="summarySeparator"></td><td class="summarySeparator"/><td class="summarySeparator"/></tr>
+        </xsl:if>
+    </xsl:if>   <!-- wadl:method -->
+
+    <!-- Call recursively for child resources -->
+    <xsl:for-each select="wadl:resource">
+        <xsl:variable name="base">
+            <xsl:call-template name="getFullResourcePath">
+                <xsl:with-param name="base" select="$resourceBase"/>                
+                <xsl:with-param name="path" select="$resourcePath"/>           
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="processResourceSummary">
+            <xsl:with-param name="resourceBase" select="$base"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+            <xsl:with-param name="lastResource" select="$lastResource and position() = last()"/>
+        </xsl:call-template>
+    </xsl:for-each>
+
+</xsl:template>
+
+<xsl:template name="processResourceDetail">
+    <xsl:param name="resourceBase"/>
+    <xsl:param name="resourcePath"/>
+
+    <xsl:if test="wadl:method">
+        <h3>
+            <xsl:variable name="id"><xsl:call-template name="getId"/></xsl:variable>
+            <a name="{$id}">
+                <xsl:call-template name="getFullResourcePath">
+                    <xsl:with-param name="base" select="$resourceBase"/>                
+                    <xsl:with-param name="path" select="$resourcePath"/>                
+                </xsl:call-template>
+            </a>
+        </h3>
+        <p>
+            <xsl:call-template name="getDoc">
+                <xsl:with-param name="base" select="$resourceBase"/>
+            </xsl:call-template>
+        </p>
+
+        <h5>Methods</h5>
+
+        <div class="methods">
+            <xsl:for-each select="wadl:method">
+            <div class="method">
+                <table class="methodNameTable">
+                    <tr>
+                        <td class="methodNameTd" style="font-weight: bold">
+                            <xsl:variable name="name" select="@name"/>
+                            <xsl:variable name="id2"><xsl:call-template name="getId"/></xsl:variable>
+                            <a name="{$id2}"><xsl:value-of select="$name"/></a>
+                        </td>
+                        <td class="methodNameTd" style="text-align: right">
+                            <xsl:if test="@id">
+                                <xsl:value-of select="@id"/>() 
+                            </xsl:if>
+                        </td>
+                    </tr>
+                </table>
+                <p>
+                    <xsl:call-template name="getDoc">
+                        <xsl:with-param name="base" select="$resourceBase"/>
+                    </xsl:call-template>
+                </p>
+
+                <!-- Request -->
+                <h6>request</h6>
+                <div style="margin-left: 2em">  <!-- left indent -->
+                <xsl:choose>
+                    <xsl:when test="wadl:request">
+                        <xsl:for-each select="wadl:request">
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'template'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'matrix'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'header'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getParamBlock">
+                                <xsl:with-param name="style" select="'query'"/>
+                            </xsl:call-template>
+                    
+                            <xsl:call-template name="getRepresentations"/>
+                        </xsl:for-each> <!-- wadl:request -->
+                    </xsl:when>
+    
+                    <xsl:when test="not(wadl:request) and (ancestor::wadl:*/wadl:param)">
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'template'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'matrix'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'header'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getParamBlock">
+                            <xsl:with-param name="style" select="'query'"/>
+                        </xsl:call-template>
+                
+                        <xsl:call-template name="getRepresentations"/>
+                    </xsl:when>
+            
+                    <xsl:otherwise>
+                        unspecified
+                    </xsl:otherwise>
+                </xsl:choose>
+                </div>  <!-- left indent for request -->
+                                
+                <!-- Response -->
+                <h6>responses</h6>
+                <div style="margin-left: 2em">  <!-- left indent -->
+                <xsl:choose>
+                    <xsl:when test="wadl:response">
+                        <xsl:for-each select="wadl:response">
+                            <div class="h8">status: </div>
+                            <xsl:choose>
+                                <xsl:when test="@status">
+                                    <xsl:value-of select="@status"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    200 - OK
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            <xsl:for-each select="wadl:doc">
+                                <xsl:if test="@title">
+                                    - <xsl:value-of select="@title"/>
+                                </xsl:if>
+                                <xsl:if test="text()">
+                                    - <xsl:value-of select="text()"/>
+                                </xsl:if>
+                            </xsl:for-each>
+                            
+                            <!-- Get response headers/representations -->
+                            <xsl:if test="wadl:param or wadl:representation">
+                                <div style="margin-left: 2em"> <!-- left indent -->
+                                <xsl:if test="wadl:param">
+                                    <div class="h7">headers</div>
+                                    <table>
+                                        <xsl:for-each select="wadl:param[@style='header']">
+                                            <xsl:call-template name="getParams"/>
+                                        </xsl:for-each>
+                                    </table>
+                                </xsl:if>
+    
+                                <xsl:call-template name="getRepresentations"/>
+                                </div>  <!-- left indent for response headers/representations -->
+                            </xsl:if>
+                        </xsl:for-each> <!-- wadl:response -->
+                    </xsl:when>
+                    <xsl:otherwise>
+                        unspecified
+                    </xsl:otherwise>
+                </xsl:choose>                
+                </div>  <!-- left indent for responses -->
+
+            </div>  <!-- class=method -->
+            </xsl:for-each> <!-- wadl:method  -->
+        </div> <!-- class=methods -->
+
+    </xsl:if>   <!-- wadl:method -->
+
+    <!-- Call recursively for child resources -->
+    <xsl:for-each select="wadl:resource">
+        <xsl:variable name="base">
+            <xsl:call-template name="getFullResourcePath">
+                <xsl:with-param name="base" select="$resourceBase"/>                
+                <xsl:with-param name="path" select="$resourcePath"/>           
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="processResourceDetail">
+            <xsl:with-param name="resourceBase" select="$base"/>
+            <xsl:with-param name="resourcePath" select="@path"/>
+        </xsl:call-template>
+    </xsl:for-each> <!-- wadl:resource -->
+</xsl:template>
+
+<xsl:template name="getFullResourcePath">
+    <xsl:param name="base"/>
+    <xsl:param name="path"/>
+    <xsl:choose>
+        <xsl:when test="substring($base, string-length($base)) = '/'">
+            <xsl:value-of select="$base"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="concat($base, '/')"/>
+        </xsl:otherwise>
+    </xsl:choose>
+    <xsl:choose>
+        <xsl:when test="starts-with($path, '/')">
+            <xsl:value-of select="substring($path, 2)"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$path"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getDoc">
+    <xsl:param name="base"/>
+    <xsl:for-each select="wadl:doc">
+        <xsl:if test="position() > 1"><br/></xsl:if>
+        <xsl:if test="@title and local-name(..) != 'application'">
+            <xsl:value-of select="@title"/>:
+        </xsl:if>
+        <xsl:choose>
+            <xsl:when test="@title = 'Example'">
+                <xsl:variable name="url">
+                    <xsl:choose>
+                        <xsl:when test="string-length($base) > 0">
+                            <xsl:call-template name="getFullResourcePath">
+                                <xsl:with-param name="base" select="$base"/>                
+                                <xsl:with-param name="path" select="text()"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise><xsl:value-of select="text()"/></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <a href="{$url}"><xsl:value-of select="$url"/></a>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="text()"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="getId">
+    <xsl:choose>
+        <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
+        <xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getParamBlock">
+    <xsl:param name="style"/>
+    <xsl:if test="ancestor-or-self::wadl:*/wadl:param[@style=$style]">
+        <div class="h7"><xsl:value-of select="$style"/> params</div>
+        <table>
+            <xsl:for-each select="ancestor-or-self::wadl:*/wadl:param[@style=$style]">
+                <xsl:call-template name="getParams"/>
+            </xsl:for-each>
+        </table>
+        <p/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="getParams">
+    <tr>
+        <td><strong><xsl:value-of select="@name"/></strong></td>
+            <td>
+                <xsl:if test="not(@type)">
+                    unspecified type
+                </xsl:if>
+                <xsl:call-template name="getParamType">
+                    <xsl:with-param name="qname" select="@type"/>
+                </xsl:call-template>
+                <xsl:if test="@required = 'true'"><br/>(required)</xsl:if>
+                <xsl:if test="@repeating = 'true'"><br/>(repeating)</xsl:if>
+                <xsl:if test="@default"><br/>default: <tt><xsl:value-of select="@default"/></tt></xsl:if>
+                <xsl:if test="@fixed"><br/>fixed: <tt><xsl:value-of select="@fixed"/></tt></xsl:if>
+                <xsl:if test="wadl:option">
+                    <br/>options:
+                    <xsl:for-each select="wadl:option">
+                        <xsl:choose>
+                            <xsl:when test="@mediaType">
+                                <br/><tt><xsl:value-of select="@value"/> (<xsl:value-of select="@mediaType"/>)</tt>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <tt><xsl:value-of select="@value"/></tt>
+                                <xsl:if test="position() != last()">, </xsl:if>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </xsl:if>
+            </td>
+        <xsl:if test="wadl:doc">
+            <td><xsl:value-of select="wadl:doc"/></td>
+        </xsl:if>
+    </tr>
+</xsl:template>
+
+<xsl:template name="getParamType">
+    <xsl:param name="qname"/>
+    <xsl:variable name="prefix" select="substring-before($qname,':')"/>
+    <xsl:variable name="ns-uri" select="./namespace::*[name()=$prefix]"/>
+    <xsl:variable name="localname" select="substring-after($qname, ':')"/>
+    <xsl:choose>
+        <xsl:when test="$ns-uri='http://www.w3.org/2001/XMLSchema' or $ns-uri='http://www.w3.org/2001/XMLSchema-instance'">
+            <a href="http://www.w3.org/TR/xmlschema-2/#{$localname}"><xsl:value-of select="$localname"/></a>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$qname"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="getRepresentations">
+    <xsl:if test="wadl:representation">
+        <div class="h7">representations</div>
+        <table>
+            <xsl:for-each select="wadl:representation">
+                <tr>
+                    <td><xsl:value-of select="@mediaType"/></td>
+                    <xsl:if test="wadl:doc">
+                        <td>
+                            <xsl:call-template name="getDoc">
+                                <xsl:with-param name="base" select="''"/>
+                            </xsl:call-template>
+                        </td>
+                    </xsl:if>
+                    <xsl:if test="@href or @element">
+                        <td>
+                            <xsl:variable name="href" select="@href"/>
+                            <xsl:choose>
+                                <xsl:when test="@href">
+                                    <a href="{$href}"><xsl:value-of select="@element"/></a>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:value-of select="@element"/>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </td>
+                    </xsl:if>
+                </tr>
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'template'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'matrix'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'header'"/>
+                </xsl:call-template>
+        
+                <xsl:call-template name="getRepresentationParamBlock">
+                    <xsl:with-param name="style" select="'query'"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </table>
+    </xsl:if> 
+</xsl:template>
+
+<xsl:template name="getRepresentationParamBlock">
+    <xsl:param name="style"/>
+    <xsl:if test="wadl:param[@style=$style]">
+        <tr>
+            <td style="padding: 0em, 0em, 0em, 2em">
+                <div class="h7"><xsl:value-of select="$style"/> params</div>
+                <table>
+                    <xsl:for-each select="wadl:param[@style=$style]">
+                        <xsl:call-template name="getParams"/>
+                    </xsl:for-each>
+                </table>
+                <p/>
+            </td>
+        </tr>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template name="getStyle">
+     <style type="text/css">
+        body {
+            font-family: sans-serif;
+            font-size: 0.85em;
+            margin: 2em 2em;
+        }
+        .methods {
+            margin-left: 2em; 
+            margin-bottom: 2em;
+        }
+        .method {
+            background-color: #eef;
+            border: 1px solid #DDDDE6;
+            padding: .5em;
+            margin-bottom: 1em;
+            width: 50em
+        }
+        .methodNameTable {
+            width: 100%;
+            border: 0px;
+            border-bottom: 2px solid white;
+            font-size: 1.4em;
+        }
+        .methodNameTd {
+            background-color: #eef;
+        }
+        h1 {
+            font-size: 2m;
+            margin-bottom: 0em;
+        }
+        h2 {
+            border-bottom: 1px solid black;
+            margin-top: 1.5em;
+            margin-bottom: 0.5em;
+            font-size: 1.5em;
+           }
+        h3 {
+            color: #FF6633;
+            font-size: 1.35em;
+            margin-top: .5em;
+            margin-bottom: 0em;
+        }
+        h5 {
+            font-size: 1.2em;
+            color: #99a;
+            margin: 0.5em 0em 0.25em 0em;
+        }
+        h6 {
+            color: #700000;
+            font-size: 1em;
+            margin: 1em 0em 0em 0em;
+        }
+        .h7 {
+            margin-top: .75em;
+            font-size: 1em;
+            font-weight: bold;
+            font-style: italic;
+            color: blue;
+        }
+        .h8 {
+            margin-top: .75em;
+            font-size: 1em;
+            font-weight: bold;
+            font-style: italic;
+            color: black;
+        }
+        tt {
+            font-size: 1em;
+        }
+        table {
+            margin-bottom: 0.5em;
+            border: 1px solid #E0E0E0;
+        }
+        th {
+            text-align: left;
+            font-weight: normal;
+            font-size: 1em;
+            color: black;
+            background-color: #DDDDE6;
+            padding: 3px 6px;
+            border: 1px solid #B1B1B8;
+        }
+        td {
+            padding: 3px 6px;
+            vertical-align: top;
+            background-color: #F6F6FF;
+            font-size: 0.85em;
+        }
+        p {
+            margin-top: 0em;
+            margin-bottom: 0em;
+        }
+        td.summary {
+            background-color: white;
+        }
+        td.summarySeparator {
+            padding: 1px;
+        }
+    </style>
+</xsl:template>
+
+<xsl:template name="getTitle">
+    <xsl:choose>
+        <xsl:when test="wadl:doc/@title">
+            <xsl:value-of select="wadl:doc/@title"/>
+        </xsl:when>
+        <xsl:otherwise>
+            Web Application
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Modified: incubator/ambari/branches/branch-0.0/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/branch-0.0/pom.xml?rev=1180754&r1=1180753&r2=1180754&view=diff
==============================================================================
--- incubator/ambari/branches/branch-0.0/pom.xml (original)
+++ incubator/ambari/branches/branch-0.0/pom.xml Mon Oct 10 00:57:19 2011
@@ -153,18 +153,18 @@
         <dependency>
                 <groupId>com.sun.jersey</groupId>
                 <artifactId>jersey-json</artifactId>
-                <version>1.6</version>
+                <version>1.8</version>
         </dependency>
         <dependency>
                 <groupId>com.sun.jersey</groupId>
                 <artifactId>jersey-server</artifactId>
-                <version>1.6</version>
+                <version>1.8</version>
         </dependency>
 
         <dependency>
                 <groupId>com.sun.jersey</groupId>
                 <artifactId>jersey-client</artifactId>
-                <version>1.6</version>
+                <version>1.8</version>
         </dependency>
     </dependencies>
 



Mime
View raw message