Search in sources :

Example 26 with OozieClientException

use of org.apache.oozie.client.OozieClientException in project oozie by apache.

the class ServerInfoCollector method storeServerConfiguration.

void storeServerConfiguration(File outputDir) {
    try {
        System.out.print("Getting Configuration...");
        final Map<String, String> serverConfigMap = client.getServerConfiguration();
        final Configuration serverConfig = new Configuration(false);
        for (Map.Entry<String, String> ent : serverConfigMap.entrySet()) {
            serverConfig.set(ent.getKey(), ent.getValue());
        }
        try (OutputStream outputStream = new FileOutputStream(new File(outputDir, "effective-oozie-site.xml"))) {
            serverConfig.writeXml(outputStream);
        }
        System.out.println("Done");
    } catch (OozieClientException | IOException e) {
        System.err.printf("Exception occurred during the retrieval of effective Oozie server configuration " + "\"oozie-site.xml\": %s%n", e.getMessage());
    }
}
Also used : OozieClientException(org.apache.oozie.client.OozieClientException) Configuration(org.apache.hadoop.conf.Configuration) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) Map(java.util.Map) File(java.io.File)

Aggregations

OozieClientException (org.apache.oozie.client.OozieClientException)26 IOException (java.io.IOException)13 Properties (java.util.Properties)12 OozieClient (org.apache.oozie.client.OozieClient)11 File (java.io.File)10 XOozieClient (org.apache.oozie.client.XOozieClient)8 Reader (java.io.Reader)7 Writer (java.io.Writer)7 ArrayList (java.util.ArrayList)6 Path (org.apache.hadoop.fs.Path)6 FileWriter (java.io.FileWriter)5 Option (org.apache.commons.cli.Option)3 CoordinatorJob (org.apache.oozie.client.CoordinatorJob)3 FileOutputStream (java.io.FileOutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 Map (java.util.Map)2 CoordinatorAction (org.apache.oozie.client.CoordinatorAction)2 WorkflowJob (org.apache.oozie.client.WorkflowJob)2 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1