View Javadoc

1   // Autogenerated Jamon implementation
2   // /var/tmp/hbase-0.94.16/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.util.Bytes;
10  // 25, 1
11  import org.apache.hadoop.hbase.ServerName;
12  // 26, 1
13  import org.apache.hadoop.hbase.ClusterStatus;
14  // 27, 1
15  import org.apache.hadoop.hbase.master.HMaster;
16  // 28, 1
17  import org.apache.hadoop.hbase.master.ServerManager;
18  // 29, 1
19  import org.apache.hadoop.hbase.master.AssignmentManager;
20  // 30, 1
21  import org.apache.hadoop.hbase.master.ActiveMasterManager;
22  
23  public class BackupMasterStatusTmplImpl
24    extends org.jamon.AbstractTemplateImpl
25    implements org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.Intf
26  
27  {
28    private final HMaster master;
29    protected static org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData)
30    {
31      return p_implData;
32    }
33    public BackupMasterStatusTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.master.BackupMasterStatusTmpl.ImplData p_implData)
34    {
35      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
36      master = p_implData.getMaster();
37    }
38    
39    public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
40      throws java.io.IOException
41    {
42      // 32, 1
43      
44  Collection<ServerName> masters;
45  
46  if (master.isActiveMaster()) {
47      ClusterStatus status = master.getClusterStatus();
48      masters = status.getBackupMasters();
49  } else{
50      ServerName sn = master.getActiveMasterManager().getActiveMaster() ;
51      assert sn != null : "Failed to retreive master's ServerName!";
52  
53      List<ServerName> serverNames = new ArrayList<ServerName>(1);
54      serverNames.add(sn);
55      masters = Collections.unmodifiableCollection(serverNames);
56  }
57  
58      // 48, 1
59      
60  ServerName [] serverNames = masters.toArray(new ServerName[masters.size()]);
61  
62      // 51, 1
63      if ((!master.isActiveMaster()) )
64      {
65        // 51, 35
66        jamonWriter.write("\n    <h2>Master</h2>\n    <a href=\"//");
67        // 53, 16
68        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverNames[0].getHostname()), jamonWriter);
69        // 53, 50
70        jamonWriter.write(":");
71        // 53, 51
72        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(master.getConfiguration().getInt("hbase.master.info.port", 60010)), jamonWriter);
73        // 53, 122
74        jamonWriter.write("/master-status\" target=\"_blank\">");
75        // 53, 154
76        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverNames[0].getHostname()), jamonWriter);
77        // 53, 188
78        jamonWriter.write("</a>\n");
79      }
80      // 54, 1
81      else
82      {
83        // 54, 8
84        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    ");
85        // 63, 5
86        
87      Arrays.sort(serverNames);
88      for (ServerName serverName: serverNames) {
89      
90        // 67, 5
91        jamonWriter.write("<tr>\n        <td><a href=\"//");
92        // 68, 24
93        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter);
94        // 68, 54
95        jamonWriter.write(":");
96        // 68, 55
97        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(master.getConfiguration().getInt("hbase.master.info.port", 60010)), jamonWriter);
98        // 68, 126
99        jamonWriter.write("/master-status\" target=\"_blank\">");
100       // 68, 158
101       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getHostname()), jamonWriter);
102       // 68, 188
103       jamonWriter.write("</a></td>\n        <td>");
104       // 69, 13
105       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(serverName.getPort()), jamonWriter);
106       // 69, 39
107       jamonWriter.write("</td>\n        <td>");
108       // 70, 13
109       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(new Date(serverName.getStartcode())), jamonWriter);
110       // 70, 54
111       jamonWriter.write("</td>\n    </tr>\n    ");
112       // 72, 5
113       
114     }
115     
116       // 75, 5
117       jamonWriter.write("<tr><td>Total:");
118       // 75, 19
119       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf((masters != null) ? masters.size() : 0), jamonWriter);
120       // 75, 63
121       jamonWriter.write("</td>\n    </table>\n");
122     }
123     // 77, 7
124     jamonWriter.write("\n");
125   }
126   
127   
128 }