chukwa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject chukwa git commit: CHUKWA-805. Added examples to HICC rest api. (Eric Yang)
Date Mon, 25 Apr 2016 00:02:31 GMT
Repository: chukwa
Updated Branches:
  refs/heads/master 84ade8281 -> e0bf3c0ef


CHUKWA-805. Added examples to HICC rest api.  (Eric Yang)


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

Branch: refs/heads/master
Commit: e0bf3c0efd5a60aef21d86578fa74f961045c505
Parents: 84ade82
Author: Eric Yang <eyang@apache.org>
Authored: Sun Apr 24 17:02:22 2016 -0700
Committer: Eric Yang <eyang@apache.org>
Committed: Sun Apr 24 17:02:22 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |   4 +-
 pom.xml                                         |  15 +
 .../chukwa/datastore/ChukwaHBaseStore.java      | 509 ++---------------
 .../apache/hadoop/chukwa/hicc/bean/Chart.java   |  99 ++++
 .../hadoop/chukwa/hicc/bean/Dashboard.java      |   7 +-
 .../chukwa/hicc/rest/ChartController.java       |  34 +-
 .../chukwa/hicc/rest/CirclesController.java     |  29 +-
 .../chukwa/hicc/rest/DashboardController.java   |  45 +-
 .../hadoop/chukwa/hicc/rest/Examples.java       | 540 +++++++++++++++++++
 .../chukwa/hicc/rest/HeatmapController.java     |  29 +
 .../chukwa/hicc/rest/LoginController.java       |  23 +
 .../chukwa/hicc/rest/MetricsController.java     |  32 ++
 .../chukwa/hicc/rest/PieChartController.java    |  25 +
 .../chukwa/hicc/rest/SessionController.java     |  10 +
 .../hadoop/chukwa/hicc/rest/TileController.java |  27 +-
 .../chukwa/hicc/rest/WidgetController.java      |  70 +++
 src/main/webapps/wadl.xsl                       |  58 +-
 17 files changed, 1097 insertions(+), 459 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index dbb8d0e..ec869f8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,8 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
 
+    CHUKWA-805. Added examples to HICC rest api.  (Eric Yang)
+
     CHUKWA-804.  Update user documents to match current code base. (Eric Yang)
 
     CHUKWA-802. Updated Javadoc for Java 8 support.  (Eric Yang)
@@ -26,7 +28,7 @@ Trunk (unreleased changes)
 
     CHUKWA-796. Remove collector from shell script.  (Eric Yang)
 
-Release 0.6 - 09/28/2014
+Release 0.7 - 12/21/2015
 
   NEW FEATURES
 

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c00fe32..fedb59a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1639,6 +1639,21 @@
                     <head>response.representation.400.example</head>
                   </tag>
                   <tag>
+                    <name>response.representation.403.doc</name>
+                    <placement>a</placement>
+                    <head>response.representation.403.doc</head>
+                  </tag>
+                  <tag>
+                    <name>response.representation.403.mediaType</name>
+                    <placement>a</placement>
+                    <head>response.representation.403.mediaType</head>
+                  </tag>
+                  <tag>
+                    <name>response.representation.403.example</name>
+                    <placement>a</placement>
+                    <head>response.representation.403.example</head>
+                  </tag>
+                  <tag>
                     <name>request.representation.example</name>
                     <placement>a</placement>
                     <head>request.representation.example</head>

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java b/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
index 889e980..a3dc189 100644
--- a/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
+++ b/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
@@ -18,7 +18,6 @@
 package org.apache.hadoop.chukwa.datastore;
 
 import java.io.IOException;
-import java.net.InetAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.ByteBuffer;
@@ -43,6 +42,7 @@ import org.apache.hadoop.chukwa.hicc.bean.LineOptions;
 import org.apache.hadoop.chukwa.hicc.bean.Series;
 import org.apache.hadoop.chukwa.hicc.bean.SeriesMetaData;
 import org.apache.hadoop.chukwa.hicc.bean.Widget;
+import org.apache.hadoop.chukwa.hicc.rest.Examples;
 import org.apache.hadoop.chukwa.util.ExceptionUtil;
 import org.apache.hadoop.chukwa.util.HBaseUtil;
 import org.apache.hadoop.hbase.Cell;
