Java 类org.apache.hadoop.hdfs.server.datanode.web.resources.DatanodeWebHdfsMethods 实例源码

项目:hadoop-plus    文件:DataNode.java   
private void startInfoServer(Configuration conf) throws IOException {
  // create a servlet to serve full-file content
  InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
  String infoHost = infoSocAddr.getHostName();
  int tmpInfoPort = infoSocAddr.getPort();
  this.infoServer = (secureResources == null) 
     ? new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0, 
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")))
     : new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")),
         secureResources.getListener());
  LOG.info("Opened info server at " + infoHost + ":" + tmpInfoPort);
  if (conf.getBoolean(DFS_HTTPS_ENABLE_KEY, false)) {
    boolean needClientAuth = conf.getBoolean(DFS_CLIENT_HTTPS_NEED_AUTH_KEY,
                                             DFS_CLIENT_HTTPS_NEED_AUTH_DEFAULT);
    InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
        DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
    Configuration sslConf = new HdfsConfiguration(false);
    sslConf.addResource(conf.get(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
        "ssl-server.xml"));
    this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Datanode listening for SSL on " + secInfoSocAddr);
    }
  }
  this.infoServer.addInternalServlet(null, "/streamFile/*", StreamFile.class);
  this.infoServer.addInternalServlet(null, "/getFileChecksum/*",
      FileChecksumServlets.GetServlet.class);

  this.infoServer.setAttribute("datanode", this);
  this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
  this.infoServer.addServlet(null, "/blockScannerReport", 
                             DataBlockScanner.Servlet.class);

  if (WebHdfsFileSystem.isEnabled(conf, LOG)) {
    infoServer.addJerseyResourcePackage(DatanodeWebHdfsMethods.class
        .getPackage().getName() + ";" + Param.class.getPackage().getName(),
        WebHdfsFileSystem.PATH_PREFIX + "/*");
  }
  this.infoServer.start();
}
项目:PDHC    文件:CheckerNode.java   
private void startInfoServer(Configuration conf) throws IOException {
  // create a servlet to serve full-file content
  InetSocketAddress infoSocAddr = CheckerNode.getInfoAddr(conf);
  String infoHost = infoSocAddr.getHostName();
  int tmpInfoPort = infoSocAddr.getPort();
  this.infoServer = (secureResources == null) 
     ? new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0, 
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")))
     : new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")),
         secureResources.getListener());
  LOG.info("Opened info server at " + infoHost + ":" + tmpInfoPort);
  if (conf.getBoolean(DFS_HTTPS_ENABLE_KEY, false)) {
    boolean needClientAuth = conf.getBoolean(DFS_CLIENT_HTTPS_NEED_AUTH_KEY,
                                             DFS_CLIENT_HTTPS_NEED_AUTH_DEFAULT);
    InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
        DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
    Configuration sslConf = new HdfsConfiguration(false);
    sslConf.addResource(conf.get(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
        "ssl-server.xml"));
    this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Datanode listening for SSL on " + secInfoSocAddr);
    }
  }
  this.infoServer.addInternalServlet(null, "/streamFile/*", StreamFile.class);
  this.infoServer.addInternalServlet(null, "/getFileChecksum/*",
      FileChecksumServlets.GetServlet.class);

  this.infoServer.setAttribute("datanode", this);
  this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
  this.infoServer.addServlet(null, "/blockScannerReport", 
                             DataBlockScanner.Servlet.class);

  if (WebHdfsFileSystem.isEnabled(conf, LOG)) {
    infoServer.addJerseyResourcePackage(DatanodeWebHdfsMethods.class
        .getPackage().getName() + ";" + Param.class.getPackage().getName(),
        WebHdfsFileSystem.PATH_PREFIX + "/*");
  }
  this.infoServer.start();
}
项目:hops    文件:DataNode.java   
private void startInfoServer(Configuration conf) throws IOException {
  // create a servlet to serve full-file content
  InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
  String infoHost = infoSocAddr.getHostName();
  int tmpInfoPort = infoSocAddr.getPort();
  this.infoServer = (secureResources == null) ?
      new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
          conf, new AccessControlList(conf.get(DFS_ADMIN, " "))) :
      new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
          conf, new AccessControlList(conf.get(DFS_ADMIN, " ")),
          secureResources.getListener());
  LOG.info("Opened info server at " + infoHost + ":" + tmpInfoPort);
  if (conf.getBoolean(DFS_HTTPS_ENABLE_KEY, false)) {
    boolean needClientAuth = conf.getBoolean(DFS_CLIENT_HTTPS_NEED_AUTH_KEY,
        DFS_CLIENT_HTTPS_NEED_AUTH_DEFAULT);
    InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(
        conf.get(DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
    Configuration sslConf = new HdfsConfiguration(false);
    sslConf.addResource(
        conf.get("dfs.https.server.keystore.resource", "ssl-server.xml"));
    this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Datanode listening for SSL on " + secInfoSocAddr);
    }
  }
  this.infoServer.addInternalServlet(null, "/streamFile/*", StreamFile.class);
  this.infoServer.addInternalServlet(null, "/getFileChecksum/*",
      FileChecksumServlets.GetServlet.class);

  this.infoServer.setAttribute("datanode", this);
  this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
  this.infoServer.addServlet(null, "/blockScannerReport",
      DataBlockScanner.Servlet.class);

  if (WebHdfsFileSystem.isEnabled(conf, LOG)) {
    infoServer.addJerseyResourcePackage(
        DatanodeWebHdfsMethods.class.getPackage().getName() + ";" +
            Param.class.getPackage().getName(),
        WebHdfsFileSystem.PATH_PREFIX + "/*");
  }
  this.infoServer.start();
}
项目:hadoop-TCP    文件:DataNode.java   
private void startInfoServer(Configuration conf) throws IOException {
  // create a servlet to serve full-file content
  InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
  String infoHost = infoSocAddr.getHostName();
  int tmpInfoPort = infoSocAddr.getPort();
  this.infoServer = (secureResources == null) 
     ? new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0, 
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")))
     : new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")),
         secureResources.getListener());

  LOG.info("Opened info server at " + infoHost + ":" + tmpInfoPort);
  if (conf.getBoolean(DFS_HTTPS_ENABLE_KEY, false)) {
    boolean needClientAuth = conf.getBoolean(DFS_CLIENT_HTTPS_NEED_AUTH_KEY,
                                             DFS_CLIENT_HTTPS_NEED_AUTH_DEFAULT);
    InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
        DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
    Configuration sslConf = new HdfsConfiguration(false);
    sslConf.addResource(conf.get(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
        "ssl-server.xml"));
    this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Datanode listening for SSL on " + secInfoSocAddr);
    }
    infoSecurePort = secInfoSocAddr.getPort();
  }
  this.infoServer.addInternalServlet(null, "/streamFile/*", StreamFile.class);
  this.infoServer.addInternalServlet(null, "/getFileChecksum/*",
      FileChecksumServlets.GetServlet.class);

  this.infoServer.setAttribute("datanode", this);
  this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
  this.infoServer.addServlet(null, "/blockScannerReport", 
                             DataBlockScanner.Servlet.class);

  if (WebHdfsFileSystem.isEnabled(conf, LOG)) {
    infoServer.addJerseyResourcePackage(DatanodeWebHdfsMethods.class
        .getPackage().getName() + ";" + Param.class.getPackage().getName(),
        WebHdfsFileSystem.PATH_PREFIX + "/*");
  }
  this.infoServer.start();
}
项目:hardfs    文件:DataNode.java   
private void startInfoServer(Configuration conf) throws IOException {
  // create a servlet to serve full-file content
  InetSocketAddress infoSocAddr = DataNode.getInfoAddr(conf);
  String infoHost = infoSocAddr.getHostName();
  int tmpInfoPort = infoSocAddr.getPort();
  this.infoServer = (secureResources == null) 
     ? new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0, 
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")))
     : new HttpServer("datanode", infoHost, tmpInfoPort, tmpInfoPort == 0,
         conf, new AccessControlList(conf.get(DFS_ADMIN, " ")),
         secureResources.getListener());

  LOG.info("Opened info server at " + infoHost + ":" + tmpInfoPort);
  if (conf.getBoolean(DFS_HTTPS_ENABLE_KEY, false)) {
    boolean needClientAuth = conf.getBoolean(DFS_CLIENT_HTTPS_NEED_AUTH_KEY,
                                             DFS_CLIENT_HTTPS_NEED_AUTH_DEFAULT);
    InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
        DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 0));
    Configuration sslConf = new HdfsConfiguration(false);
    sslConf.addResource(conf.get(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
        "ssl-server.xml"));
    this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Datanode listening for SSL on " + secInfoSocAddr);
    }
    infoSecurePort = secInfoSocAddr.getPort();
  }
  this.infoServer.addInternalServlet(null, "/streamFile/*", StreamFile.class);
  this.infoServer.addInternalServlet(null, "/getFileChecksum/*",
      FileChecksumServlets.GetServlet.class);

  this.infoServer.setAttribute("datanode", this);
  this.infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
  this.infoServer.addServlet(null, "/blockScannerReport", 
                             DataBlockScanner.Servlet.class);

  if (WebHdfsFileSystem.isEnabled(conf, LOG)) {
    infoServer.addJerseyResourcePackage(DatanodeWebHdfsMethods.class
        .getPackage().getName() + ";" + Param.class.getPackage().getName(),
        WebHdfsFileSystem.PATH_PREFIX + "/*");
  }
  this.infoServer.start();
}