001// Autogenerated Jamon implementation
002// /home/vagrant/repos/hbase/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/tool/CanaryStatusTmpl.jamon
003
004package org.apache.hadoop.hbase.tmpl.tool;
005
006// 24, 1
007import java.util.Map;
008// 25, 1
009import java.util.concurrent.atomic.LongAdder;
010// 26, 1
011import org.apache.hadoop.hbase.ServerName;
012// 27, 1
013import org.apache.hadoop.hbase.tool.CanaryTool.RegionStdOutSink;
014
015public class CanaryStatusTmplImpl
016  extends org.jamon.AbstractTemplateImpl
017  implements org.apache.hadoop.hbase.tmpl.tool.CanaryStatusTmpl.Intf
018
019{
020  private final RegionStdOutSink sink;
021  protected static org.apache.hadoop.hbase.tmpl.tool.CanaryStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.tool.CanaryStatusTmpl.ImplData p_implData)
022  {
023    return p_implData;
024  }
025  public CanaryStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.tool.CanaryStatusTmpl.ImplData p_implData)
026  {
027    super(p_templateManager, __jamon_setOptionalArguments(p_implData));
028    sink = p_implData.getSink();
029  }
030  
031  @Override public void renderNoFlush(final java.io.Writer jamonWriter)
032    throws java.io.IOException
033  {
034    // 1, 1
035    jamonWriter.write("\n<!--[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>Canary</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=\"/canary-status\"><img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/></a>\n            </div>\n        </div>\n    </div>\n\n  <div class=\"container\">\n    <section>\n    <h2>Failed Servers</h2>\n        ");
036    // 63, 9
037    
038           Map<ServerName, LongAdder> perServerFailuresCount = sink.getPerServerFailuresCount();
039        
040    // 66, 9
041    jamonWriter.write("<table class=\"table table-striped\">\n          <tr>\n              <th>Server</th>\n              <th>Failures Count</th>\n          </tr>\n          ");
042    // 71, 11
043    if ((perServerFailuresCount != null && perServerFailuresCount.size() > 0))
044    {
045      // 71, 87
046      jamonWriter.write("\n          ");
047      // 72, 11
048      for (Map.Entry<ServerName, LongAdder> entry : perServerFailuresCount.entrySet() )
049      {
050        // 72, 94
051        jamonWriter.write("\n          <tr>\n              <td>");
052        // 74, 19
053        {
054          // 74, 19
055          __jamon_innerUnit__serverNameLink(jamonWriter, entry.getKey() );
056        }
057        // 74, 69
058        jamonWriter.write("</td>\n              <td>");
059        // 75, 19
060        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue()), jamonWriter);
061        // 75, 41
062        jamonWriter.write("</td>\n          </tr>\n          ");
063      }
064      // 77, 18
065      jamonWriter.write("\n          ");
066    }
067    // 78, 17
068    jamonWriter.write("\n          <tr><td>Total Failed Servers: ");
069    // 79, 41
070    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf((perServerFailuresCount != null) ? perServerFailuresCount.size() : 0), jamonWriter);
071    // 79, 115
072    jamonWriter.write("</td></tr>\n        </table>\n    </section>\n    <section>\n      <h2>Failed Tables</h2>\n            ");
073    // 84, 13
074    
075               Map<String, LongAdder> perTableFailuresCount = sink.getPerTableFailuresCount();
076            
077    // 87, 13
078    jamonWriter.write("<table class=\"table table-striped\">\n              <tr>\n                  <th>Table</th>\n                  <th>Failures Count</th>\n              </tr>\n              ");
079    // 92, 15
080    if ((perTableFailuresCount != null && perTableFailuresCount.size() > 0))
081    {
082      // 92, 89
083      jamonWriter.write("\n              ");
084      // 93, 15
085      for (Map.Entry<String, LongAdder> entry : perTableFailuresCount.entrySet())
086      {
087        // 93, 92
088        jamonWriter.write("\n              <tr>\n                  <td>");
089        // 95, 23
090        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getKey()), jamonWriter);
091        // 95, 43
092        jamonWriter.write("</td>\n                  <td>");
093        // 96, 23
094        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(entry.getValue()), jamonWriter);
095        // 96, 45
096        jamonWriter.write("</td>\n              </tr>\n              ");
097      }
098      // 98, 22
099      jamonWriter.write("\n              ");
100    }
101    // 99, 21
102    jamonWriter.write("\n              <tr><td>Total Failed Tables: ");
103    // 100, 44
104    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf((perTableFailuresCount != null) ? perTableFailuresCount.size() : 0), jamonWriter);
105    // 100, 116
106    jamonWriter.write("</td></tr>\n            </table>\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>");
107    // 114, 25
108    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getVersion()), jamonWriter);
109    // 114, 84
110    jamonWriter.write(", r");
111    // 114, 87
112    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getRevision()), jamonWriter);
113    // 114, 147
114    jamonWriter.write("</td><td>HBase version and revision</td>\n                </tr>\n                <tr>\n                    <td>HBase Compiled</td>\n                    <td>");
115    // 118, 25
116    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getDate()), jamonWriter);
117    // 118, 81
118    jamonWriter.write(", ");
119    // 118, 83
120    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.hbase.util.VersionInfo.getUser()), jamonWriter);
121    // 118, 139
122    jamonWriter.write("</td>\n                    <td>When HBase version was compiled and by whom</td>\n                </tr>\n                <tr>\n                    <td>Hadoop Version</td>\n                    <td>");
123    // 123, 25
124    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getVersion()), jamonWriter);
125    // 123, 78
126    jamonWriter.write(", r");
127    // 123, 81
128    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getRevision()), jamonWriter);
129    // 123, 135
130    jamonWriter.write("</td>\n                    <td>Hadoop version and revision</td>\n                </tr>\n                <tr>\n                    <td>Hadoop Compiled</td>\n                    <td>");
131    // 128, 25
132    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getDate()), jamonWriter);
133    // 128, 75
134    jamonWriter.write(", ");
135    // 128, 77
136    org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(org.apache.hadoop.util.VersionInfo.getUser()), jamonWriter);
137    // 128, 127
138    jamonWriter.write("</td>\n                    <td>When Hadoop version was compiled and by whom</td>\n                </tr>\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");
139  }
140  
141  
142  // 142, 1
143  private void __jamon_innerUnit__serverNameLink(final java.io.Writer jamonWriter, final ServerName serverName)
144    throws java.io.IOException
145  {
146    // 146, 9
147    
148        int infoPort = serverName.getPort() + 1;
149        String url = "//" + serverName.getHostname() + ":" + infoPort + "/";
150        
151    // 151, 9
152    if ((infoPort > 0) )
153    {
154      // 151, 31
155      jamonWriter.write("\n            <a href=\"");
156      // 152, 22
157      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(url), jamonWriter);
158      // 152, 31
159      jamonWriter.write("\">");
160      // 152, 33
161      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
162      // 152, 65
163      jamonWriter.write("</a>\n        ");
164    }
165    // 153, 9
166    else
167    {
168      // 153, 16
169      jamonWriter.write("\n            ");
170      // 154, 13
171      org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getServerName()), jamonWriter);
172      // 154, 45
173      jamonWriter.write("\n        ");
174    }
175    // 155, 15
176    jamonWriter.write("\n");
177  }
178  
179  
180}