@@ -917,480 +917,85 @@ public class ChukwaHBaseStore {
       if(defaultExists) {
         return;
       }
-      String hostname = InetAddress.getLocalHost().getHostName().toLowerCase();
       // Populate example chart widgets
-      String[] metrics = { "SystemMetrics.LoadAverage.1" };
-      createChart("1", "System Load Average", metrics, hostname, "");
-      String[] cpuMetrics = { "SystemMetrics.cpu.combined", "SystemMetrics.cpu.sys", "SystemMetrics.cpu.user" };
-      createChart("2", "CPU Utilization", cpuMetrics, hostname, "percent");
-      String[] memMetrics = { "SystemMetrics.memory.FreePercent", "SystemMetrics.memory.UsedPercent"};
-      createChart("3", "Memory Utilization", memMetrics, hostname, "percent");
-      String[] diskMetrics = { "SystemMetrics.disk.ReadBytes", "SystemMetrics.disk.WriteBytes" };
-      createChart("4", "Disk Utilization", diskMetrics, hostname, "bytes-decimal");
-      String[] netMetrics = { "SystemMetrics.network.TxBytes", "SystemMetrics.network.RxBytes" };
-      createChart("5", "Network Utilization", netMetrics, hostname, "bytes");
-      String[] swapMetrics = { "SystemMetrics.swap.Total", "SystemMetrics.swap.Used", "SystemMetrics.swap.Free" };
-      createChart("6", "Swap Utilization", swapMetrics, hostname, "bytes-decimal");
+      createChart(Examples.SYSTEM_LOAD_AVERAGE);
+      createChart(Examples.CPU_UTILIZATION);
+      createChart(Examples.MEMORY_UTILIZATION);
+      createChart(Examples.DISK_UTILIZATION);
+      createChart(Examples.NETWORK_UTILIZATION);
+      createChart(Examples.SWAP_UTILIZATION);
       
       // Namenode heap usage
-      StringBuilder namenode = new StringBuilder();
-      namenode.append(hostname);
-      namenode.append(":NameNode");
-      String[] namenodeHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" };
-      createCircle("7", "Namenode Memory", namenodeHeap, namenode.toString(), "%", "up");
+      createChart(Examples.NAMENODE_MEMORY);
       
       // HDFS Usage
-      String[] hdfsUsage = { "HadoopMetrics.dfs.FSNamesystem.CapacityRemainingGB", "HadoopMetrics.dfs.FSNamesystem.CapacityTotalGB" };
-      createCircle("8", "HDFS Remaining", hdfsUsage, hostname, "%", "down");
+      createChart(Examples.HDFS_USAGE);
 
       // Resource Manager Memory
-      StringBuilder rmnode = new StringBuilder();
-      rmnode.append(hostname);
-      rmnode.append(":ResourceManager");
-      String[] rmHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" };
-      createCircle("9", "Resource Manager Memory", rmHeap, rmnode.toString(), "%", "up");
+      createChart(Examples.RESOURCE_MANAGER_MEMORY);
 
       // Node Managers Health
-      String[] nmh = { "HadoopMetrics.yarn.ClusterMetrics.NumActiveNMs", "HadoopMetrics.yarn.ClusterMetrics.NumLostNMs" };
-      createTile("10", "Node Managers Health", "Node Managers", "Active/Lost", nmh, hostname, "glyphicon-th");
+      createChart(Examples.NODE_MANAGER_HEALTH);
 
       // High Availability State
-      String[] ha = { "HadoopMetrics.dfs.FSNamesystem.HAState" };
-      createTile("11", "HDFS High Availability State", "HDFS High Availability", "", ha, hostname, "glyphicon-random");
+      createChart(Examples.HDFS_HA);
 
       // HDFS Load
-      String[] hdfsLoad = { "HadoopMetrics.dfs.FSNamesystem.TotalLoad" };
-      createTile("12", "HDFS Load Average", "HDFS Load", "", hdfsLoad, hostname, "glyphicon-signal");
+      createChart(Examples.HDFS_LOAD);
 
       // Namenode RPC Latency
-      String[] nnLatency = { "HadoopMetrics.rpc.rpc.RpcProcessingTimeAvgTime" };
-      createTile("13", "NameNode Latency", "NameNode RPC Latency", "Milliseconds", nnLatency, hostname, "glyphicon-tasks");
+      createChart(Examples.NAMENODE_RPC_LATENCY);
 
       // Datanode Health
-      String[] dnHealth = { "HadoopMetrics.dfs.FSNamesystem.StaleDataNodes" };
-      createTile("14", "Datanodes Health", "Datanodes", "Dead", dnHealth, hostname, "glyphicon-hdd");
+      createChart(Examples.DATANODES);
 
       // HBase Master Memory
-      StringBuilder hbaseMaster = new StringBuilder();
-      hbaseMaster.append(hostname);
-      hbaseMaster.append(":Master");
-      String[] hbm = { "HBaseMetrics.jvm.JvmMetrics.MemHeapUsedM", "HBaseMetrics.jvm.JvmMetrics.MemHeapMaxM" };
-      createCircle("15", "HBase Master Memory", hbm, hbaseMaster.toString(), "%", "up");
+      createChart(Examples.HBASE_MASTER_MEMORY);
 
-      // Demo metrics
-//      String[] trialAbandonRate = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" };
-//      createChart("T1", "Trial Abandon Rate", trialAbandonRate, namenode.toString(), "percent");
-//      createChart("T2", "Unhealthy Clusters", hdfsUsage, hostname, "percent");
-      
       // Populate default widgets
-      Widget widget = new Widget();
-      widget.setTitle("System Load Average");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/1"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-
-      // Populate default dashboard
-      Dashboard dashboard = new Dashboard();
-
-      widget = new Widget();
-      widget.setTitle("Welcome Page");
-      widget.setSrc(new URI("/hicc/welcome.html"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(10);
-      widget.setSize_y(5);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Trial Downloading");
-      widget.setSrc(new URI("/hicc/home/downloads.html"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Cluster Running");
-      widget.setSrc(new URI("/hicc/home/clusters.html"));
-      widget.setCol(3);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Users Working");
-      widget.setSrc(new URI("/hicc/home/users.html"));
-      widget.setCol(5);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Applications Running");
-      widget.setSrc(new URI("/hicc/home/apps.html"));
-      widget.setCol(7);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Trial Abandon Rate");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/11"));
-      widget.setCol(1);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Clusters Health");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/12"));
-      widget.setCol(3);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Top Active Clusters");
-      widget.setSrc(new URI("/hicc/clusters/"));
-      widget.setCol(5);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Top Applications");
-      widget.setSrc(new URI("/hicc/apps/"));
-      widget.setCol(7);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Applications Usage");
-      widget.setSrc(new URI("/hicc/apps/apps-usage.html"));
-      widget.setCol(7);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      updateDashboard("default", "", dashboard);
-
-      // Populate user dashboards
-      dashboard = new Dashboard();
-
-      widget = new Widget();
-      widget.setTitle("Quick Links");
-      widget.setSrc(new URI("/hicc/v1/dashboard/quicklinks"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(10);
-      widget.setSize_y(5);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      // Log Search widget
-      widget = new Widget();
-      widget.setTitle("Log Search");
-      widget.setSrc(new URI("/hicc/ajax-solr/chukwa"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-      // Applications
-      widget = new Widget();
-      widget.setTitle("YARN Applications");
-      widget.setSrc(new URI("http://localhost:8088/"));
-      widget.setCol(1);
-      widget.setRow(7);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-      // Hadoop Distributed File System
-      widget = new Widget();
-      widget.setTitle("HDFS");
-      widget.setSrc(new URI("http://localhost:50070/explorer.html#/"));
-      widget.setCol(1);
-      widget.setRow(7);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-      // HBase Tables
-      widget = new Widget();
-      widget.setTitle("HBase Tables");
-      widget.setSrc(new URI("http://localhost:50654/tablesDetailed.jsp"));
-      widget.setCol(1);
-      widget.setRow(14);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Top Applications");
-      widget.setSrc(new URI("/hicc/apps/"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-
-      widget = new Widget();
-      widget.setTitle("Top Users");
-      widget.setSrc(new URI("/hicc/users/"));
-      widget.setCol(1);
-      widget.setRow(3);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-      updateDashboard("user", "", dashboard);
-
-      // Populate system dashboards
-      dashboard = new Dashboard();
-      widget = new Widget();
-      widget.setTitle("HDFS High Availability State");
-      widget.setSrc(new URI("/hicc/v1/tile/draw/11"));
-      widget.setCol(1);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("HDFS Load");
-      widget.setSrc(new URI("/hicc/v1/tile/draw/12"));
-      widget.setCol(3);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("HDFS Namenode Latency");
-      widget.setSrc(new URI("/hicc/v1/tile/draw/13"));
-      widget.setCol(5);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Datanodes Health");
-      widget.setSrc(new URI("/hicc/v1/tile/draw/14"));
-      widget.setCol(7);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
+      createWidget(Examples.SYSTEM_LOAD_AVERAGE_WIDGET);
+      createWidget(Examples.WELCOME_PAGE_WIDGET);
+      createWidget(Examples.TRIAL_DOWNLOAD_WIDGET);
+      createWidget(Examples.CLUSTER_RUNNING_WIDGET);
+      createWidget(Examples.USER_WORKING_WIDGET);
+      createWidget(Examples.APP_RUNNING_WIDGET);
+      createWidget(Examples.TRIAL_ABANDON_RATE_WIDGET);
+      createWidget(Examples.CLUSTERS_HEALTH_WIDGET);
+      createWidget(Examples.TOP_ACTIVE_CLUSTERS_WIDGET);
+      createWidget(Examples.TOP_APP_WIDGET);
       
-      widget = new Widget();
-      widget.setTitle("Node Managers Health");
-      widget.setSrc(new URI("/hicc/v1/tile/draw/10"));
-      widget.setCol(9);
-      widget.setRow(1);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("HDFS Remaining");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/8"));
-      widget.setCol(1);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Namenode Memory");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/7"));
-      widget.setCol(3);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Resource Manager Memory");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/9"));
-      widget.setCol(5);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("HBase Master Memory");
-      widget.setSrc(new URI("/hicc/v1/circles/draw/15"));
-      widget.setCol(7);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("System Load Average");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/1"));
-      widget.setCol(9);
-      widget.setRow(2);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("CPU Utilization");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/2"));
-      widget.setCol(9);
-      widget.setRow(3);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Memory Utilization");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/3"));
-      widget.setCol(9);
-      widget.setRow(4);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Swap Utilization");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/6"));
-      widget.setCol(9);
-      widget.setRow(5);
-      widget.setSize_x(2);
-      widget.setSize_y(1);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Disk Utilization");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/4"));
-      widget.setCol(1);
-      widget.setRow(4);
-      widget.setSize_x(4);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      widget = new Widget();
-      widget.setTitle("Network Utilization");
-      widget.setSrc(new URI("/hicc/v1/chart/draw/5"));
-      widget.setCol(5);
-      widget.setRow(4);
-      widget.setSize_x(4);
-      widget.setSize_y(2);
-      createWidget(widget);
-      dashboard.add(widget);
-
-      // CPU heatmap
-      widget = new Widget();
-      widget.setTitle("CPU Heatmap");
-      widget.setSrc(new URI("/hicc/v1/heatmap/render/SystemMetrics/cpu.combined."));
-      widget.setCol(1);
-      widget.setRow(5);
-      widget.setSize_x(6);
-      widget.setSize_y(5);
-      createWidget(widget);
-
-      // HDFS Namenode
-      widget = new Widget();
-      widget.setTitle("HDFS UI");
-      widget.setSrc(new URI("http://localhost:50070/"));
-      widget.setCol(1);
-      widget.setRow(11);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-      // HBase Master
-      widget = new Widget();
-      widget.setTitle("HBase Master UI");
-      widget.setSrc(new URI("http://localhost:16010/"));
-      widget.setCol(1);
-      widget.setRow(18);
-      widget.setSize_x(6);
-      widget.setSize_y(6);
-      createWidget(widget);
-
-//    widget = new Widget();
-//    widget.setTitle("Services Running");
-//    widget.setSrc(new URI("/hicc/services/services.html"));
-//    widget.setCol(1);
-//    widget.setRow(1);
-//    widget.setSize_x(2);
-//    widget.setSize_y(1);
-//    createWidget(widget);
-//    dashboard.add(widget);
-//    
-//    widget = new Widget();
-//    widget.setTitle("Applications Running");
-//    widget.setSrc(new URI("/hicc/home/apps.html"));
-//    widget.setCol(3);
-//    widget.setRow(1);
-//    widget.setSize_x(2);
-//    widget.setSize_y(1);
-//    dashboard.add(widget);
-
-//    widget = new Widget();
-//    widget.setTitle("Timeline");
-//    widget.setSrc(new URI("/hicc/timeline/"));
-//    widget.setCol(7);
-//    widget.setRow(2);
-//    widget.setSize_x(4);
-//    widget.setSize_y(6);
-//    createWidget(widget);
-//    dashboard.add(widget);
-
-//      widget = new Widget();
-//      widget.setTitle("Alerts");
-//      widget.setSrc(new URI("/hicc/alerts/"));
-//      widget.setCol(1);
-//      widget.setRow(5);
-//      widget.setSize_x(6);
-//      widget.setSize_y(5);
-//      createWidget(widget);
-//
-//      widget = new Widget();
-//      widget.setTitle("Log Errors");
-//      widget.setSrc(new URI("/hicc/logs/"));
-//      widget.setCol(1);
-//      widget.setRow(5);
-//      widget.setSize_x(6);
-//      widget.setSize_y(5);
-//      createWidget(widget);
-
-      updateDashboard("system", "", dashboard);
+      // User widgets
+      createWidget(Examples.APP_USAGE_WIDGET);
+      createWidget(Examples.QUICK_LINKS_WIDGET);
+      createWidget(Examples.LOG_SEARCH_WIDGET);
+      createWidget(Examples.YARN_APP_WIDGET);
+      createWidget(Examples.HDFS_WIDGET);
+      createWidget(Examples.HBASE_TABLE_WIDGET);
+      createWidget(Examples.TOP_USER_WIDGET);
+
+      // System widgets
+      createWidget(Examples.HDFS_HA_STATE_WIDGET);
+      createWidget(Examples.HDFS_LOAD_WIDGET);
+      createWidget(Examples.HDFS_NAMENODE_LATENCY_WIDGET);
+      createWidget(Examples.DATANODES_HEALTH_WIDGET);
+      createWidget(Examples.NODE_MANAGERS_HEALTH_WIDGET);
+      createWidget(Examples.HDFS_REMAINING_WIDGET);
+      createWidget(Examples.NAMENODE_MEMORY_WIDGET);
+      createWidget(Examples.RESOURCE_MANAGER_MEMORY_WIDGET);
+      createWidget(Examples.HBASE_MASTER_MOMORY_WIDGET);
+      createWidget(Examples.CPU_UTILIZATION_WIDGET);
+      createWidget(Examples.MEMORY_UTILIZATION_WIDGET);
+      createWidget(Examples.SWAP_UTILIZATION_WIDGET);
+      createWidget(Examples.DISK_UTILIZATION_WIDGET);
+      createWidget(Examples.NETWORK_UTILIZATION_WIDGET);
+      createWidget(Examples.CPU_HEAPMAP_WIDGET);
+      createWidget(Examples.HDFS_UI_WIDGET);
+      createWidget(Examples.HBASE_MASTER_UI_WIDGET);
       
