use of org.apache.metron.dataloads.nonbulk.flatfile.importer.ImportStrategy in project metron by apache.
the class SimpleEnrichmentFlatFileLoader method main.
public static void main(Configuration hadoopConfig, String[] argv) throws Exception {
CommandLine cli = LoadOptions.parse(new PosixParser(), argv);
EnumMap<LoadOptions, Optional<Object>> config = LoadOptions.createConfig(cli);
if (LoadOptions.LOG4J_PROPERTIES.has(cli)) {
PropertyConfigurator.configure(LoadOptions.LOG4J_PROPERTIES.get(cli));
}
ExtractorHandler handler = ExtractorHandler.load(FileUtils.readFileToString(new File(LoadOptions.EXTRACTOR_CONFIG.get(cli).trim())));
ImportStrategy strategy = (ImportStrategy) config.get(LoadOptions.IMPORT_MODE).get();
strategy.getImporter().importData(config, handler, hadoopConfig);
SensorEnrichmentUpdateConfig sensorEnrichmentUpdateConfig = null;
if (LoadOptions.ENRICHMENT_CONFIG.has(cli)) {
sensorEnrichmentUpdateConfig = JSONUtils.INSTANCE.load(new File(LoadOptions.ENRICHMENT_CONFIG.get(cli)), SensorEnrichmentUpdateConfig.class);
}
if (sensorEnrichmentUpdateConfig != null) {
sensorEnrichmentUpdateConfig.updateSensorConfigs();
}
}
Aggregations