Пример #1
0
  @SuppressWarnings("rawtypes")
  static Path createConfigurationFileInFs(
      FileSystem fs, String appHome, Map stormConf, YarnConfiguration yarnConf) throws IOException {
    // dump stringwriter's content into FS conf/storm.yaml
    Path confDst =
        new Path(fs.getHomeDirectory(), appHome + Path.SEPARATOR + STORM_CONF_PATH_STRING);
    Path dirDst = confDst.getParent();
    fs.mkdirs(dirDst);

    // storm.yaml
    FSDataOutputStream out = fs.create(confDst);
    Yaml yaml = new Yaml();
    OutputStreamWriter writer = new OutputStreamWriter(out);
    rmNulls(stormConf);
    yaml.dump(stormConf, writer);
    writer.close();
    out.close();

    // yarn-site.xml
    Path yarn_site_xml = new Path(dirDst, "yarn-site.xml");
    out = fs.create(yarn_site_xml);
    writer = new OutputStreamWriter(out);
    yarnConf.writeXml(writer);
    writer.close();
    out.close();

    // logback.xml
    Path logback_xml = new Path(dirDst, "logback.xml");
    out = fs.create(logback_xml);
    CreateLogbackXML(out);
    out.close();

    return dirDst;
  }
Пример #2
0
 @SuppressWarnings("rawtypes")
 synchronized File createConfigFile(Map storm_conf) throws IOException {
   storm_conf_file = new File("./conf/storm.yaml");
   storm_conf_file.getParentFile().mkdirs();
   Yaml yaml = new Yaml();
   FileWriter writer = new FileWriter(storm_conf_file);
   Util.rmNulls(storm_conf);
   yaml.dump(storm_conf, writer);
   writer.flush();
   writer.close();
   return storm_conf_file;
 }