+      // Populate default dashboard
+      updateDashboard("default", "", Examples.DEFAULT_DASHBOARD);
+      updateDashboard("user", "", Examples.USER_DASHBOARD);
+      updateDashboard("system", "", Examples.SYSTEM_DASHBOARD);
     } catch (Throwable ex) {
       LOG.error(ExceptionUtil.getStackTrace(ex));
     }

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
index a944373..522adf4 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Chart.java
@@ -19,9 +19,18 @@
 package org.apache.hadoop.chukwa.hicc.bean;
 
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
 public class Chart {
   private String id;
   private ChartType type;
@@ -242,4 +251,94 @@ public class Chart {
   public String getThreshold() {
     return this.threshold;
   }
+
+  /**
+   * Create a chart object.
+   * @param id is unique chart identifier
+   * @param title is searchable name of the chart
+   * @param metrics is list of metric names to render chart
+   * @param source is data source name
+   * @param yunitType is y axis unit type
+   * @return Chart object
+   * @throws URISyntaxException if metrics name can not compose valid URL syntax
+   */
+  public static synchronized Chart createChart(String id,
+      String title, String[] metrics, String source, String yunitType) throws URISyntaxException {
+    Chart chart = new Chart(id);
+    chart.setYUnitType(yunitType);
+    chart.setTitle(title);
+    ArrayList<SeriesMetaData> series = new ArrayList<SeriesMetaData>();
+    for(String metric : metrics) {
+      SeriesMetaData s = new SeriesMetaData();
+      s.setLabel(metric + "/" + source);
+      s.setUrl(new URI("/hicc/v1/metrics/series/" + metric + "/"
+        + source));
+      LineOptions l = new LineOptions();
+      s.setLineOptions(l);
+      series.add(s);
+    }
+    chart.setSeries(series);
+    return chart;
+    
+  }
+  
+  /**
+   * Create a chart in HBase by specifying parameters.
+   * @param id is unique chart identifier
+   * @param title is searchable name of the chart
+   * @param metrics is list of metric names to render ring chart
+   * @param source is data source name
+   * @param suffixLabel is text label to append to metric values
+   * @param direction sets the threshold to have either upper limit or lower limit
+   * @return Chart object
+   * @throws URISyntaxException if metrics name can not compose valid URL syntax
+   */
+  public static synchronized Chart createCircle(String id,
+      String title, String[] metrics, String source, String suffixLabel, String direction) throws URISyntaxException {
+    Chart chart = new Chart(id);
+    chart.setSuffixText(suffixLabel);
+    chart.setTitle(title);
+    chart.setThreshold(direction);
+    ArrayList<SeriesMetaData> series = new ArrayList<SeriesMetaData>();
+    for(String metric : metrics) {
+      SeriesMetaData s = new SeriesMetaData();
+      s.setLabel(metric + "/" + source);
+      s.setUrl(new URI("/hicc/v1/metrics/series/" + metric + "/"
+        + source));
+      series.add(s);
+    }
+    chart.setSeries(series);
+    return chart;
+    
+  }
+  
+  /**
+   * Create a tile in HBase by specifying parameters.
+   * @param id is unique tile identifier
+   * @param title is searchable name of the tile widget
+   * @param bannerText is description of the tile widget
+   * @param suffixLabel is text label to append to metric values
+   * @param metrics is list of metric names to render tile widget
+   * @param source is data source name
+   * @param icon is emoji symbol to render beside tile widget
+   * @return Chart object
+   * @throws URISyntaxException if metrics name can not compose valid URL syntax
+   */
+  public static synchronized Chart createTile(String id, String title, 
+      String bannerText, String suffixLabel, String[] metrics, String source, 
+      String icon) throws URISyntaxException {
+    Chart chart = new Chart(id);
+    chart.setTitle(title);
+    chart.setBannerText(bannerText);
+    chart.setSuffixText(suffixLabel);
+    chart.setIcon(icon);
+    List<SeriesMetaData> smd = new ArrayList<SeriesMetaData>();
+    for (String metric : metrics) {
+      SeriesMetaData series = new SeriesMetaData();
+      series.setUrl(new URI("/hicc/v1/metrics/series/" + metric + "/" + source));
+      smd.add(series);
+    }
+    chart.setSeries(smd);
+    return chart;
+  }
 }

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Dashboard.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Dashboard.java b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Dashboard.java
index eb12674..be57816 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Dashboard.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/bean/Dashboard.java
@@ -18,9 +18,14 @@
 package org.apache.hadoop.chukwa.hicc.bean;
 
 import java.util.ArrayList;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
 
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
 public class Dashboard {
-  ArrayList<Widget> grid = null;
+  public ArrayList<Widget> grid = null;
 
   public void add(Widget widget) {
     if(grid==null) {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
index 614a161..bfebd26 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/ChartController.java
@@ -61,6 +61,7 @@ public class ChartController {
    * 
    * @param id Reference ID of Chart stored in HBase chukwa_meta table.
    * @return chart widget
+   * 
    */
   @GET
   @Path("draw/{id}")
@@ -88,8 +89,14 @@ public class ChartController {
 
   /**
    * Describe chart meta data
+   * 
    * @param id Chart ID
    * @return chart meta data
+   * 
+   * @response.representation.200.doc Display chart configuration options
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example {@link Examples#CPU_UTILIZATION}
+   * 
    */
   @GET
   @Path("describe/{id}")
@@ -106,6 +113,9 @@ public class ChartController {
    * 
    * @param buffer holds incoming JSON of Chart object
    * @return Web response code
+   * 
+   * @request.representation.example {@link Examples#MEMORY_UTILIZATION}
+   * 
    */
   @POST
   @Path("save")
@@ -126,6 +136,9 @@ public class ChartController {
    * @param id is unique identifier of Chart object
    * @param buffer holds incoming JSON of Chart object
    * @return Web response code
+   * 
+   * @request.representation.example {@link Examples#DISK_UTILIZATION}
+   * 
    */
   @PUT
   @Path("save/{id}")
@@ -139,12 +152,18 @@ public class ChartController {
   }
 
   /**
-   * Preview a chart
+   * Display a chart base on chart configuration from REST API input
+   * 
    * @param buffer holds incoming JSON of Chart object
    * @return segment of chart HTML output
+   * 
+   * @request.representation.example {@link Examples#NETWORK_UTILIZATION}
+   *
    */
   @PUT
   @Path("preview")
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.TEXT_HTML)
   public String preview(String buffer) {
     VelocityContext context = new VelocityContext();
     StringWriter sw = null;
@@ -166,8 +185,21 @@ public class ChartController {
     return sw.toString();
   }
 
+  /**
+   * Display metrics series in JSON
+   * 
+   * @param request HTTP request object
+   * @param buffer list of SeriesMetaData
+   * @return metrics JSON
+   * 
+   * @request.representation.example {@link Examples#CPU_SERIES_METADATA}
+   * @response.representation.200.doc Display series data in JSON
+   * @response.representation.200.mediaType application/json
+   * 
+   */
   @PUT
   @Path("preview/series")
+  @Consumes(MediaType.APPLICATION_JSON)
   @Produces("application/json")
   public String previewSeries(@Context HttpServletRequest request, String buffer) {
     Type listType = new TypeToken<ArrayList<SeriesMetaData>>() {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/CirclesController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/CirclesController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/CirclesController.java
index e7dd2a4..1088fdd 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/CirclesController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/CirclesController.java
@@ -22,9 +22,9 @@ import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
@@ -62,6 +62,10 @@ public class CirclesController {
    * @param id Title of the tile.
    * @param invert Toggle to display warning, error color by upper bound or lower bound.
    * @return html circle widget.
+   * 
+   * @response.representation.200.doc Render circleful chart
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example is availabe on HICC UI
    */
   @GET
   @Path("draw/{id}")
@@ -87,7 +91,17 @@ public class CirclesController {
     return sw.toString();
   }
 
+  /**
+   * Preview circle graph with a set of chart configuration
+   * 
+   * @param buffer is chart object
+   * @return html text of circle graph
+   * 
+   * @request.representation.example {@link Examples#NAMENODE_MEMORY}
+   */
   @PUT
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.TEXT_HTML)
   @Path("preview")
   public String preview(String buffer) {
     VelocityContext context = new VelocityContext();
@@ -109,7 +123,20 @@ public class CirclesController {
     return sw.toString();
   }
   
+  /**
+   * Circle graph data can be calculated based on either a ratio of two metrics or
+   * the selected metric is a percentage metric for rendering circle graph.
+   * 
+   * @param request is HTTP request object
+   * @param buffer is list of SeriesMetaData for fetching series data
+   * @return JSON output series data
+   * 
+   * @request.representation.example {@link Examples#HDFS_USAGE_SERIES_METADATA}
+   * @response.representation.200.doc Display series data in JSON
+   * @response.representation.200.mediaType application/json
+   */
   @PUT
+  @Consumes(MediaType.APPLICATION_JSON)
   @Path("preview/series")
   @Produces("application/json")
   public String previewSeries(@Context HttpServletRequest request, String buffer) {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/DashboardController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/DashboardController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/DashboardController.java
index 2721694..9c40380 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/DashboardController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/DashboardController.java
@@ -57,8 +57,19 @@ public class DashboardController {
   @Context
   VelocityEngine velocity;
 
-  
+  /**
+   * Load a dashboard view
+   * 
+   * @param request HTTP request object
+   * @param id is dashboard unique identifier
+   * @return Dashboard view in JSON structure
+   * 
+   * @response.representation.200.doc Display dashboard JSON structure
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example {@link Examples#SYSTEM_DASHBOARD}
+   */
   @GET
+  @Produces(MediaType.APPLICATION_JSON)
   @Path("load/{id}")
   public String load(@Context HttpServletRequest request, @PathParam("id") String id) {
     Gson gson = new Gson();
@@ -67,6 +78,18 @@ public class DashboardController {
     return json;
   }
   
+  /**
+   * Save a dashboard view
+   * 
+   * @param request HTTP request object
+   * @param id is dashboard unique identifier
+   * @param buffer is JSON structure of dashboard view
+   * @return Status of the dashboard save
+   * 
+   * @request.representation.example {@link Examples#USER_DASHBOARD}
+   * @response.representation.200.doc Display save status code
+   * @response.representation.200.mediaType text/plain
+   */
   @PUT
   @Path("save/{id}")
   @Consumes(MediaType.APPLICATION_JSON)
@@ -80,12 +103,32 @@ public class DashboardController {
     return Response.ok().build();
   }
   
+  /**
+   * Return HTTP request connection user name
+   * 
+   * @param request HTTP request object
+   * @return username
+   * 
+   * @response.representation.200.doc Username
+   * @response.representation.200.mediaType text/plain
+   * @response.representation.200.example admin
+   */
   @GET
   @Path("whoami")
+  @Produces(MediaType.TEXT_PLAIN)
   public String whoami(@Context HttpServletRequest request) {
     return request.getRemoteUser();
   }
   
+  /**
+   * Render Quick links to various services web portals
+   * 
+   * @return HTML page of quick links
+   * 
+   * @response.representation.200.doc Display quick link widget
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example is availabe on HICC UI
+   */
   @GET
   @Path("quicklinks")
   @Produces(MediaType.TEXT_HTML)

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
new file mode 100644
index 0000000..4c2de0a
--- /dev/null
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/Examples.java
@@ -0,0 +1,540 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.chukwa.hicc.rest;
+
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.chukwa.hicc.bean.Chart;
+import org.apache.hadoop.chukwa.hicc.bean.Dashboard;
+import org.apache.hadoop.chukwa.hicc.bean.Series;
+import org.apache.hadoop.chukwa.hicc.bean.SeriesMetaData;
+import org.apache.hadoop.chukwa.hicc.bean.Widget;
+
+@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="MS_SHOULD_BE_FINAL")
+public class Examples {
+  // Chart examples
+  public static Chart SYSTEM_LOAD_AVERAGE;
+  public static Chart CPU_UTILIZATION;
+  public static Chart MEMORY_UTILIZATION;
+  public static Chart DISK_UTILIZATION;
+  public static Chart NETWORK_UTILIZATION;
+  public static Chart SWAP_UTILIZATION;
+  public static Chart NAMENODE_MEMORY;
+  public static Chart HDFS_USAGE;
+  public static Chart RESOURCE_MANAGER_MEMORY;
+  public static Chart NODE_MANAGER_HEALTH;
+  public static Chart HDFS_HA;
+  public static Chart HDFS_LOAD;
+  public static Chart NAMENODE_RPC_LATENCY;
+  public static Chart DATANODES;
+  public static Chart HBASE_MASTER_MEMORY;
+
+  // Widget examples
+  public static Widget SYSTEM_LOAD_AVERAGE_WIDGET;
+  public static Widget WELCOME_PAGE_WIDGET;
+  public static Widget TRIAL_DOWNLOAD_WIDGET;
+  public static Widget CLUSTER_RUNNING_WIDGET;
+  public static Widget USER_WORKING_WIDGET;
+  public static Widget APP_RUNNING_WIDGET;
+  public static Widget TRIAL_ABANDON_RATE_WIDGET;
+  public static Widget CLUSTERS_HEALTH_WIDGET;
+  public static Widget TOP_ACTIVE_CLUSTERS_WIDGET;
+  public static Widget TOP_APP_WIDGET;
+  public static Widget APP_USAGE_WIDGET;
+  public static Widget QUICK_LINKS_WIDGET;
+  public static Widget LOG_SEARCH_WIDGET;
+  public static Widget YARN_APP_WIDGET;
+  public static Widget HDFS_WIDGET;
+  public static Widget HBASE_TABLE_WIDGET;
+  public static Widget TOP_USER_WIDGET;
+  public static Widget HDFS_HA_STATE_WIDGET;
+  public static Widget HDFS_LOAD_WIDGET;
+  public static Widget HDFS_NAMENODE_LATENCY_WIDGET;
+  public static Widget DATANODES_HEALTH_WIDGET;
+  public static Widget NODE_MANAGERS_HEALTH_WIDGET;
+  public static Widget HDFS_REMAINING_WIDGET;
+  public static Widget NAMENODE_MEMORY_WIDGET;
+  public static Widget RESOURCE_MANAGER_MEMORY_WIDGET;
+  public static Widget HBASE_MASTER_MOMORY_WIDGET;
+  public static Widget CPU_UTILIZATION_WIDGET;
+  public static Widget MEMORY_UTILIZATION_WIDGET;
+  public static Widget SWAP_UTILIZATION_WIDGET;
+  public static Widget DISK_UTILIZATION_WIDGET;
+  public static Widget NETWORK_UTILIZATION_WIDGET;
+  public static Widget CPU_HEAPMAP_WIDGET;
+  public static Widget HDFS_UI_WIDGET;
+  public static Widget HBASE_MASTER_UI_WIDGET;
+  public static List<Widget> WIDGET_LIST;
+  
+  public static Dashboard DEFAULT_DASHBOARD;
+  public static Dashboard USER_DASHBOARD;
+  public static Dashboard SYSTEM_DASHBOARD;
+  
+
+  // series examples
+  public static Series CPU_METRICS;
+  
+  // SeriesMetaData examples
+  public static List<SeriesMetaData> CPU_SERIES_METADATA;
+  public static List<SeriesMetaData> HDFS_USAGE_SERIES_METADATA;
+
+  static {
+    try {
+      final String hostname = InetAddress.getLocalHost().getHostName().toLowerCase();
+      final String[] metrics = { "SystemMetrics.LoadAverage.1" };
+      SYSTEM_LOAD_AVERAGE = Chart.createChart("1", "System Load Average", metrics, hostname, "");
+      final String[] cpuMetrics = { "SystemMetrics.cpu.combined", "SystemMetrics.cpu.sys", "SystemMetrics.cpu.user" };
+      CPU_UTILIZATION = Chart.createChart("2", "CPU Utilization", cpuMetrics, hostname, "percent");
+      final String[] memMetrics = { "SystemMetrics.memory.FreePercent", "SystemMetrics.memory.UsedPercent"};
+      MEMORY_UTILIZATION = Chart.createChart("3", "Memory Utilization", memMetrics, hostname, "percent");
+      final String[] diskMetrics = { "SystemMetrics.disk.ReadBytes", "SystemMetrics.disk.WriteBytes" };
+      DISK_UTILIZATION = Chart.createChart("4", "Disk Utilization", diskMetrics, hostname, "bytes-decimal");
+      final String[] netMetrics = { "SystemMetrics.network.TxBytes", "SystemMetrics.network.RxBytes" };
+      NETWORK_UTILIZATION = Chart.createChart("5", "Network Utilization", netMetrics, hostname, "bytes");
+      final String[] swapMetrics = { "SystemMetrics.swap.Total", "SystemMetrics.swap.Used", "SystemMetrics.swap.Free" };
+      SWAP_UTILIZATION = Chart.createChart("6", "Swap Utilization", swapMetrics, hostname, "bytes-decimal");
+
+      // Namenode heap usage
+      StringBuilder namenode = new StringBuilder();
+      namenode.append(hostname);
+      namenode.append(":NameNode");
+      final String[] namenodeHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" };
+      NAMENODE_MEMORY = Chart.createCircle("7", "Namenode Memory", namenodeHeap, namenode.toString(), "%", "up");
+      
+      // HDFS Usage
+      final String[] hdfsUsage = { "HadoopMetrics.dfs.FSNamesystem.CapacityRemainingGB", "HadoopMetrics.dfs.FSNamesystem.CapacityTotalGB" };
+      HDFS_USAGE = Chart.createCircle("8", "HDFS Remaining", hdfsUsage, hostname, "%", "down");
+
+      // Resource Manager Memory
+      StringBuilder rmnode = new StringBuilder();
+      rmnode.append(hostname);
+      rmnode.append(":ResourceManager");
+      final String[] rmHeap = { "HadoopMetrics.jvm.JvmMetrics.MemHeapUsedM", "HadoopMetrics.jvm.JvmMetrics.MemHeapMaxM" };
+      RESOURCE_MANAGER_MEMORY = Chart.createCircle("9", "Resource Manager Memory", rmHeap, rmnode.toString(), "%", "up");
+
+      // Node Managers Health
+      final String[] nmh = { "HadoopMetrics.yarn.ClusterMetrics.NumActiveNMs", "HadoopMetrics.yarn.ClusterMetrics.NumLostNMs" };
+      NODE_MANAGER_HEALTH = Chart.createTile("10", "Node Managers Health", "Node Managers", "Active/Lost", nmh, hostname, "glyphicon-th");
+
+      // High Availability State
+      final String[] ha = { "HadoopMetrics.dfs.FSNamesystem.HAState" };
+      HDFS_HA = Chart.createTile("11", "HDFS High Availability State", "HDFS High Availability", "", ha, hostname, "glyphicon-random");
+
+      // HDFS Load
+      final String[] hdfsLoad = { "HadoopMetrics.dfs.FSNamesystem.TotalLoad" };
+      HDFS_LOAD = Chart.createTile("12", "HDFS Load Average", "HDFS Load", "", hdfsLoad, hostname, "glyphicon-signal");
+
+      // Namenode RPC Latency
+      final String[] nnLatency = { "HadoopMetrics.rpc.rpc.RpcProcessingTimeAvgTime" };
+      NAMENODE_RPC_LATENCY = Chart.createTile("13", "NameNode Latency", "NameNode RPC Latency", "Milliseconds", nnLatency, hostname, "glyphicon-tasks");
+
+      // Datanode Health
+      final String[] dnHealth = { "HadoopMetrics.dfs.FSNamesystem.StaleDataNodes" };
+      DATANODES = Chart.createTile("14", "Datanodes Health", "Datanodes", "Dead", dnHealth, hostname, "glyphicon-hdd");
+
+      // HBase Master Memory
+      StringBuilder hbaseMaster = new StringBuilder();
+      hbaseMaster.append(hostname);
+      hbaseMaster.append(":Master");
+      final String[] hbm = { "HBaseMetrics.jvm.JvmMetrics.MemHeapUsedM", "HBaseMetrics.jvm.JvmMetrics.MemHeapMaxM" };
+      HBASE_MASTER_MEMORY = Chart.createCircle("15", "HBase Master Memory", hbm, hbaseMaster.toString(), "%", "up");
+
+      CPU_SERIES_METADATA = CPU_UTILIZATION.getSeries();
+      HDFS_USAGE_SERIES_METADATA = HDFS_USAGE.getSeries();
+      
+//      CPU_METRICS = new Series("SystemMetrics.LoadAverage.1");
+//      CPU_METRICS.add(1234567890L, 0.0d);
+//      CPU_METRICS.add(1234567891L, 1.0d);
+//      CPU_METRICS.add(1234567892L, 2.0d);
+//      CPU_METRICS.add(1234567893L, 3.0d);
+
+      // Populate default widgets
+      Widget widget = new Widget();
+      widget.setTitle("System Load Average");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/1"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      SYSTEM_LOAD_AVERAGE_WIDGET = widget;
+
+      // Populate default dashboard
+      Dashboard dashboard = new Dashboard();
+
+      widget = new Widget();
+      widget.setTitle("Welcome Page");
+      widget.setSrc(new URI("/hicc/welcome.html"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(10);
+      widget.setSize_y(5);
+      WELCOME_PAGE_WIDGET = widget;
+      dashboard.add(WELCOME_PAGE_WIDGET);
+      DEFAULT_DASHBOARD = dashboard;
+
+      widget = new Widget();
+      widget.setTitle("Trial Downloading");
+      widget.setSrc(new URI("/hicc/home/downloads.html"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      TRIAL_DOWNLOAD_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Cluster Running");
+      widget.setSrc(new URI("/hicc/home/clusters.html"));
+      widget.setCol(3);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      CLUSTER_RUNNING_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Users Working");
+      widget.setSrc(new URI("/hicc/home/users.html"));
+      widget.setCol(5);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      USER_WORKING_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Applications Running");
+      widget.setSrc(new URI("/hicc/home/apps.html"));
+      widget.setCol(7);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      APP_RUNNING_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Trial Abandon Rate");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/11"));
+      widget.setCol(1);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      TRIAL_ABANDON_RATE_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Clusters Health");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/12"));
+      widget.setCol(3);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      CLUSTERS_HEALTH_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Top Active Clusters");
+      widget.setSrc(new URI("/hicc/clusters/"));
+      widget.setCol(5);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      TOP_ACTIVE_CLUSTERS_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Top Applications");
+      widget.setSrc(new URI("/hicc/apps/"));
+      widget.setCol(7);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      TOP_APP_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Applications Usage");
+      widget.setSrc(new URI("/hicc/apps/apps-usage.html"));
+      widget.setCol(7);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      APP_USAGE_WIDGET = widget;
+
+      // Populate user dashboards
+      dashboard = new Dashboard();
+
+      widget = new Widget();
+      widget.setTitle("Quick Links");
+      widget.setSrc(new URI("/hicc/v1/dashboard/quicklinks"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(10);
+      widget.setSize_y(5);
+      QUICK_LINKS_WIDGET = widget;
+      dashboard.add(QUICK_LINKS_WIDGET);
+
+      // Log Search widget
+      widget = new Widget();
+      widget.setTitle("Log Search");
+      widget.setSrc(new URI("/hicc/ajax-solr/chukwa"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      LOG_SEARCH_WIDGET = widget;
+
+      // Applications
+      widget = new Widget();
+      widget.setTitle("YARN Applications");
+      widget.setSrc(new URI("http://localhost:8088/"));
+      widget.setCol(1);
+      widget.setRow(7);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      YARN_APP_WIDGET = widget;
+
+      // Hadoop Distributed File System
+      widget = new Widget();
+      widget.setTitle("HDFS");
+      widget.setSrc(new URI("http://localhost:50070/explorer.html#/"));
+      widget.setCol(1);
+      widget.setRow(7);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      HDFS_WIDGET = widget;
+
+      // HBase Tables
+      widget = new Widget();
+      widget.setTitle("HBase Tables");
+      widget.setSrc(new URI("http://localhost:50654/tablesDetailed.jsp"));
+      widget.setCol(1);
+      widget.setRow(14);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      HBASE_TABLE_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Top Applications");
+      widget.setSrc(new URI("/hicc/apps/"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      TOP_APP_WIDGET = widget;
+
+      widget = new Widget();
+      widget.setTitle("Top Users");
+      widget.setSrc(new URI("/hicc/users/"));
+      widget.setCol(1);
+      widget.setRow(3);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      TOP_USER_WIDGET = widget;
+      USER_DASHBOARD = dashboard;
+
+      // Populate system dashboards
+      dashboard = new Dashboard();
+      widget = new Widget();
+      widget.setTitle("HDFS High Availability State");
+      widget.setSrc(new URI("/hicc/v1/tile/draw/11"));
+      widget.setCol(1);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      HDFS_HA_STATE_WIDGET = widget;
+      dashboard.add(HDFS_HA_STATE_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("HDFS Load");
+      widget.setSrc(new URI("/hicc/v1/tile/draw/12"));
+      widget.setCol(3);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      HDFS_LOAD_WIDGET = widget;
+      dashboard.add(HDFS_LOAD_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("HDFS Namenode Latency");
+      widget.setSrc(new URI("/hicc/v1/tile/draw/13"));
+      widget.setCol(5);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      HDFS_NAMENODE_LATENCY_WIDGET = widget;
+      dashboard.add(HDFS_NAMENODE_LATENCY_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Datanodes Health");
+      widget.setSrc(new URI("/hicc/v1/tile/draw/14"));
+      widget.setCol(7);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      DATANODES_HEALTH_WIDGET = widget;
+      dashboard.add(DATANODES_HEALTH_WIDGET);
+      
+      widget = new Widget();
+      widget.setTitle("Node Managers Health");
+      widget.setSrc(new URI("/hicc/v1/tile/draw/10"));
+      widget.setCol(9);
+      widget.setRow(1);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      NODE_MANAGERS_HEALTH_WIDGET = widget;
+      dashboard.add(NODE_MANAGERS_HEALTH_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("HDFS Remaining");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/8"));
+      widget.setCol(1);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      HDFS_REMAINING_WIDGET = widget;
+      dashboard.add(HDFS_REMAINING_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Namenode Memory");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/7"));
+      widget.setCol(3);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      NAMENODE_MEMORY_WIDGET = widget;
+      dashboard.add(NAMENODE_MEMORY_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Resource Manager Memory");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/9"));
+      widget.setCol(5);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      RESOURCE_MANAGER_MEMORY_WIDGET = widget;
+      dashboard.add(RESOURCE_MANAGER_MEMORY_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("HBase Master Memory");
+      widget.setSrc(new URI("/hicc/v1/circles/draw/15"));
+      widget.setCol(7);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(2);
+      HBASE_MASTER_MOMORY_WIDGET = widget;
+      dashboard.add(HBASE_MASTER_MOMORY_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("System Load Average");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/1"));
+      widget.setCol(9);
+      widget.setRow(2);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      SYSTEM_LOAD_AVERAGE_WIDGET = widget;
+      dashboard.add(SYSTEM_LOAD_AVERAGE_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("CPU Utilization");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/2"));
+      widget.setCol(9);
+      widget.setRow(3);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      CPU_UTILIZATION_WIDGET = widget;
+      dashboard.add(CPU_UTILIZATION_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Memory Utilization");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/3"));
+      widget.setCol(9);
+      widget.setRow(4);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      MEMORY_UTILIZATION_WIDGET = widget;
+      dashboard.add(MEMORY_UTILIZATION_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Swap Utilization");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/6"));
+      widget.setCol(9);
+      widget.setRow(5);
+      widget.setSize_x(2);
+      widget.setSize_y(1);
+      SWAP_UTILIZATION_WIDGET = widget;
+      dashboard.add(SWAP_UTILIZATION_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Disk Utilization");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/4"));
+      widget.setCol(1);
+      widget.setRow(4);
+      widget.setSize_x(4);
+      widget.setSize_y(2);
+      DISK_UTILIZATION_WIDGET = widget;
+      dashboard.add(DISK_UTILIZATION_WIDGET);
+
+      widget = new Widget();
+      widget.setTitle("Network Utilization");
+      widget.setSrc(new URI("/hicc/v1/chart/draw/5"));
+      widget.setCol(5);
+      widget.setRow(4);
+      widget.setSize_x(4);
+      widget.setSize_y(2);
+      NETWORK_UTILIZATION_WIDGET = widget;
+      dashboard.add(NETWORK_UTILIZATION_WIDGET);
+      SYSTEM_DASHBOARD = dashboard;
+
+      // CPU heatmap
+      widget = new Widget();
+      widget.setTitle("CPU Heatmap");
+      widget.setSrc(new URI("/hicc/v1/heatmap/render/SystemMetrics/cpu.combined."));
+      widget.setCol(1);
+      widget.setRow(5);
+      widget.setSize_x(6);
+      widget.setSize_y(5);
+      CPU_HEAPMAP_WIDGET = widget;
+
+      // HDFS Namenode
+      widget = new Widget();
+      widget.setTitle("HDFS UI");
+      widget.setSrc(new URI("http://localhost:50070/"));
+      widget.setCol(1);
+      widget.setRow(11);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      HDFS_UI_WIDGET = widget;
+
+      // HBase Master
+      widget = new Widget();
+      widget.setTitle("HBase Master UI");
+      widget.setSrc(new URI("http://localhost:16010/"));
+      widget.setCol(1);
+      widget.setRow(18);
+      widget.setSize_x(6);
+      widget.setSize_y(6);
+      HBASE_MASTER_UI_WIDGET = widget;
+
+      WIDGET_LIST = new ArrayList<Widget>();
+      WIDGET_LIST.add(HDFS_HA_STATE_WIDGET);
+      WIDGET_LIST.add(HDFS_UI_WIDGET);
+      WIDGET_LIST.add(HDFS_LOAD_WIDGET);
+    } catch (URISyntaxException e) {
+    } catch (UnknownHostException e) {
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java
index 80f7457..f81db6b 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/HeatmapController.java
@@ -46,6 +46,24 @@ public class HeatmapController {
   @Context
   VelocityEngine velocity;
 
+  /**
+   * Render a heatmap
+   * @param request is HTTP request object
+   * @param metricGroup is metric group name
+   * @param metric is metric name
+   * @param start is start time in yyyyMMddHHmmss format
+   * @param end is end time in yyyyMMddHHmmss format
+   * @param max is maximum possible value of the heatmap
+   * @param scale is the range of possible values
+   * @param width is width of the image
+   * @param height is height of the image
+   * @return html page of login screen
+   * 
+   * @response.representation.200.doc Login screen
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
+   */
+
   @GET
   @Path("{metricGroup}/{metric}")
   @Produces(MediaType.APPLICATION_JSON)
@@ -81,6 +99,17 @@ public class HeatmapController {
     return heatmap;
   }
   
+  /**
+   * Render a heatmap from HBase series
+   * 
+   * @param metricGroup is metric group name
+   * @param metric is metric name
+   * @param width is width of the image
+   * @param height is height of the image
+   * @param title is title of the heatmap
+   * @param yLabel is y axis label for the heatmap
+   * @return heatmap chart in html
+   */
   @GET
   @Path("render/{metricGroup}/{metric}")
   @Produces(MediaType.TEXT_HTML)

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java
index d3413a4..4ae3fca 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/LoginController.java
@@ -44,6 +44,16 @@ public class LoginController {
     ChukwaHBaseStore.populateDefaults();
   }
 
+  /**
+   * Password verification login screen
+   * 
+   * @param buffer holds any user input
+   * @return html page of login screen
+   * 
+   * @response.representation.200.doc Login screen
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
+   */
   @GET
   @Path("check")
   public String login(String buffer) {
@@ -60,6 +70,19 @@ public class LoginController {
     return sw.toString();
   }
 
+  /**
+   * Password verification REST API
+   * 
+   * @param request is HTTP request object
+   * @return login status code
+   * 
+   * @response.representation.200.doc User login successful
+   * @response.representation.200.mediaType text/plain
+   * @response.representation.200.example 200 OK
+   * @response.representation.403.doc Login denied
+   * @response.representation.403.mediaType text/plain
+   * @response.representation.403.example 403 FORBIDDEN
+   */
   @POST
   @Path("check")
   public Response check(@Context HttpServletRequest request) {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/MetricsController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/MetricsController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/MetricsController.java
index c3f3746..a88ac1d 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/MetricsController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/MetricsController.java
@@ -87,6 +87,18 @@ public class MetricsController {
     return buffer;
   }
 
+  /**
+   * Query metric series by session key, this is useful to query same metric from
+   * multiple data sources, such as multiple hosts
+   * 
+   * @param request is HTTP request object
+   * @param metricGroup is metric group name
+   * @param metric is metric name
+   * @param skey is session key which maps to multiple data sources
+   * @param start is start time
+   * @param end is end time
+   * @return List of metric series
+   */
   @GET
   @Path("series/{metricGroup}/{metric}/session/{sessionKey}")
   @Produces("application/json")
@@ -131,6 +143,11 @@ public class MetricsController {
     return buffer;
   }
 
+  /**
+   * Query all metric group names in HBase
+   * 
+   * @return a list of metric groups
+   */
   @GET
   @Path("schema")
   @Produces("application/json")
@@ -141,6 +158,13 @@ public class MetricsController {
     return groups;
   }
   
+  /**
+   * Query metric names by metric group
+   * 
+   * @param metricGroup is name of metric group
+   * @return a list of metric names
+   * 
+   */
   @GET
   @Path("schema/{metricGroup}")
   @Produces("application/json")
@@ -151,6 +175,14 @@ public class MetricsController {
     return metrics;
   }
 
+  /**
+   * Query metrics source names by metric group
+   * 
+   * @param request HTTP Request object
+   * @param metricGroup is name of metric group
+   * @return a list of metric source names
+   * 
+   */
   @GET
   @Path("source/{metricGroup}")
   @Produces("application/json")

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/PieChartController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/PieChartController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/PieChartController.java
index 8f33af8..7baec8a 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/PieChartController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/PieChartController.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
@@ -58,6 +59,10 @@ public class PieChartController extends ChartController{
    * 
    * @param id Reference ID of Chart stored in HBase chukwa_meta table.
    * @return html chart widget
+   * 
+   * @response.representation.200.doc Preview a pie chart
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
    */
   @GET
   @Path("draw/{id}")
@@ -86,9 +91,17 @@ public class PieChartController extends ChartController{
 
   /**
    * Preview a pie chart
+   * 
+   * @param buffer is pie chart object
+   * 
+   * @response.representation.200.doc Preview a pie chart
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
    */
   @PUT
   @Path("preview")
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.TEXT_HTML)
   public String preview(String buffer) {
     VelocityContext context = new VelocityContext();
     StringWriter sw = null;
@@ -111,8 +124,20 @@ public class PieChartController extends ChartController{
     return sw.toString();
   }
 
+  /**
+   * Preview a series JSON for pie chart
+   * 
+   * @param request HTTP request object
+   * @param buffer is pie chart configuration
+   * 
+   * @request.representation.example {@link Examples#CPU_SERIES_METADATA}
+   * @response.representation.200.doc Preview a pie chart series
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example Example available in REST API
+   */
   @PUT
   @Path("preview/series")
+  @Consumes(MediaType.APPLICATION_JSON)
   @Produces("application/json")
   public String previewSeries(@Context HttpServletRequest request, String buffer) {
     Type listType = new TypeToken<ArrayList<SeriesMetaData>>() {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/SessionController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/SessionController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/SessionController.java
index be4afb5..f1c670c 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/SessionController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/SessionController.java
@@ -24,6 +24,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
@@ -44,6 +45,7 @@ public class SessionController {
 
   /**
    * Utility to get session attributes
+   * 
    * @param request is HTTP request object
    * @param id is session key
    * @return session attribute
@@ -60,7 +62,15 @@ public class SessionController {
     return json;
   }
 
+  /**
+   * Store session attributes
+   * 
+   * @param request is HTTP request object
+   * @param buffer is session key value pairs in JSON
+   * @return session update status code
+   */
   @PUT
+  @Consumes(MediaType.APPLICATION_JSON)
   @Path("save")
   public Response save(@Context HttpServletRequest request, String buffer) {
     Gson gson = new Gson();

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/TileController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/TileController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/TileController.java
index 8e259a9..1bd7c79 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/TileController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/TileController.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
@@ -57,6 +58,10 @@ public class TileController extends ChartController{
    * 
    * @param id Reference ID of Chart stored in HBase chukwa_meta table.
    * @return html chart widget
+   * 
+   * @response.representation.200.doc Render a banner base on chart id
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
    */
   @GET
   @Path("draw/{id}")
@@ -84,9 +89,18 @@ public class TileController extends ChartController{
 
   /**
    * Preview a banner tile
+   * 
+   * @param buffer is tile object in JSON
+   * @return html for rendering a banner tile
+   * 
+   * @response.representation.200.doc Preview a banner
+   * @response.representation.200.mediaType text/html
+   * @response.representation.200.example Example available in HICC UI
    */
   @PUT
   @Path("preview")
+  @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.TEXT_HTML)
   public String preview(String buffer) {
     VelocityContext context = new VelocityContext();
     StringWriter sw = null;
@@ -108,9 +122,20 @@ public class TileController extends ChartController{
     return sw.toString();
   }
 
+  /**
+   * Preview a series JSON for banner tile
+   * 
+   * @param request HTTP request object
+   * @param buffer is banner tile configuration
+   * 
+   * @request.representation.example {@link Examples#CPU_SERIES_METADATA}
+   * @response.representation.200.doc Preview a banner series
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example Example available in REST API
+   */
   @PUT
   @Path("preview/series")
-  @Produces("application/json")
+  @Produces(MediaType.APPLICATION_JSON)
   public String previewSeries(@Context HttpServletRequest request, String buffer) {
     Type listType = new TypeToken<ArrayList<SeriesMetaData>>() {
     }.getType();

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/java/org/apache/hadoop/chukwa/hicc/rest/WidgetController.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/WidgetController.java b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/WidgetController.java
index 5ea2dd0..a093893 100644
--- a/src/main/java/org/apache/hadoop/chukwa/hicc/rest/WidgetController.java
+++ b/src/main/java/org/apache/hadoop/chukwa/hicc/rest/WidgetController.java
@@ -30,6 +30,7 @@ import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
@@ -55,8 +56,20 @@ public class WidgetController {
   public void init() {
   }
 
+  /**
+   * List widgets
+   * 
+   * @param limit is number of widgets to return
+   * @param offset is position in the widget list
+   * @return list of widgets in HBase database
+   * 
+   * @response.representation.200.doc Display list of HICC supported widgets
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example {@link Examples#WIDGET_LIST}
+   */
   @GET
   @Path("list")
+  @Produces(MediaType.APPLICATION_JSON)
   public String listWidget(@DefaultValue("1000") @QueryParam("limit") int limit, 
       @DefaultValue("0") @QueryParam("offset") int offset) {
     List<Widget> widgets = ChukwaHBaseStore.listWidget(limit, offset);
@@ -65,6 +78,15 @@ public class WidgetController {
     return json;
   }
 
+  /**
+   * Search for widget base on widget title
+   * @param query is search critieria
+   * @return list of widgets matched search critieria
+   * 
+   * @response.representation.200.doc Display list of HICC widget that matches query
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example {@link Examples#WIDGET_LIST}
+   */
   @GET
   @Path("search/{query}")
   public String searchWidget(@PathParam("query") String query) {
@@ -74,6 +96,15 @@ public class WidgetController {
     return json;
   }
 
+  /**
+   * View widget details
+   * @param title is title of the widget
+   * @return widget configuration
+   * 
+   * @response.representation.200.doc View widget details
+   * @response.representation.200.mediaType application/json
+   * @response.representation.200.example {@link Examples#SYSTEM_LOAD_AVERAGE_WIDGET}
+   */
   @GET
   @Path("view/{title}")
   public String viewWidget(@PathParam("title") String title) {
@@ -83,6 +114,19 @@ public class WidgetController {
     return json;
   }
 
+  /**
+   * Create a widget
+   * @param buffer is widget configuration
+   * @return Creation status code
+   * 
+   * @request.representation.example {@link Examples#WELCOME_PAGE_WIDGET}
+   * @response.representation.200.doc Widget creation successful
+   * @response.representation.200.mediaType text/plain
+   * @response.representation.200.example 200 OK
+   * @response.representation.400.doc Widget creation unsuccessful
+   * @response.representation.400.mediaType text/plain
+   * @response.representation.400.example 400 Bad Request
+   */
   @POST
   @Path("create")
   @Consumes(MediaType.APPLICATION_JSON)
@@ -96,6 +140,20 @@ public class WidgetController {
     return Response.ok().build();
   }
 
+  /**
+   * Update a widget
+   * @param title is widget title
+   * @param buffer is widget object in JSON
+   * @return Update status code
+   * 
+   * @request.representation.example {@link Examples#WELCOME_PAGE_WIDGET}
+   * @response.representation.200.doc Widget update is successful
+   * @response.representation.200.mediaType text/plain
+   * @response.representation.200.example 200 OK
+   * @response.representation.400.doc Widget update unsuccessful
+   * @response.representation.400.mediaType text/plain
+   * @response.representation.400.example 400 Bad Request
+   */
   @PUT
   @Path("update/{title}")
   @Consumes(MediaType.APPLICATION_JSON)
@@ -109,6 +167,18 @@ public class WidgetController {
     return Response.ok().build();
   }
 
+  /**
+   * Delete a widget
+   * @param title is widget title
+   * @return Widget delete status code
+   * 
+   * @response.representation.200.doc Widget deletion successful
+   * @response.representation.200.mediaType text/plain
+   * @response.representation.200.example 200 OK
+   * @response.representation.400.doc Widget deletion unsuccessful
+   * @response.representation.400.mediaType text/plain
+   * @response.representation.400.example 400 Bad Request
+   */
   @DELETE
   @Path("delete/{title}")
   public Response deleteWidget(@PathParam("title") String title) {

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e0bf3c0e/src/main/webapps/wadl.xsl
----------------------------------------------------------------------
diff --git a/src/main/webapps/wadl.xsl b/src/main/webapps/wadl.xsl
index eca8de7..7af2ff4 100644
--- a/src/main/webapps/wadl.xsl
+++ b/src/main/webapps/wadl.xsl
@@ -379,8 +379,64 @@
           </xsl:choose>
       </xsl:for-each>
     </xsl:when>
+    <xsl:when test="@mediaType = 'text/html'">
+      <xsl:for-each select="wadl:doc">
+        <xsl:sort select="position()" data-type="number" order="descending"/>
+          <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:apply-templates select="node()" mode="copy"/>
+            </xsl:otherwise>
+          </xsl:choose>
+      </xsl:for-each>
+    </xsl:when>
+    <xsl:when test="@mediaType = 'text/plain'">
+      <xsl:for-each select="wadl:doc">
+        <xsl:sort select="position()" data-type="number" order="descending"/>
+          <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:apply-templates select="node()" mode="copy"/>
+            </xsl:otherwise>
+          </xsl:choose>
+      </xsl:for-each>
+    </xsl:when>
     <xsl:otherwise>
-      Example for <xsl:value-of select="@mediaType"/> is available in /rest/v2/application.wadl
+      Example for <xsl:value-of select="@mediaType"/> is available in REST API.
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>


Mime
View raw message