001    package org.apache.hadoop.hdfs.server.namenode;
002    
003    import javax.servlet.*;
004    import javax.servlet.http.*;
005    import javax.servlet.jsp.*;
006    import org.apache.hadoop.util.ServletUtil;
007    import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState;
008    
009    public final class dfsnodelist_jsp extends org.apache.jasper.runtime.HttpJspBase
010        implements org.apache.jasper.runtime.JspSourceDependent {
011    
012    
013      //for java.io.Serializable
014      private static final long serialVersionUID = 1L;
015    
016      private static java.util.List _jspx_dependants;
017    
018      public Object getDependants() {
019        return _jspx_dependants;
020      }
021    
022      public void _jspService(HttpServletRequest request, HttpServletResponse response)
023            throws java.io.IOException, ServletException {
024    
025        JspFactory _jspxFactory = null;
026        PageContext pageContext = null;
027        HttpSession session = null;
028        ServletContext application = null;
029        ServletConfig config = null;
030        JspWriter out = null;
031        Object page = this;
032        JspWriter _jspx_out = null;
033        PageContext _jspx_page_context = null;
034    
035    
036        try {
037          _jspxFactory = JspFactory.getDefaultFactory();
038          response.setContentType("text/html; charset=UTF-8");
039          pageContext = _jspxFactory.getPageContext(this, request, response,
040                            null, true, 8192, true);
041          _jspx_page_context = pageContext;
042          application = pageContext.getServletContext();
043          config = pageContext.getServletConfig();
044          session = pageContext.getSession();
045          out = pageContext.getOut();
046          _jspx_out = out;
047    
048    
049    /*
050     * Licensed to the Apache Software Foundation (ASF) under one
051     * or more contributor license agreements.  See the NOTICE file 
052     * distributed with this work for additional information
053     * regarding copyright ownership.  The ASF licenses this file
054     * to you under the Apache License, Version 2.0 (the
055     * "License"); you may not use this file except in compliance
056     * with the License.  You may obtain a copy of the License at
057     *
058     *     http://www.apache.org/licenses/LICENSE-2.0
059     *
060     * Unless required by applicable law or agreed to in writing, software
061     * distributed under the License is distributed on an "AS IS" BASIS,
062     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
063     * See the License for the specific language governing permissions and
064     * limitations under the License.
065     */
066    
067    
068    final NamenodeJspHelper.NodeListJsp nodelistjsp = new NamenodeJspHelper.NodeListJsp();
069    NameNode nn = NameNodeHttpServer.getNameNodeFromContext(application);
070    String namenodeRole = nn.getRole().toString();
071    FSNamesystem fsn = nn.getNamesystem();
072    HAServiceState nnHAState = nn.getServiceState();
073    boolean isActive = (nnHAState == HAServiceState.ACTIVE);
074    String namenodeLabel = NamenodeJspHelper.getNameNodeLabel(nn);
075    
076          out.write("<!DOCTYPE html>\n<html>\n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hadoop.css\">\n<title>Hadoop ");
077          out.print(namenodeRole);
078          out.write("&nbsp;");
079          out.print(namenodeLabel);
080          out.write("</title>\n  \n<body>\n<h1>");
081          out.print(namenodeRole);
082          out.write(' ');
083          out.write('\'');
084          out.print(namenodeLabel);
085          out.write("'</h1>\n");
086          out.print( NamenodeJspHelper.getVersionTable(fsn) );
087          out.write("<br />\n");
088     if (isActive && fsn != null) { 
089          out.write("<b><a href=\"/nn_browsedfscontent.jsp\">Browse the filesystem</a></b><br>\n");
090     } 
091          out.write("<b><a href=\"/logs/\">");
092          out.print(namenodeRole);
093          out.write(" Logs</a></b><br>\n<b><a href=/dfshealth.jsp> Go back to DFS home</a></b>\n<hr>\n");
094     nodelistjsp.generateNodesList(application, out, request); 
095    
096    out.println(ServletUtil.htmlFooter());
097    
098        } catch (Throwable t) {
099          if (!(t instanceof SkipPageException)){
100            out = _jspx_out;
101            if (out != null && out.getBufferSize() != 0)
102              out.clearBuffer();
103            if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
104          }
105        } finally {
106          if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
107        }
108      }
109    }