public void updateSensorConfigs( ) throws Exception { CuratorFramework client = ConfigurationsUtils.getClient(getZkQuorum()); try { client.start(); updateSensorConfigs(new ZKSourceConfigHandler(client), sensorToFieldList); } finally { client.close(); } }
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(); } } }
, SensorEnrichmentUpdateConfig.class ); sensorEnrichmentUpdateConfig.updateSensorConfigs();
SensorEnrichmentUpdateConfig.updateSensorConfigs(scHandler, threatIntelConfig.getSensorToFieldList()); Assert.assertNotNull(finalEnrichmentConfig.get("bro")); Assert.assertNotSame(finalEnrichmentConfig.get("bro"), broSc);
SensorEnrichmentUpdateConfig.updateSensorConfigs(scHandler, config.getSensorToFieldList()); Assert.assertNotNull(outputScs.get("bro")); Assert.assertNotSame(outputScs.get("bro"), broSc);