001// Autogenerated Jamon implementation
002// /Users/petersomogyi/projects/hbase-upstream/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon
003
004package org.apache.hadoop.hbase.tmpl.regionserver;
005
006// 27, 1
007import java.util.*;
008// 28, 1
009import org.apache.hadoop.hbase.regionserver.HRegionServer;
010// 29, 1
011import org.apache.hadoop.hbase.client.RegionInfo;
012// 30, 1
013import org.apache.hadoop.hbase.ServerName;
014// 31, 1
015import org.apache.hadoop.hbase.HBaseConfiguration;
016// 32, 1
017import org.apache.hadoop.hbase.io.hfile.CacheConfig;
018// 33, 1
019import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
020// 34, 1
021import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo;
022// 35, 1
023import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
024
025public class RSStatusTmplImpl
026  extends org.jamon.AbstractTemplateImpl
027  implements org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.Intf
028
029{
030  private final HRegionServer regionServer;
031  private final String bcn;
032  private final String bcv;
033  private final String filter;
034  private final String format;
035  // 55, 1
036  
037  public String formatZKString() {
038    StringBuilder quorums = new StringBuilder();
039    String zkQuorum = regionServer.getZooKeeper().getQuorum();
040
041    if (null == zkQuorum) {
042      return quorums.toString();
043    }
044
045    String[] zks = zkQuorum.split(",");
046
047    if (zks.length == 0) {
048      return quorums.toString();
049    }
050
051    for(int i = 0; i < zks.length; ++i) {
052      quorums.append(zks[i].trim());
053
054      if (i != (zks.length - 1)) {
055        quorums.append("<br/>");
056      }
057    }
058
059    return quorums.toString();
060  }
061
062  protected static org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData p_implData)
063  {
064    if(! p_implData.getBcn__IsNotDefault())
065    {
066      p_implData.setBcn("");
067    }
068    if(! p_implData.getBcv__IsNotDefault())
069    {
070      p_implData.setBcv("");
071    }
072    if(! p_implData.getFilter__IsNotDefault())
073    {
074      p_implData.setFilter("general");
075    }
076    if(! p_implData.getFormat__IsNotDefault())
077    {
078      p_implData.setFormat("html");
079    }
080    return p_implData;
081  }
082  public RSStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData p_implData)
083  {
084    super(p_templateManager, __jamon_setOptionalArguments(p_implData));
085    regionServer = p_implData.getRegionServer();
086    bcn = p_implData.getBcn();
087    bcv = p_implData.getBcv();
088    filter = p_implData.getFilter();
089    format = p_implData.getFormat();
090  }
091  
092  @Override public void renderNoFlush(final java.io.Writer jamonWriter)
093    throws java.io.IOException
094  {
095    // 38, 1
096    if (format.equals("json") && bcn != null && bcn.length() > 0  )
097    {
098      // 38, 66
099      jamonWriter.write("\n  ");
100      // 39, 3
101      {
102        org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl __jamon__var_7 = new org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl(this.getTemplateManager());
103        __jamon__var_7.renderNoFlush(jamonWriter, new CacheConfig(regionServer.getConfiguration()), regionServer.getConfiguration(), bcn, bcv, regionServer.getBlockCache().orElse(null)  );
104      }
105      // 39, 210
106      jamonWriter.write("\n  ");
107      // 40, 3
108      return; 
109    }
110    // 41, 1
111    else if (format.equals("json") )
112    {
113      // 41, 34
114      jamonWriter.write("\n  ");
115      // 42, 3
116      {
117        org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_8 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
118        __jamon__var_8.setFilter(filter);
119        __jamon__var_8.setFormat("json" );
120        __jamon__var_8.renderNoFlush(jamonWriter);
121      }
122      // 42, 68
123      jamonWriter.write("\n  ");
124      // 43, 3
125      return; 
126    }
127    // 44, 7
128    jamonWriter.write("\n");
129    // 45, 1
130    
131  ServerInfo serverInfo = ProtobufUtil.getServerInfo(null, regionServer.getRSRpcServices());
132  ServerName serverName = ProtobufUtil.toServerName(serverInfo.getServerName());
133  List<RegionInfo> onlineRegions = ProtobufUtil.getOnlineRegions(regionServer.getRSRpcServices());
134  MasterAddressTracker masterAddressTracker = regionServer.getMasterAddressTracker();
135  ServerName masterServerName = masterAddressTracker == null ? null
136    : masterAddressTracker.getMasterAddress();
137  int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMasterInfoPort();
138
139    // 82, 1
140    jamonWriter.write("<!DOCTYPE html>\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <title>HBase Region Server: ");
141    // 87, 33
142    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter);
143    // 87, 63
144    jamonWriter.write("</title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"\">\n\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-fluid\">\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=\"/rs-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=\"/rs-status\">Home</a></li>\n                <li><a href=\"/processRS.jsp\">Process Metrics</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                <li><a href=\"/prof\">Profiler</a></li>\n                ");
145    // 117, 17
146    if (HBaseConfiguration.isShowConfInServlet())
147    {
148      // 117, 64
149      jamonWriter.write("\n                <li><a href=\"/conf\">HBase Configuration</a></li>\n                ");
150    }
151    // 119, 23
152    jamonWriter.write("\n            </ul>\n          </div><!--/.nav-collapse -->\n        </div>\n      </div>\n    </div>\n\n  <div class=\"container-fluid content\">\n    <div class=\"row inner_header\">\n        <div class=\"page-header\">\n            <h1>RegionServer <small>");
153    // 129, 37
154    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(serverName), jamonWriter);
155    // 129, 53
156    jamonWriter.write("</small></h1>\n        </div>\n    </div>\n    <div class=\"row\">\n\n    <section>\n    <h2>Server Metrics</h2>\n    ");
157    // 136, 5
158    {
159      org.apache.hadoop.hbase.tmpl.regionserver.ServerMetricsTmpl __jamon__var_9 = new org.apache.hadoop.hbase.tmpl.regionserver.ServerMetricsTmpl(this.getTemplateManager());
160      __jamon__var_9.renderNoFlush(jamonWriter, regionServer.getRegionServerMetrics().getRegionServerWrapper(), regionServer.getRpcServer().getMetrics().getHBaseServerWrapper());
161    }
162    // 137, 89
163    jamonWriter.write("\n    </section>\n\n    <section>\n    <h2>Block Cache</h2>\n    ");
164    // 142, 5
165    {
166      org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl __jamon__var_10 = new org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheTmpl(this.getTemplateManager());
167      __jamon__var_10.renderNoFlush(jamonWriter, new CacheConfig(regionServer.getConfiguration()), regionServer.getConfiguration(), regionServer.getBlockCache().orElse(null) );
168    }
169    // 142, 179
170    jamonWriter.write("\n    </section>\n\n    <section>\n    ");
171    // 146, 5
172    {
173      org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_11 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
174      __jamon__var_11.setFilter(filter);
175      __jamon__var_11.setParent("/rs-status" );
176      __jamon__var_11.renderNoFlush(jamonWriter);
177    }
178    // 146, 76
179    jamonWriter.write("\n    </section>\n\n    <section>\n    <h2>Regions</h2>\n    ");
180    // 151, 5
181    {
182      org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl __jamon__var_12 = new org.apache.hadoop.hbase.tmpl.regionserver.RegionListTmpl(this.getTemplateManager());
183      __jamon__var_12.renderNoFlush(jamonWriter, regionServer, onlineRegions);
184    }
185    // 151, 86
186    jamonWriter.write("\n    </section>\n\n    <section>\n    <h2>Replication Status</h1>\n    ");
187    // 156, 5
188    {
189      org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl __jamon__var_13 = new org.apache.hadoop.hbase.tmpl.regionserver.ReplicationStatusTmpl(this.getTemplateManager());
190      __jamon__var_13.renderNoFlush(jamonWriter, regionServer);
191    }
192    // 156, 62
193    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>");
194    // 169, 17
195    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getVersion()), jamonWriter);
196    // 169, 76
197    jamonWriter.write(", revision=");
198    // 169, 87
199    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getRevision()), jamonWriter);
200    // 169, 147
201    jamonWriter.write("</td>\n            <td>HBase version and revision</td>\n        </tr>\n        <tr>\n            <td>HBase Compiled</td>\n            <td>");
202    // 174, 17
203    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getDate()), jamonWriter);
204    // 174, 73
205    jamonWriter.write(", ");
206    // 174, 75
207    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getUser()), jamonWriter);
208    // 174, 131
209    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>");
210    // 179, 17
211    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getSrcChecksum()), jamonWriter);
212    // 179, 80
213    jamonWriter.write("</td>\n            <td>HBase source MD5 checksum</td>\n        </tr>\n        <tr>\n            <td>Hadoop Version</td>\n            <td>");
214    // 184, 17
215    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getVersion()), jamonWriter);
216    // 184, 70
217    jamonWriter.write(", revision=");
218    // 184, 81
219    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getRevision()), jamonWriter);
220    // 184, 135
221    jamonWriter.write("</td>\n            <td>Hadoop version and revision</td>\n        </tr>\n        <tr>\n            <td>Hadoop Compiled</td>\n            <td>");
222    // 189, 17
223    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getDate()), jamonWriter);
224    // 189, 67
225    jamonWriter.write(", ");
226    // 189, 69
227    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getUser()), jamonWriter);
228    // 189, 119
229    jamonWriter.write("</td>\n            <td>When Hadoop version was compiled and by whom</td>\n        </tr>\n        <tr>\n            <td>Hadoop Source Checksum</td>\n            <td>");
230    // 194, 17
231    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getSrcChecksum()), jamonWriter);
232    // 194, 74
233    jamonWriter.write("</td>\n            <td>Hadoop source MD5 checksum</td>\n        </tr>\n        <tr>\n            <td>ZooKeeper Client Version</td>\n            <td>");
234    // 199, 17
235    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getVersion()), jamonWriter);
236    // 199, 64
237    jamonWriter.write(", revision=");
238    // 199, 75
239    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getRevision()), jamonWriter);
240    // 199, 123
241    jamonWriter.write("</td>\n            <td>ZooKeeper client version and revision</td>\n        </tr>\n        <tr>\n            <td>ZooKeeper Client Compiled</td>\n            <td>");
242    // 204, 17
243    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.zookeeper.Version.getBuildDate()), jamonWriter);
244    // 204, 66
245    jamonWriter.write("</td>\n            <td>When ZooKeeper client version was compiled</td>\n        </tr>\n        <tr>\n            <td>ZooKeeper Quorum</td>\n            <td>");
246    // 210, 17
247    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(formatZKString()), jamonWriter);
248    // 210, 39
249    jamonWriter.write("</td>\n            <td>Addresses of all registered ZK servers</td>\n        </tr>\n        <tr>\n            <td>Coprocessors</td>\n            <td>");
250    // 215, 17
251    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(java.util.Arrays.toString(regionServer.getRegionServerCoprocessors())), jamonWriter);
252    // 215, 92
253    jamonWriter.write("</td>\n            <td>Coprocessors currently loaded by this regionserver</td>\n        </tr>\n        <tr>\n            <td>RS Start Time</td>\n            <td>");
254    // 220, 17
255    org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(new Date(regionServer.getStartcode())), jamonWriter);
256    // 220, 60
257    jamonWriter.write("</td>\n            <td>Date stamp of when this region server was started</td>\n        </tr>\n        <tr>\n            <td>HBase Master</td>\n            <td>\n                ");
258    // 226, 17
259    if (masterServerName == null )
260    {
261      // 226, 49
262      jamonWriter.write("\n                No master found\n                ");
263    }
264    // 228, 17
265    else
266    {
267      // 228, 24
268      jamonWriter.write("\n                ");
269      // 229, 17
270      
271                String host = masterServerName.getHostname() + ":" + infoPort;
272                String url = "//" + host + "/master-status";
273                
274      // 233, 17
275      jamonWriter.write("<a href=\"");
276      // 233, 26
277      org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(url), jamonWriter);
278      // 233, 35
279      jamonWriter.write("\">");
280      // 233, 37
281      org.jamon.escaping.Escaping.NONE.write(org.jamon.emit.StandardEmitter.valueOf(host), jamonWriter);
282      // 233, 47
283      jamonWriter.write("</a>\n                ");
284    }
285    // 234, 23
286    jamonWriter.write("\n            </td>\n            <td>Address of HBase Master</td>\n        </tr>\n    </table>\n    </section>\n    </div>\n</div>\n<script src=\"/static/js/jquery.min.js\" type=\"text/javascript\"></script>\n<script src=\"/static/js/jquery.tablesorter.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<script>\n$(document).ready(function()\n    {\n        $.tablesorter.addParser({\n            id: 'filesize',\n            is: function(s) {\n                return s.match(new RegExp( /([\\.0-9]+)\\ (B|KB|MB|GB|TB)/ ));\n            },\n            format: function(s) {\n                var suf = s.match(new RegExp( /(KB|B|GB|MB|TB)$/ ))[1];\n                var num = parseFloat(s.match( new RegExp( /([\\.0-9]+)\\ (B|KB|MB|GB|TB)/ ))[0]);\n                switch(suf) {\n                    case 'B':\n                        return num;\n                    case 'KB':\n                        return num * 1024;\n                    case 'MB':\n                        return num * 1024 * 1024;\n                    case 'GB':\n                        return num * 1024 * 1024 * 1024;\n                    case 'TB':\n                        return num * 1024 * 1024 * 1024 * 1024;\n                }\n            },\n            type: 'numeric'\n        });\n        $(\"#baseStatsTable\").tablesorter();\n        $(\"#requestStatsTable\").tablesorter();\n        $(\"#storeStatsTable\").tablesorter();\n        $(\"#compactionStatsTable\").tablesorter();\n        $(\"#memstoreStatsTable\").tablesorter();\n    }\n);\n</script>\n</body>\n</html>\n");
287  }
288  
289  
290}