Example usage for org.apache.hadoop.conf Configuration writeXml

List of usage examples for org.apache.hadoop.conf Configuration writeXml

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration writeXml.

Prototype

public void writeXml(Writer out) throws IOException 

Source Link

Usage

From source file:org.talend.components.hadoopcluster.runtime.configuration.HadoopCMClusterService.java

License:Open Source License

private void exportConfigurationToXml(String folderPath, String confName) {
    Configuration conf = confs.get(confName);
    if (conf == null) {
        return;/*from   w w w  .  ja  v  a 2s.  com*/
    }
    File confFile = new File(folderPath, confName);
    confFile.getParentFile().mkdirs();
    OutputStream os;
    try {
        os = new FileOutputStream(confFile.getAbsolutePath());
        conf.writeXml(os);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.trustedanalytics.servicebroker.h2oprovisioner.service.externals.H2oDriverExec.java

License:Apache License

public void spawnH2oOnYarn(String[] command, Map<String, String> commandEnvVariables, Configuration hadoopConf)
        throws ExternalProcessException, IOException {
    try (FileOutputStream stream = new FileOutputStream(yarnConfDir + "/yarn-site.xml")) {
        hadoopConf.writeXml(new OutputStreamWriter(stream));
    }/*from  w  w  w . j  av a2 s. co  m*/

    int h2oExitCode = ExternalProcessExecutor.runCommand(command, commandEnvVariables);
    if (h2oExitCode != 0) {
        throw new ExternalProcessException("h2odriver.jar exited with code " + h2oExitCode);
    }
}