View Javadoc

1   // Autogenerated Jamon implementation
2   // /var/tmp/hbase-0.94.16/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.regionserver;
5   
6   // 26, 1
7   import java.util.*;
8   // 27, 1
9   import java.io.IOException;
10  // 28, 1
11  import org.apache.hadoop.io.Text;
12  // 29, 1
13  import org.apache.hadoop.hbase.regionserver.HRegionServer;
14  // 30, 1
15  import org.apache.hadoop.hbase.regionserver.HRegion;
16  // 31, 1
17  import org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics;
18  // 32, 1
19  import org.apache.hadoop.hbase.util.Bytes;
20  // 33, 1
21  import org.apache.hadoop.hbase.HConstants;
22  // 34, 1
23  import org.apache.hadoop.hbase.HServerInfo;
24  // 35, 1
25  import org.apache.hadoop.hbase.HServerLoad;
26  // 36, 1
27  import org.apache.hadoop.hbase.HRegionInfo;
28  // 37, 1
29  import org.apache.hadoop.hbase.ServerName;
30  // 38, 1
31  import org.apache.hadoop.hbase.HBaseConfiguration;
32  
33  public class RSStatusTmplImpl
34    extends org.jamon.AbstractTemplateImpl
35    implements org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.Intf
36  
37  {
38    private final HRegionServer regionServer;
39    private final String filter;
40    private final String format;
41    protected static org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData p_implData)
42    {
43      if(! p_implData.getFilter__IsNotDefault())
44      {
45        p_implData.setFilter("general");
46      }
47      if(! p_implData.getFormat__IsNotDefault())
48      {
49        p_implData.setFormat("html");
50      }
51      return p_implData;
52    }
53    public RSStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl.ImplData p_implData)
54    {
55      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
56      regionServer = p_implData.getRegionServer();
57      filter = p_implData.getFilter();
58      format = p_implData.getFormat();
59    }
60    
61    public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
62      throws java.io.IOException
63    {
64      // 40, 1
65      if (format.equals("json") )
66      {
67        // 40, 30
68        jamonWriter.write("\n  ");
69        // 41, 3
70        {
71          org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_0 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
72          __jamon__var_0.setFormat("json" );
73          __jamon__var_0.setFilter(filter);
74          __jamon__var_0.renderNoFlush(jamonWriter);
75        }
76        // 41, 68
77        jamonWriter.write("\n  ");
78        // 42, 3
79        return; 
80      }
81      // 43, 7
82      jamonWriter.write("\n");
83      // 44, 1
84      
85    HServerInfo serverInfo = null;
86    ServerName serverName = null;
87    try {
88      serverInfo = regionServer.getHServerInfo();
89      serverName = regionServer.getServerName();
90    } catch (IOException e) {
91      e.printStackTrace();
92    }
93    RegionServerMetrics metrics = regionServer.getMetrics();
94    List<HRegionInfo> onlineRegions = regionServer.getOnlineRegions();
95    int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval", 3000)/1000;
96    int masterInfoPort = regionServer.getConfiguration().getInt("hbase.master.info.port", 60010);
97  
98      // 58, 1
99      jamonWriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!-- Commenting out DOCTYPE so our blue outline shows on hadoop 0.20.205.0, etc.\n     See tail of HBASE-2110 for explaination.\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n-->\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n<title>HBase Region Server: ");
100     // 66, 29
101     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName), jamonWriter);
102     // 66, 45
103     jamonWriter.write(":");
104     // 66, 46
105     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverInfo.getServerAddress().getPort()), jamonWriter);
106     // 66, 91
107     jamonWriter.write("</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hbase.css\" />\n</head>\n\n<body>\n<a id=\"logo\" href=\"http://wiki.apache.org/lucene-hadoop/Hbase\"><img src=\"/static/hbase_logo.png\" alt=\"HBase Logo\" title=\"HBase Logo\" /></a>\n<h1 id=\"page_title\">RegionServer: ");
108     // 72, 35
109     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName), jamonWriter);
110     // 72, 51
111     jamonWriter.write("</h1>\n<p id=\"links_menu\">\n  <a href=\"/logs/\">Local logs</a>,\n  <a href=\"/stacks\">Thread Dump</a>,\n  <a href=\"/logLevel\">Log Level</a>,\n  <a href=\"/dump\">Debug dump</a>,\n");
112     // 78, 1
113     if (HBaseConfiguration.isShowConfInServlet() )
114     {
115       // 78, 49
116       jamonWriter.write("\n  <a href=\"/conf\">HBase Configuration</a>\n");
117     }
118     // 80, 7
119     jamonWriter.write("\n</p>\n<hr id=\"head_rule\" />\n\n<h2>Attributes</h2>\n<table id=\"attributes_table\">\n<col style=\"width: 10%;\"/>\n<col />\n<col style=\"width: 20%;\"/>\n<tr><th>Attribute Name</th><th>Value</th><th>Description</th></tr>\n<tr><td>HBase Version</td><td>");
120     // 90, 31
121     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getVersion()), jamonWriter);
122     // 90, 90
123     jamonWriter.write(", r");
124     // 90, 93
125     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getRevision()), jamonWriter);
126     // 90, 153
127     jamonWriter.write("</td><td>HBase version and revision</td></tr>\n<tr><td>HBase Compiled</td><td>");
128     // 91, 32
129     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getDate()), jamonWriter);
130     // 91, 88
131     jamonWriter.write(", ");
132     // 91, 90
133     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getUser()), jamonWriter);
134     // 91, 146
135     jamonWriter.write("</td><td>When HBase version was compiled and by whom</td></tr>\n<tr><td>Metrics</td><td>");
136     // 92, 25
137     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(metrics.toString()), jamonWriter);
138     // 92, 49
139     jamonWriter.write("</td><td>RegionServer Metrics; file and heap sizes are in megabytes</td></tr>\n<tr><td>Zookeeper Quorum</td><td>");
140     // 93, 34
141     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(regionServer.getZooKeeper().getQuorum()), jamonWriter);
142     // 93, 79
143     jamonWriter.write("</td><td>Addresses of all registered ZK servers</td></tr>\n<tr>\n  <td>Coprocessors</td>\n  <td>\n    ");
144     // 97, 5
145     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(java.util.Arrays.toString(regionServer.getCoprocessors())), jamonWriter);
146     // 97, 68
147     jamonWriter.write("\n  </td>\n  <td>Coprocessors currently loaded by this regionserver</td></tr>\n<tr><td>RS Start Time</td><td>");
148     // 100, 31
149     org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(regionServer.getStartcode())), jamonWriter);
150     // 100, 74
151     jamonWriter.write("</td><td>Date stamp of when this region server was started</td></tr>\n</tr>\n<tr><td>HBase Master</td><td>\n");
152     // 103, 1
153     if ((masterInfoPort < 0) )
154     {
155       // 103, 29
156       jamonWriter.write("\nNo hbase.master.info.port found\n");
157     }
158     // 105, 1
159     else
160     {
161       // 105, 8
162       jamonWriter.write("\n");
163       // 106, 1
164       
165 String host = regionServer.getMasterAddressManager().getMasterAddress().getHostname() + ":" + masterInfoPort;
166 String url = "//" + host + "/";
167 
168       // 110, 1
169       jamonWriter.write("<a href=\"");
170       // 110, 10
171       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(url), jamonWriter);
172       // 110, 19
173       jamonWriter.write("\">");
174       // 110, 21
175       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(host), jamonWriter);
176       // 110, 31
177       jamonWriter.write("</a>\n");
178     }
179     // 111, 7
180     jamonWriter.write("\n</td><td>Address of HBase Master</td></tr>\n</table>\n\n");
181     // 115, 1
182     {
183       org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl __jamon__var_1 = new org.apache.hadoop.hbase.tmpl.common.TaskMonitorTmpl(this.getTemplateManager());
184       __jamon__var_1.setFilter(filter );
185       __jamon__var_1.renderNoFlush(jamonWriter);
186     }
187     // 115, 49
188     jamonWriter.write("\n\n<h2>Regions</h2>\n");
189     // 118, 1
190     if ((onlineRegions != null && onlineRegions.size() > 0) )
191     {
192       // 118, 60
193       jamonWriter.write("\n<table>\n<tr><th>Region Name</th><th>Start Key</th><th>End Key</th><th>Metrics</th></tr>\n");
194       // 121, 1
195          
196   Collections.sort(onlineRegions);
197 
198       // 124, 1
199       for (HRegionInfo r: onlineRegions )
200       {
201         // 124, 38
202         jamonWriter.write("\n");
203         // 125, 1
204          
205         HServerLoad.RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
206 
207         // 128, 1
208         jamonWriter.write("<tr><td>");
209         // 128, 9
210         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(r.getRegionNameAsString()), jamonWriter);
211         // 128, 40
212         jamonWriter.write("</td>\n    <td>");
213         // 129, 9
214         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(r.getStartKey())), jamonWriter);
215         // 129, 52
216         jamonWriter.write("</td><td>");
217         // 129, 61
218         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(Bytes.toStringBinary(r.getEndKey())), jamonWriter);
219         // 129, 102
220         jamonWriter.write("</td>\n    <td>");
221         // 130, 9
222         org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(load == null? "null": load.toString()), jamonWriter);
223         // 130, 52
224         jamonWriter.write("</td>\n    </tr>\n");
225       }
226       // 132, 8
227       jamonWriter.write("\n</table>\n<p>Region names are made of the containing table's name, a comma,\nthe start key, a comma, and a randomly generated region id.  To illustrate,\nthe region named\n<em>domains,apache.org,5464829424211263407</em> is party to the table \n<em>domains</em>, has an id of <em>5464829424211263407</em> and the first key\nin the region is <em>apache.org</em>.  The <em>-ROOT-</em>\nand <em>.META.</em> 'tables' are internal sytem tables (or 'catalog' tables in db-speak).\nThe -ROOT- keeps a list of all regions in the .META. table.  The .META. table\nkeeps a list of all regions in the system. The empty key is used to denote\ntable start and table end.  A region with an empty start key is the first region in a table.\nIf region has both an empty start and an empty end key, its the only region in the table.  See\n<a href=\"http://hbase.org\">HBase Home</a> for further explication.<p>\n");
228     }
229     // 146, 1
230     else
231     {
232       // 146, 8
233       jamonWriter.write("\n<p>Not serving regions</p>\n");
234     }
235     // 148, 7
236     jamonWriter.write("\n</body>\n</html>\n");
237   }
238   
239   
240 }