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-770. Moved default dashboard population code to login.jsp. (Eric Yang)
Date Fri, 26 Jun 2015 22:00:08 GMT
Repository: chukwa
Updated Branches:
  refs/heads/master 384d3449c -> e29381f07


CHUKWA-770. Moved default dashboard population code to login.jsp. (Eric Yang)


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

Branch: refs/heads/master
Commit: e29381f07cb5c122ee43f887c6326e99652548f1
Parents: 384d344
Author: Eric Yang <eyang@apache.org>
Authored: Fri Jun 26 14:57:33 2015 -0700
Committer: Eric Yang <eyang@apache.org>
Committed: Fri Jun 26 14:58:42 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../chukwa/datastore/ChukwaHBaseStore.java      | 20 ++++++++++++++++++++
 .../chukwa/hicc/rest/WidgetController.java      |  1 -
 src/main/web/hicc/login.jsp                     |  4 ++++
 4 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/chukwa/blob/e29381f0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 26999a0..8192ffd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -50,6 +50,8 @@ Trunk (unreleased changes)
 
   BUGS
 
+    CHUKWA-770. Moved default dashboard population code to login.jsp. (Eric Yang)
+
     CHUKWA-766. Updated license on source files.  (Eric Yang)
 
     CHUKWA-764. Clean up multiple flavor of JSON usage.  (Eric Yang)

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e29381f0/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 cd8a15f..8075f4d 100644
--- a/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
+++ b/src/main/java/org/apache/hadoop/chukwa/datastore/ChukwaHBaseStore.java
@@ -784,8 +784,28 @@ public class ChukwaHBaseStore {
     return result;
   }
 
+  public static boolean isDefaultExists() {
+    boolean exists = false;
+    try {
+      getHBaseConnection();
+      Table table = connection.getTable(TableName.valueOf(CHUKWA_META));
+      Get dashboardTest = new Get(DASHBOARD_TYPE);
+      dashboardTest.addColumn(COMMON_FAMILY, "default".getBytes());
+      exists = table.exists(dashboardTest);
+      table.close();
+    } catch (Exception e) {
+      closeHBase();
+      LOG.error(ExceptionUtil.getStackTrace(e));
+    }
+    return exists;
+  }
+
   public static void populateDefaults() {
+    boolean defaultExists = isDefaultExists();
     try {
+      if(defaultExists) {
+        return;
+      }
       String hostname = InetAddress.getLocalHost().getHostName();
       // Populate example chart widgets
       String[] metrics = { "SystemMetrics.LoadAverage.1" };

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e29381f0/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 64afc19..5ea2dd0 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
@@ -53,7 +53,6 @@ public class WidgetController {
   @PostConstruct
   @Singleton
   public void init() {
-    ChukwaHBaseStore.populateDefaults();
   }
 
   @GET

http://git-wip-us.apache.org/repos/asf/chukwa/blob/e29381f0/src/main/web/hicc/login.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/login.jsp b/src/main/web/hicc/login.jsp
index 0f46b40..f0c1002 100644
--- a/src/main/web/hicc/login.jsp
+++ b/src/main/web/hicc/login.jsp
@@ -16,6 +16,10 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   --%>
+<%@ page import = "org.apache.hadoop.chukwa.datastore.ChukwaHBaseStore" %>
+<%
+  ChukwaHBaseStore.populateDefaults();
+%>
 <html>
 <head>
     <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />


Mime
View raw message