View Javadoc

1   // Autogenerated Jamon implementation
2   // /home/busbey/projects/hbase/hbase-assembly/target/hbase-1.2.6/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.master;
5   
6   // 23, 1
7   import java.util.*;
8   // 24, 1
9   import org.apache.hadoop.hbase.ServerName;
10  // 25, 1
11  import org.apache.hadoop.hbase.ClusterStatus;
12  // 26, 1
13  import org.apache.hadoop.hbase.master.HMaster;
14  // 27, 1
15  import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
16  
17  public class BackupMasterStatusTmplImpl
18    extends org.jamon.AbstractTemplateImpl
19    implements org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.Intf
20  
21  {
22    private final HMaster master;
23    protected static org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData)
24    {
25      return p_implData;
26    }
27    public BackupMasterStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData)
28    {
29      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
30      master = p_implData.getMaster();
31    }
32    
33    @Override public void renderNoFlush(final java.io.Writer jamonWriter)
34      throws java.io.IOException
35    {
36      // 29, 1
37      
38  MasterAddressTracker masterAddressTracker = master.getMasterAddressTracker();
39  
40      // 33, 1
41      if ((!master.isActiveMaster()) )
42      {
43        // 33, 35
44        jamonWriter.write("\n    ");
45        // 34, 5
46        
47      ServerName active_master =
48          (masterAddressTracker == null) ? null : masterAddressTracker.getMasterAddress();
49      assert active_master != null : "Failed to retrieve master's ServerName!";
50      int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker.getMasterInfoPort();
51      
52        // 40, 5
53        jamonWriter.write("<div class=\"row inner_header\">\n        <div class=\"page-header\">\n            <h1>Backup Master <small>");
54        // 42, 38
55        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(master.getServerName().getHostname()), jamonWriter);
56        // 42, 80
57        jamonWriter.write("</small></h1>\n        </div>\n    </div>\n    <h4>Current Active Master: <a href=\"//");
58        // 45, 43
59        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active_master.getHostname()), jamonWriter);
60        // 45, 76
61        jamonWriter.write(":");
62        // 45, 77
63        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(infoPort), jamonWriter);
64        // 45, 91
65        jamonWriter.write("/master-status\"\n        target=\"_blank\">");
66        // 46, 25
67        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(active_master.getHostname()), jamonWriter);
68        // 46, 58
69        jamonWriter.write("</a><h4>\n");
70      }
71      // 47, 1
72      else
73      {
74        // 47, 8
75        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    ");
76        // 56, 5
77        
78      Collection<ServerName> backup_masters = master.getClusterStatus().getBackupMasters();
79      ServerName [] backupServerNames = backup_masters.toArray(new ServerName[backup_masters.size()]);
80      Arrays.sort(backupServerNames);
81      for (ServerName serverName : backupServerNames) {
82        int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker
83            .getBackupMasterInfoPort(serverName);
84      
85        // 64, 5
86        jamonWriter.write("<tr>\n        <td><a href=\"//");
87        // 65, 24
88        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter);
89        // 65, 54
90        jamonWriter.write(":");
91        // 65, 55
92        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(infoPort), jamonWriter);
93        // 65, 69
94        jamonWriter.write("/master-status\"\n            target=\"_blank\">");
95        // 66, 29
96        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter);
97        // 66, 59
98        jamonWriter.write("</a>\n        </td>\n        <td>");
99        // 68, 13
100       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getPort()), jamonWriter);
101       // 68, 39
102       jamonWriter.write("</td>\n        <td>");
103       // 69, 13
104       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(serverName.getStartcode())), jamonWriter);
105       // 69, 54
106       jamonWriter.write("</td>\n    </tr>\n    ");
107       // 71, 5
108       
109     }
110     
111       // 74, 5
112       jamonWriter.write("<tr><td>Total:");
113       // 74, 19
114       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(backupServerNames.length), jamonWriter);
115       // 74, 49
116       jamonWriter.write("</td>\n    </table>\n");
117     }
118     // 76, 7
119     jamonWriter.write("\n");
120   }
121   
122   
123 }