View Javadoc

1   // Autogenerated Jamon implementation
2   // /home/apurtell/src/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.master;
5   
6   // 32, 1
7   import java.util.*;
8   // 33, 1
9   import org.apache.hadoop.util.StringUtils;
10  // 34, 1
11  import org.apache.hadoop.hbase.util.Bytes;
12  // 35, 1
13  import org.apache.hadoop.hbase.util.JvmVersion;
14  // 36, 1
15  import org.apache.hadoop.hbase.util.FSUtils;
16  // 37, 1
17  import org.apache.hadoop.hbase.master.HMaster;
18  // 38, 1
19  import org.apache.hadoop.hbase.master.AssignmentManager;
20  // 39, 1
21  import org.apache.hadoop.hbase.master.ServerManager;
22  // 40, 1
23  import org.apache.hadoop.hbase.HConstants;
24  // 41, 1
25  import org.apache.hadoop.hbase.NamespaceDescriptor;
26  // 42, 1
27  import org.apache.hadoop.hbase.ServerLoad;
28  // 43, 1
29  import org.apache.hadoop.hbase.ServerName;
30  // 44, 1
31  import org.apache.hadoop.hbase.client.Admin;
32  // 45, 1
33  import org.apache.hadoop.hbase.client.HConnectionManager;
34  // 46, 1
35  import org.apache.hadoop.hbase.HRegionInfo;
36  // 47, 1
37  import org.apache.hadoop.hbase.master.RegionState;
38  // 48, 1
39  import org.apache.hadoop.hbase.HTableDescriptor;
40  // 49, 1
41  import org.apache.hadoop.hbase.HBaseConfiguration;
42  // 50, 1
43  import org.apache.hadoop.hbase.TableName;
44  // 51, 1
45  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
46  // 52, 1
47  import org.apache.hadoop.hbase.master.DeadServer;
48  // 53, 1
49  import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
50  // 54, 1
51  import org.apache.hadoop.hbase.security.visibility.VisibilityConstants;
52  // 55, 1
53  import org.apache.hadoop.hbase.security.access.AccessControlLists;
54  
55  public class MasterStatusTmplImpl
56    extends org.jamon.AbstractTemplateImpl
57    implements org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.Intf
58  
59  {
60    private final HMaster master;
61    private final Map<String,Integer> frags;
62    private final AssignmentManager assignmentManager;
63    private final Set<ServerName> deadServers;
64    private final ServerName metaLocation;
65    private final ServerManager serverManager;
66    private final List<ServerName> servers;
67    private final String format;
68    private final boolean catalogJanitorEnabled;
69    private final String filter;
70    // 67, 1
71    
72    public String formatZKString() {
73      StringBuilder quorums = new StringBuilder();
74      String zkQuorum = master.getZooKeeper().getQuorum();
75  
76      if (null == zkQuorum) {
77        return quorums.toString();
78      }
79  
80      String[] zks = zkQuorum.split(",");
81  
82      if (zks.length == 0) {
83        return quorums.toString();
84      }
85  
86      for(int i = 0; i < zks.length; ++i) {
87        quorums.append(zks[i].trim()).append(",");
88  
89        if ((i+1) % 4 == 0 && i != (zks.length - 1)) {
90          quorums.append("<br/>");
91        }
92      }
93  
94      quorums.setLength(quorums.length() - 1);
95      return quorums.toString();
96    }
97  
98    protected static org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData p_implData)
99    {
100     if(! p_implData.getFrags__IsNotDefault())
101     {
102       p_implData.setFrags(null);
103     }
104     if(! p_implData.getAssignmentManager__IsNotDefault())
105     {
106       p_implData.setAssignmentManager(null);
107     }
108     if(! p_implData.getDeadServers__IsNotDefault())
109     {
110       p_implData.setDeadServers(null);
111     }
112     if(! p_implData.getMetaLocation__IsNotDefault())
113     {
114       p_implData.setMetaLocation(null);
115     }
116     if(! p_implData.getServerManager__IsNotDefault())
117     {
118       p_implData.setServerManager(null);
119     }
120     if(! p_implData.getServers__IsNotDefault())
121     {
122       p_implData.setServers(null);
123     }
124     if(! p_implData.getFormat__IsNotDefault())
125     {
126       p_implData.setFormat("html");
127     }
128     if(! p_implData.getCatalogJanitorEnabled__IsNotDefault())
129     {
130       p_implData.setCatalogJanitorEnabled(true);
131     }
132     if(! p_implData.getFilter__IsNotDefault())
133     {
134       p_implData.setFilter("general");
135     }
136     return p_implData;
137   }
138   public MasterStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl.ImplData p_implData)
139   {
140     super(p_templateManager, __jamon_setOptionalArguments(p_implData));
141     master = p_implData.getMaster();
142     frags = p_implData.getFrags();
143     assignmentManager = p_implData.getAssignmentManager();
144     deadServers = p_implData.getDeadServers();
145     metaLocation = p_implData.getMetaLocation();
146     serverManager = p_implData.getServerManager();
147     servers = p_implData.getServers();
148     format = p_implData.getFormat();
149     catalogJanitorEnabled = p_implData.getCatalogJanitorEnabled();
150     filter = p_implData.getFilter();
151   }
152   
153   public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
154     throws java.io.IOException
155   {
156     // 58, 1
157     if (format.equals("json") )
158     {
159       // 58, 30
160       jamonWriter.write("\n  ");
161       // 59, 3
162       {
163         org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_0 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
164         __jamon__var_0.setFilter(filter);
165         __jamon__var_0.setFormat("json" );
166         __jamon__var_0.renderNoFlush(jamonWriter);
167       }
168       // 59, 68
169       jamonWriter.write("\n  ");
170       // 60, 3
171       return; 
172     }
173     // 61, 7
174     jamonWriter.write("\n");
175     // 62, 1
176     
177 ServerManager serverManager = master.getServerManager();
178 AssignmentManager assignmentManager = master.getAssignmentManager();
179 
180     // 95, 1
181     jamonWriter.write("<!--[if IE]>\n<!DOCTYPE html>\n<![endif]-->\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <title>Master: ");
182     // 102, 20
183     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter);
184     // 102, 62
185     jamonWriter.write("</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"\">\n    <link href=\"/static/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/hbase.css\" rel=\"stylesheet\">\n  </head>\n\n  <body>\n\n    <div class=\"navbar  navbar-fixed-top navbar-default\">\n        <div class=\"container\">\n            <div class=\"navbar-header\">\n                <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                </button>\n                <a class=\"navbar-brand\" href=\"/master-status\"><img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/></a>\n            </div>\n            <div class=\"collapse navbar-collapse\">\n                <ul class=\"nav navbar-nav\">\n                <li class=\"active\"><a href=\"/\">Home</a></li>\n                <li><a href=\"/tablesDetailed.jsp\">Table Details</a></li>\n                <li><a href=\"/logs/\">Local Logs</a></li>\n                <li><a href=\"/logLevel\">Log Level</a></li>\n                <li><a href=\"/dump\">Debug Dump</a></li>\n                <li><a href=\"/jmx\">Metrics Dump</a></li>\n                ");
186     // 130, 17
187     if (HBaseConfiguration.isShowConfInServlet())
188     {
189       // 130, 64
190       jamonWriter.write("\n                <li><a href=\"/conf\">HBase Configuration</a></li>\n                ");
191     }
192     // 132, 23
193     jamonWriter.write("\n               </ul>\n            </div><!--/.nav-collapse -->\n        </div>\n    </div>\n\n    <div class=\"container\">\n\t");
194     // 139, 2
195     if (master.isActiveMaster() )
196     {
197       // 139, 33
198       jamonWriter.write("\n        <div class=\"row inner_header\">\n            <div class=\"page-header\">\n                <h1>Master <small>");
199       // 142, 35
200       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter);
201       // 142, 77
202       jamonWriter.write(" </small></h1>\n            </div>\n        </div>\n\n        <div class=\"row\">\n        <!-- Various warnings that cluster admins should be aware of -->\n        ");
203       // 148, 9
204       if (JvmVersion.isBadJvmVersion() )
205       {
206         // 148, 45
207         jamonWriter.write("\n          <div class=\"alert alert-error\">\n          Your current JVM version ");
208         // 150, 36
209         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(System.getProperty("java.version")), jamonWriter);
210         // 150, 76
211         jamonWriter.write(" is known to be\n          unstable with HBase. Please see the\n          <a href=\"http://wiki.apache.org/hadoop/Hbase/Troubleshooting#A18\">HBase wiki</a>\n          for details.\n          </div>\n        ");
212       }
213       // 155, 15
214       jamonWriter.write("\n        ");
215       // 156, 9
216       if (master.isInitialized() && !catalogJanitorEnabled )
217       {
218         // 156, 65
219         jamonWriter.write("\n          <div class=\"alert alert-error\">\n          Please note that your cluster is running with the CatalogJanitor disabled. It can be\n          re-enabled from the hbase shell by running the command 'catalogjanitor_switch true'\n          </div>\n        ");
220       }
221       // 161, 15
222       jamonWriter.write("\n\n        <section>\n            <h2>Region Servers</h2>\n            ");
223       // 165, 13
224       {
225         org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl __jamon__var_1 = new org.apache.hadoop.hbase.tmpl.master.RegionServerListTmpl(this.getTemplateManager());
226         __jamon__var_1.setServers(servers );
227         __jamon__var_1.renderNoFlush(jamonWriter, master);
228       }
229       // 165, 74
230       jamonWriter.write("\n\n            ");
231       // 167, 13
232       if ((deadServers != null) )
233       {
234         // 167, 42
235         jamonWriter.write("\n                ");
236         // 168, 17
237         {
238           // 168, 17
239           __jamon_innerUnit__deadRegionServers(jamonWriter);
240         }
241         // 168, 40
242         jamonWriter.write("\n            ");
243       }
244       // 169, 19
245       jamonWriter.write("\n        </section>\n        <section>\n            ");
246       // 172, 13
247       {
248         org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl __jamon__var_2 = new org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl(this.getTemplateManager());
249         __jamon__var_2.renderNoFlush(jamonWriter, master );
250       }
251       // 172, 58
252       jamonWriter.write("\n        </section>\n        <section>\n            <h2>Tables</h2>\n            <div class=\"tabbable\">\n                <ul class=\"nav nav-pills\">\n                    <li class=\"active\">\n                        <a href=\"#tab_userTables\" data-toggle=\"tab\">User Tables</a>\n                    </li>\n                    <li class=\"\">\n                        <a href=\"#tab_catalogTables\" data-toggle=\"tab\">System Tables</a>\n                    </li>\n                    <li class=\"\">\n                        <a href=\"#tab_userSnapshots\" data-toggle=\"tab\">Snapshots</a>\n                    </li>\n                </ul>\n                <div class=\"tab-content\" style=\"padding-bottom: 9px; border-bottom: 1px solid #ddd;\">\n                    <div class=\"tab-pane active\" id=\"tab_userTables\">\n                        ");
253       // 190, 25
254       if ((metaLocation != null) )
255       {
256         // 190, 55
257         jamonWriter.write("\n                            ");
258         // 191, 29
259         {
260           // 191, 29
261           __jamon_innerUnit__userTables(jamonWriter);
262         }
263         // 191, 45
264         jamonWriter.write("\n                        ");
265       }
266       // 192, 31
267       jamonWriter.write("\n                    </div>\n                    <div class=\"tab-pane\" id=\"tab_catalogTables\">\n                        ");
268       // 195, 25
269       if ((metaLocation != null) )
270       {
271         // 195, 55
272         jamonWriter.write("\n                            ");
273         // 196, 29
274         {
275           // 196, 29
276           __jamon_innerUnit__catalogTables(jamonWriter);
277         }
278         // 196, 48
279         jamonWriter.write("\n                        ");
280       }
281       // 197, 31
282       jamonWriter.write("\n                    </div>\n                    <div class=\"tab-pane\" id=\"tab_userSnapshots\">\n                        ");
283       // 200, 25
284       {
285         // 200, 25
286         __jamon_innerUnit__userSnapshots(jamonWriter);
287       }
288       // 200, 44
289       jamonWriter.write("\n                    </div>\n                </div>\n            </div>\n        </section>\n        ");
290       // 205, 9
291       if (master.getAssignmentManager() != null )
292       {
293         // 205, 54
294         jamonWriter.write("\n        ");
295         // 206, 9
296         {
297           org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl __jamon__var_3 = new org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl(this.getTemplateManager());
298           __jamon__var_3.renderNoFlush(jamonWriter, master.getAssignmentManager());
299         }
300         // 206, 90
301         jamonWriter.write("\n        ");
302       }
303       // 207, 15
304       jamonWriter.write("\n\t");
305     }
306     // 208, 2
307     else
308     {
309       // 208, 9
310       jamonWriter.write("\n        <section>\n            ");
311       // 210, 13
312       {
313         org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl __jamon__var_4 = new org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl(this.getTemplateManager());
314         __jamon__var_4.renderNoFlush(jamonWriter, master );
315       }
316       // 210, 58
317       jamonWriter.write("\n        </section>\n\t");
318     }
319     // 212, 8
320     jamonWriter.write("    \n\n\n        <section>\n            ");
321     // 216, 13
322     {
323       org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_5 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
324       __jamon__var_5.setFilter(filter );
325       __jamon__var_5.renderNoFlush(jamonWriter);
326     }
327     // 216, 61
328     jamonWriter.write("\n        </section>\n\n        <section>\n            <h2>Software Attributes</h2>\n            <table id=\"attributes_table\" class=\"table table-striped\">\n                <tr>\n                    <th>Attribute Name</th>\n                    <th>Value</th>\n                    <th>Description</th>\n                </tr>\n                <tr>\n                    <td>HBase Version</td>\n                    <td>");
329     // 229, 25
330     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getVersion()), jamonWriter);
331     // 229, 84
332     jamonWriter.write(", revision=");
333     // 229, 95
334     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getRevision()), jamonWriter);
335     // 229, 155
336     jamonWriter.write("</td><td>HBase version and revision</td>\n                </tr>\n                <tr>\n                    <td>HBase Compiled</td>\n                    <td>");
337     // 233, 25
338     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getDate()), jamonWriter);
339     // 233, 81
340     jamonWriter.write(", ");
341     // 233, 83
342     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getUser()), jamonWriter);
343     // 233, 139
344     jamonWriter.write("</td>\n                    <td>When HBase version was compiled and by whom</td>\n                </tr>\n                <tr>\n                    <td>HBase Source Checksum</td>\n                    <td>");
345     // 238, 25
346     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getSrcChecksum()), jamonWriter);
347     // 238, 82
348     jamonWriter.write("</td>\n                    <td>HBase source MD5 checksum</td>\n                </tr>\n                <tr>\n                    <td>Hadoop Version</td>\n                    <td>");
349     // 243, 25
350     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getVersion()), jamonWriter);
351     // 243, 78
352     jamonWriter.write(", revision=");
353     // 243, 89
354     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getRevision()), jamonWriter);
355     // 243, 143
356     jamonWriter.write("</td>\n                    <td>Hadoop version and revision</td>\n                </tr>\n                <tr>\n                    <td>Hadoop Compiled</td>\n                    <td>");
357     // 248, 25
358     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getDate()), jamonWriter);
359     // 248, 75
360     jamonWriter.write(", ");
361     // 248, 77
362     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getUser()), jamonWriter);
363     // 248, 127
364     jamonWriter.write("</td>\n                    <td>When Hadoop version was compiled and by whom</td>\n                </tr>\n                <tr>\n                    <td>Zookeeper Quorum</td>\n                    <td> ");
365     // 254, 26
366     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(formatZKString()), jamonWriter);
367     // 254, 48
368     jamonWriter.write(" </td>\n                    <td>Addresses of all registered ZK servers. For more, see <a href=\"/zk.jsp\">zk dump</a>.</td>\n                </tr>\n                <tr>\n                    <td>Zookeeper Base Path</td>\n                    <td> ");
369     // 259, 26
370     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getZooKeeper().getBaseZNode()), jamonWriter);
371     // 259, 68
372     jamonWriter.write("</td>\n                    <td>Root node of this cluster in ZK.</td>\n                </tr>\n                <tr>\n                    <td>HBase Root Directory</td>\n                    <td>");
373     // 264, 25
374     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(FSUtils.getRootDir(master.getConfiguration()).toString()), jamonWriter);
375     // 264, 87
376     jamonWriter.write("</td>\n                    <td>Location of HBase home directory</td>\n                </tr>\n                <tr>\n                    <td>HMaster Start Time</td>\n                    <td>");
377     // 269, 25
378     org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(master.getMasterStartTime())), jamonWriter);
379     // 269, 68
380     jamonWriter.write("</td>\n                    <td>Date stamp of when this HMaster was started</td>\n                </tr>\n                ");
381     // 272, 17
382     if (master.isActiveMaster() )
383     {
384       // 272, 48
385       jamonWriter.write("\n\t                <tr>\n\t                    <td>HMaster Active Time</td>\n\t                    <td>");
386       // 275, 26
387       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(master.getMasterActiveTime())), jamonWriter);
388       // 275, 70
389       jamonWriter.write("</td>\n\t                    <td>Date stamp of when this HMaster became active</td>\n\t                </tr>\n\t                <tr>\n\t                    <td>HBase Cluster ID</td>\n\t                    <td>");
390       // 280, 26
391       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getClusterId() != null ? master.getClusterId() : "Not set"), jamonWriter);
392       // 280, 97
393       jamonWriter.write("</td>\n\t                    <td>Unique identifier generated for each HBase cluster</td>\n\t                </tr>\n\t                <tr>\n\t                    <td>Load average</td>\n\t                    <td>");
394       // 285, 26
395       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerManager() == null ? "0.00" :
396 	                      StringUtils.limitDecimalTo2(master.getServerManager().getAverageLoad())), jamonWriter);
397       // 286, 98
398       jamonWriter.write("</td>\n\t                    <td>Average number of regions per regionserver. Naive computation.</td>\n\t                </tr>\n\t                ");
399       // 289, 18
400       if (frags != null )
401       {
402         // 289, 39
403         jamonWriter.write("\n\t                <tr>\n\t                    <td>Fragmentation</td>\n\t                    <td>");
404         // 292, 26
405         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a"), jamonWriter);
406         // 292, 108
407         jamonWriter.write("</td>\n\t                    <td>Overall fragmentation of all tables, including hbase:meta</td>\n\t                </tr>\n\t                ");
408       }
409       // 295, 24
410       jamonWriter.write("\n\t                <tr>\n\t                    <td>Coprocessors</td>\n\t                    <td>");
411       // 298, 26
412       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(master.getMasterCoprocessorHost() == null ? "[]" :
413 	                      java.util.Arrays.toString(master.getMasterCoprocessors())), jamonWriter);
414       // 299, 84
415       jamonWriter.write("</td>\n\t                    <td>Coprocessors currently loaded by the master</td>\n\t                </tr>\n                ");
416     }
417     // 302, 23
418     jamonWriter.write("\n            </table>\n        </section>\n        </div>\n    </div> <!-- /container -->\n\n    <script src=\"/static/js/jquery.min.js\" type=\"text/javascript\"></script>\n    <script src=\"/static/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n    <script src=\"/static/js/tab.js\" type=\"text/javascript\"></script>\n  </body>\n</html>\n\n");
419   }
420   
421   
422   // 417, 1
423   private void __jamon_innerUnit__userSnapshots(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
424     throws java.io.IOException
425   {
426     // 418, 1
427     
428    List<SnapshotDescription> snapshots = null;
429    try (Admin admin = master.getConnection().getAdmin()) {
430      snapshots = master.isInitialized() ? admin.listSnapshots() : null;
431    }
432 
433     // 424, 1
434     if ((snapshots != null && snapshots.size() > 0))
435     {
436       // 424, 51
437       jamonWriter.write("\n<table class=\"table table-striped\">\n    <tr>\n        <th>Snapshot Name</th>\n        <th>Table</th>\n        <th>Creation Time</th>\n    </tr>\n    ");
438       // 431, 5
439       for (SnapshotDescription snapshotDesc : snapshots)
440       {
441         // 431, 57
442         jamonWriter.write("\n    ");
443         // 432, 5
444         
445         TableName snapshotTable = TableName.valueOf(snapshotDesc.getTable());
446     
447         // 435, 5
448         jamonWriter.write("<tr>\n        <td><a href=\"snapshot.jsp?name=");
449         // 436, 40
450         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotDesc.getName()), jamonWriter);
451         // 436, 68
452         jamonWriter.write("\">");
453         // 436, 70
454         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotDesc.getName()), jamonWriter);
455         // 436, 98
456         jamonWriter.write("</a> </td>\n        <td><a href=\"table.jsp?name=");
457         // 437, 37
458         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotTable.getNameAsString()), jamonWriter);
459         // 437, 74
460         jamonWriter.write("\">");
461         // 437, 76
462         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshotTable.getNameAsString()), jamonWriter);
463         // 437, 113
464         jamonWriter.write("</a>\n        </td>\n        <td>");
465         // 439, 13
466         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(snapshotDesc.getCreationTime())), jamonWriter);
467         // 439, 59
468         jamonWriter.write("</td>\n    </tr>\n    ");
469       }
470       // 441, 12
471       jamonWriter.write("\n    <p>");
472       // 442, 8
473       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(snapshots.size()), jamonWriter);
474       // 442, 30
475       jamonWriter.write(" snapshot(s) in set.</p>\n</table>\n");
476     }
477     // 444, 7
478     jamonWriter.write("\n");
479   }
480   
481   
482   // 314, 1
483   private void __jamon_innerUnit__catalogTables(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
484     throws java.io.IOException
485   {
486     // 315, 1
487     
488  HTableDescriptor[] sysTables = null;
489  try (Admin admin = master.getConnection().getAdmin()) {
490    sysTables = master.isInitialized() ? admin.listTableDescriptorsByNamespace(
491      NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR) : null;
492  }
493 
494     // 322, 1
495     if ((sysTables != null && sysTables.length > 0))
496     {
497       // 322, 51
498       jamonWriter.write("\n<table class=\"table table-striped\">\n<tr>\n    <th>Table Name</th>\n    ");
499       // 326, 5
500       if ((frags != null) )
501       {
502         // 326, 28
503         jamonWriter.write("\n        <th title=\"Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.\">Frag.</th>\n    ");
504       }
505       // 328, 11
506       jamonWriter.write("\n    <th>Description</th>\n</tr>\n");
507       // 331, 1
508       for (HTableDescriptor systemTable : sysTables)
509       {
510         // 331, 49
511         jamonWriter.write("\n<tr>\n");
512         // 333, 1
513         TableName tableName = systemTable.getTableName();
514         // 334, 5
515         jamonWriter.write("<td><a href=\"table.jsp?name=");
516         // 334, 33
517         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName), jamonWriter);
518         // 334, 48
519         jamonWriter.write("\">");
520         // 334, 50
521         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tableName), jamonWriter);
522         // 334, 65
523         jamonWriter.write("</a></td>\n    ");
524         // 335, 5
525         if ((frags != null))
526         {
527           // 335, 27
528           jamonWriter.write("\n        <td align=\"center\">");
529           // 336, 28
530           org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString())
531         .intValue() + "%" : "n/a"), jamonWriter);
532           // 337, 37
533           jamonWriter.write("</td>\n    ");
534         }
535         // 338, 11
536         jamonWriter.write("\n    ");
537         // 339, 5
538         String description = null;
539         if (tableName.equals(TableName.META_TABLE_NAME)){
540             description = "The hbase:meta table holds references to all User Table regions";
541         } else if (tableName.equals(AccessControlLists.ACL_TABLE_NAME)){
542             description = "The hbase:acl table holds information about acl";
543 	 } else if (tableName.equals(VisibilityConstants.LABELS_TABLE_NAME)){
544 	     description = "The hbase:labels table holds information about visibility labels";
545         } else {
546             description = "The .NAMESPACE. table holds information about namespaces.";
547         }
548     
549         // 350, 5
550         jamonWriter.write("<td>");
551         // 350, 9
552         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(description), jamonWriter);
553         // 350, 26
554         jamonWriter.write("</td>\n</tr>\n");
555       }
556       // 352, 8
557       jamonWriter.write("\n</table>\n");
558     }
559     // 354, 7
560     jamonWriter.write("\n");
561   }
562   
563   
564   // 357, 1
565   private void __jamon_innerUnit__userTables(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
566     throws java.io.IOException
567   {
568     // 358, 1
569     
570    HTableDescriptor[] tables = null; 
571    try (Admin admin = master.getConnection().getAdmin()) {
572      tables = master.isInitialized() ? admin.listTables() : null;
573    }
574 
575     // 364, 1
576     if ((tables != null && tables.length > 0))
577     {
578       // 364, 45
579       jamonWriter.write("\n<table class=\"table table-striped\">\n    <tr>\n        <th>Namespace</th>\n        <th>Table Name</th>\n        ");
580       // 369, 9
581       if ((frags != null) )
582       {
583         // 369, 32
584         jamonWriter.write("\n            <th title=\"Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.\">Frag.</th>\n        ");
585       }
586       // 371, 15
587       jamonWriter.write("\n        <th>Online Regions</th>\n        <th>Offline Regions</th>\n        <th>Failed Regions</th>\n        <th>Split Regions</th>\n        <th>Other Regions</th>\n        <th>Description</th>\n    </tr>\n    ");
588       // 379, 5
589       for (HTableDescriptor htDesc : tables)
590       {
591         // 379, 45
592         jamonWriter.write("\n    ");
593         // 380, 5
594         
595       Map<RegionState.State, List<HRegionInfo>> tableRegions =
596           master.getAssignmentManager().getRegionStates()
597             .getRegionByStateOfTable(htDesc.getTableName());
598       int openRegionsCount = tableRegions.get(RegionState.State.OPEN).size();
599       int offlineRegionsCount = tableRegions.get(RegionState.State.OFFLINE).size();
600       int splitRegionsCount = tableRegions.get(RegionState.State.SPLIT).size();
601       int failedRegionsCount = tableRegions.get(RegionState.State.FAILED_OPEN).size()
602              + tableRegions.get(RegionState.State.FAILED_CLOSE).size();
603       int otherRegionsCount = 0;
604       for (List<HRegionInfo> list: tableRegions.values()) {
605          otherRegionsCount += list.size();
606       }
607       // now subtract known states
608       otherRegionsCount = otherRegionsCount - openRegionsCount
609                      - failedRegionsCount - offlineRegionsCount
610                      - splitRegionsCount;
611     
612         // 398, 5
613         jamonWriter.write("<tr>\n        <td>");
614         // 399, 13
615         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(htDesc.getTableName().getNamespaceAsString()), jamonWriter);
616         // 399, 63
617         jamonWriter.write("</td>\n        <td><a href=table.jsp?name=");
618         // 400, 36
619         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(htDesc.getTableName().getNameAsString()), jamonWriter);
620         // 400, 81
621         jamonWriter.write(">");
622         // 400, 82
623         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(htDesc.getTableName().getQualifierAsString()), jamonWriter);
624         // 400, 132
625         jamonWriter.write("</a> </td>\n        ");
626         // 401, 9
627         if ((frags != null) )
628         {
629           // 401, 32
630           jamonWriter.write("\n            <td align=\"center\">");
631           // 402, 32
632           org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(frags.get(htDesc.getTableName().getNameAsString()) != null ? frags.get(htDesc.getTableName().getQualifierAsString()).intValue() + "%" : "n/a"), jamonWriter);
633           // 402, 179
634           jamonWriter.write("</td>\n        ");
635         }
636         // 403, 15
637         jamonWriter.write("\n        <td>");
638         // 404, 13
639         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(openRegionsCount), jamonWriter);
640         // 404, 35
641         jamonWriter.write("</td>\n        <td>");
642         // 405, 13
643         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(offlineRegionsCount), jamonWriter);
644         // 405, 38
645         jamonWriter.write("</td>\n        <td>");
646         // 406, 13
647         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(failedRegionsCount), jamonWriter);
648         // 406, 37
649         jamonWriter.write("</td>\n        <td>");
650         // 407, 13
651         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(splitRegionsCount), jamonWriter);
652         // 407, 36
653         jamonWriter.write("</td>\n        <td>");
654         // 408, 13
655         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(otherRegionsCount), jamonWriter);
656         // 408, 36
657         jamonWriter.write("</td>\n        <td>");
658         // 409, 13
659         org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(htDesc.toStringCustomizedValues()), jamonWriter);
660         // 409, 52
661         jamonWriter.write("</td>\n    </tr>\n    ");
662       }
663       // 411, 12
664       jamonWriter.write("\n    <p>");
665       // 412, 8
666       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(tables.length), jamonWriter);
667       // 412, 27
668       jamonWriter.write(" table(s) in set. [<a href=tablesDetailed.jsp>Details</a>]</p>\n</table>\n");
669     }
670     // 414, 7
671     jamonWriter.write("\n");
672   }
673   
674   
675   // 448, 1
676   private void __jamon_innerUnit__deadRegionServers(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
677     throws java.io.IOException
678   {
679     // 450, 1
680     if ((deadServers != null && deadServers.size() > 0))
681     {
682       // 450, 55
683       jamonWriter.write("\n<h2>Dead Region Servers</h2>\n<table class=\"table table-striped\">\n    <tr>\n        <th></th>\n        <th>ServerName</th>\n        <th>Stop time</th>\n    </tr>\n    ");
684       // 458, 5
685       
686        DeadServer deadServerUtil = master.getServerManager().getDeadServers();
687        ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]);
688          Arrays.sort(deadServerNames);
689          for (ServerName deadServerName: deadServerNames) {
690     
691       // 464, 5
692       jamonWriter.write("<tr>\n    \t<th></th>\n        <td>");
693       // 466, 13
694       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServerName), jamonWriter);
695       // 466, 33
696       jamonWriter.write("</td>\n        <td>");
697       // 467, 13
698       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServerUtil.getTimeOfDeath(deadServerName)), jamonWriter);
699       // 467, 64
700       jamonWriter.write("</td>\n    </tr>\n    ");
701       // 469, 5
702       
703         }
704     
705       // 472, 5
706       jamonWriter.write("<tr>\n        <th>Total: </th>\n        <td>servers: ");
707       // 474, 22
708       org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(deadServers.size()), jamonWriter);
709       // 474, 46
710       jamonWriter.write("</td>\n        <th></th>\n    </tr>\n</table>\n");
711     }
712     // 478, 7
713     jamonWriter.write("\n");
714   }
715   
716   
717 }