Ejemplo n.º 1
0
 private List<Exporter> getExportersToRun(String exporters) {
   List<Exporter> results = new ArrayList<>();
   for (String exporterString : exporters.split(",")) {
     Exporter e = null;
     for (Exporter exporter : EXPORTERS) {
       if (exporter.getObjectClass().getSimpleName().equalsIgnoreCase(exporterString)) {
         e = exporter;
         break;
       }
     }
     if (e == null) {
       throw new RuntimeException("invalid exporter: " + exporterString);
     }
     results.add(e);
   }
   return results;
 }
Ejemplo n.º 2
0
  private void run() throws Exception {
    LOGGER.info("begin export");
    List<Exporter> exportersToRun = getExportersToRun(exporters);
    for (Exporter exporter : exportersToRun) {
      LOGGER.info("Preparing to run: %s", exporter.getClass().getSimpleName());
    }

    hadoopConfiguration = new Configuration(true);
    destinationPath = new Path(destination);
    fs = getFileSystem(hadoopConfiguration);
    sqlRunner = createSqlRunner();
    sqlRunner.connect();
    try {
      for (Exporter exporter : exportersToRun) {
        LOGGER.info("Running: %s", exporter.getClass().getSimpleName());
        exporter.run(this);
      }
    } finally {
      sqlRunner.close();
    }
    LOGGER.info("export complete!");
  }