001// Autogenerated Jamon implementation 002// /Users/peter.somogyi/Cloudera/repos/hbase-upstream/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon 003 004package org.apache.hadoop.hbase.tmpl.master; 005 006// 23, 1 007import java.util.*; 008// 24, 1 009import org.apache.hadoop.hbase.ServerName; 010// 25, 1 011import org.apache.hadoop.hbase.ClusterMetrics; 012// 26, 1 013import org.apache.hadoop.hbase.master.HMaster; 014// 27, 1 015import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; 016 017public class BackupMasterStatusTmplImpl 018 extends org.jamon.AbstractTemplateImpl 019 implements org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.Intf 020 021{ 022 private final HMaster master; 023 protected static org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData) 024 { 025 return p_implData; 026 } 027 public BackupMasterStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData) 028 { 029 super(p_templateManager, __jamon_setOptionalArguments(p_implData)); 030 master = p_implData.getMaster(); 031 } 032 033 @Override public void renderNoFlush(final java.io.Writer jamonWriter) 034 throws java.io.IOException 035 { 036 // 29, 1 037 038MasterAddressTracker masterAddressTracker = master.getMasterAddressTracker(); 039 040 // 33, 1 041 if ((!master.isActiveMaster()) ) 042 { 043 // 33, 35 044 jamonWriter.write("\n "); 045 // 34, 5 046 047 ServerName active_master = 048 (masterAddressTracker == null) ? null : masterAddressTracker.getMasterAddress(); 049 assert active_master != null : "Failed to retrieve master's ServerName!"; 050 int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker.getMasterInfoPort(); 051 052 // 40, 5 053 jamonWriter.write("<div class=\"row inner_header\">\n <div class=\"page-header\">\n <h1>Backup Master <small>"); 054 // 42, 38 055 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter); 056 // 42, 80 057 jamonWriter.write("</small></h1>\n </div>\n </div>\n <h4>Current Active Master: <a href=\"//"); 058 // 45, 43 059 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active_master.getHostname()), jamonWriter); 060 // 45, 76 061 jamonWriter.write(":"); 062 // 45, 77 063 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(infoPort), jamonWriter); 064 // 45, 91 065 jamonWriter.write("/master-status\"\n target=\"_blank\">"); 066 // 46, 25 067 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active_master.getHostname()), jamonWriter); 068 // 46, 58 069 jamonWriter.write("</a><h4>\n"); 070 } 071 // 47, 1 072 else 073 { 074 // 47, 8 075 jamonWriter.write("\n <h2>Backup Masters</h2>\n\n <table class=\"table table-striped\">\n <tr>\n <th>ServerName</th>\n <th>Port</th>\n <th>Start Time</th>\n </tr>\n "); 076 // 56, 5 077 078 Collection<ServerName> backup_masters = master.getClusterMetricsWithoutCoprocessor( 079 EnumSet.of(ClusterMetrics.Option.BACKUP_MASTERS)).getBackupMasterNames(); 080 ServerName [] backupServerNames = backup_masters.toArray(new ServerName[backup_masters.size()]); 081 Arrays.sort(backupServerNames); 082 for (ServerName serverName : backupServerNames) { 083 int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker 084 .getBackupMasterInfoPort(serverName); 085 086 // 65, 5 087 jamonWriter.write("<tr>\n <td><a href=\"//"); 088 // 66, 24 089 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter); 090 // 66, 54 091 jamonWriter.write(":"); 092 // 66, 55 093 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(infoPort), jamonWriter); 094 // 66, 69 095 jamonWriter.write("/master-status\"\n target=\"_blank\">"); 096 // 67, 29 097 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter); 098 // 67, 59 099 jamonWriter.write("</a>\n </td>\n <td>"); 100 // 69, 13 101 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getPort()), jamonWriter); 102 // 69, 39 103 jamonWriter.write("</td>\n <td>"); 104 // 70, 13 105 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(serverName.getStartcode())), jamonWriter); 106 // 70, 54 107 jamonWriter.write("</td>\n </tr>\n "); 108 // 72, 5 109 110 } 111 112 // 75, 5 113 jamonWriter.write("<tr><td>Total:"); 114 // 75, 19 115 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(backupServerNames.length), jamonWriter); 116 // 75, 49 117 jamonWriter.write("</td>\n </table>\n"); 118 } 119 // 77, 7 120 jamonWriter.write("\n"); 121 } 122 123 124}