Package org.apache.hadoop.conf

Examples of org.apache.hadoop.conf.Configuration.addResource()


      ChukwaConfiguration conf = new ChukwaConfiguration();
     
      try {
        Configuration collectorConf = new Configuration(false);
        collectorConf.addResource(new Path(conf.getChukwaConf() + "/chukwa-common.xml"));
        collectorConf.addResource(new Path(conf.getChukwaConf() + "/chukwa-collector-conf.xml"));
        Checker.checkConf(new OptDictionary(new File(new File(conf.getChukwaHome(), "share/chukwa/lib"), "collector.dict")),
            HSlurper.fromHConf(collectorConf));
      } catch(Exception e) {e.printStackTrace();}
     
      int portNum = conf.getInt("chukwaCollector.http.port", 9999);
View Full Code Here


    }
    ByteArrayInputStream in2;

    in2 = new ByteArrayInputStream(data);
    Configuration conf1 = new Configuration(false);
    conf1.addResource(in2);
    //now clone it while dropping all its sources
    Configuration conf2   = new Configuration(false);
    String src = path.toString();
    for (Map.Entry<String, String> entry : conf1) {
      String key = entry.getKey();
View Full Code Here

      throw new FileNotFoundException("File not found :"
                                          + file.getAbsoluteFile());
    }
    Configuration conf = new Configuration(loadDefaults);
    try {
      conf.addResource(file.toURI().toURL());
    } catch (MalformedURLException e) {
      //should never happen...
      throw new IOException(
        "File " + file.toURI() + " doesn't have a valid URL");
    }
View Full Code Here

        throw new FileNotFoundException("No config file found at " + templatePath);
      }
      log.debug("Template {} not found" +
                " -reverting to classpath resource {}", templatePath, fallbackResource);
      conf = new Configuration(false);
      conf.addResource(fallbackResource);
      origin = "Resource " + fallbackResource;
    }
    //force a get
    conf.get(SliderXmlConfKeys.KEY_TEMPLATE_ORIGIN);
    //now set the origin
View Full Code Here

    Configuration conf = new Configuration(false);
    URL resURL = ConfigHelper.class.getClassLoader()
                                .getResource(resource);
    if (resURL != null) {
      log.debug("loaded resources from {}", resURL);
      conf.addResource(resource);
    } else{
      log.debug("failed to find {} on the classpath", resource);
    }
    return conf;
   
View Full Code Here

    Configuration conf = new Configuration(false);
    URL resURL = ConfigHelper.class.getClassLoader()
                                .getResource(resource);
    if (resURL != null) {
      log.debug("loaded resources from {}", resURL);
      conf.addResource(resource);
    } else {
      throw new FileNotFoundException(resource);
    }
    return conf;
  }
View Full Code Here

    if (conf.getBoolean("dfs.https.enable", false)) {
      boolean needClientAuth = conf.getBoolean("dfs.https.need.client.auth", false);
      InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(conf.get(
          "dfs.datanode.https.address", infoHost + ":" + 0));
      Configuration sslConf = new Configuration(false);
      sslConf.addResource(conf.get("dfs.https.server.keystore.resource",
          "ssl-server.xml"));
      this.infoServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
      // assume same ssl port for all datanodes
      InetSocketAddress datanodeSslPort = NetUtils.createSocketAddr(conf.get(
          "dfs.datanode.https.address", infoHost + ":" + 50475));
View Full Code Here

            // This is one case. Here we check if mapred.system.dir 
            // directory is present. This check causes use to print a nice error
            String newMapredSystemDir = testConf.get( MAPRED_SYS_DIR, "" );
            Configuration defaultConf = new Configuration(false);
            defaultConf.addResource("core-default.xml");
            defaultConf.addResource("mapred-default.xml");
            if( defaultConf.get(MAPRED_SYS_DIR, "").compareTo(newMapredSystemDir) != 0 ) {
                File systemDir = new File(newMapredSystemDir);
                if( ! systemDir.exists() ) {
                    throw new ExecException( MAPRED_SYS_DIR + ": " + newMapredSystemDir
View Full Code Here

            // This is one case. Here we check if mapred.system.dir 
            // directory is present. This check causes use to print a nice error
            String newMapredSystemDir = testConf.get( MAPRED_SYS_DIR, "" );
            Configuration defaultConf = new Configuration(false);
            defaultConf.addResource("core-default.xml");
            defaultConf.addResource("mapred-default.xml");
            if( defaultConf.get(MAPRED_SYS_DIR, "").compareTo(newMapredSystemDir) != 0 ) {
                File systemDir = new File(newMapredSystemDir);
                if( ! systemDir.exists() ) {
                    throw new ExecException( MAPRED_SYS_DIR + ": " + newMapredSystemDir
                            + " mentioned in the configuration does not exist");
View Full Code Here

      // In case of IMPORT this will get rid of default directories
      // but will retain directories specified in hdfs-site.xml
      // When importing image from a checkpoint, the name-node can
      // start with empty set of storage directories.
      Configuration cE = new HdfsConfiguration(false);
      cE.addResource("core-default.xml");
      cE.addResource("core-site.xml");
      cE.addResource("hdfs-default.xml");
      Collection<String> dirNames2 = cE.getTrimmedStringCollection(propertyName);
      dirNames.removeAll(dirNames2);
      if(dirNames.isEmpty())
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.