public static void updateSensorIndexingConfigsFromZookeeper(IndexingConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , INDEXING , sensorType -> configurations.updateSensorIndexingConfig(sensorType, readSensorIndexingConfigBytesFromZookeeper(sensorType, client)) , client ); }
public static void updateEnrichmentConfigsFromZookeeper(EnrichmentConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , ENRICHMENT , sensorType -> configurations.updateSensorEnrichmentConfig(sensorType, readSensorEnrichmentConfigBytesFromZookeeper(sensorType, client)) , client ); }
public static void updateParserConfigsFromZookeeper(ParserConfigurations configurations, CuratorFramework client) throws Exception { updateConfigsFromZookeeper( configurations , PARSER , sensorType -> configurations.updateSensorParserConfig(sensorType, readSensorParserConfigBytesFromZookeeper(sensorType, client)) , client ); }
@Override public ParserConfigurations getConfigurations() { ParserConfigurations configurations = new ParserConfigurations(); SensorParserConfig sensorParserConfig = new SensorParserConfig(); sensorParserConfig.setParserConfig(new HashMap<String, Object>() {{ put(IndexingConfigurations.BATCH_SIZE_CONF, 10); }}); configurations.updateSensorParserConfig("yaf", sensorParserConfig); return configurations; } };
@Override public Map<String, Object> getSensorConfig(String sensorName) { return config.getSensorParserConfig(sensorName).getParserConfig(); }
public static void writeSensorParserConfigToZookeeper(String sensorType, byte[] configData, CuratorFramework client) throws Exception { SensorParserConfig c = (SensorParserConfig) PARSER.deserialize(new String(configData)); c.init(); writeToZookeeper(PARSER.getZookeeperRoot() + "/" + sensorType, configData, client); }
public static Configurations getSampleConfigs() throws IOException { Configurations configurations = new Configurations(); configurations.updateGlobalConfig(ConfigurationsUtils.readGlobalConfigFromFile(TestConstants.SAMPLE_CONFIG_PATH)); return configurations; }
public static byte[] readGlobalConfigBytesFromZookeeper(CuratorFramework client) throws Exception { return readFromZookeeper(GLOBAL.getZookeeperRoot(), client); }
public void init() { for(FieldTransformer h : getFieldTransformations()) { h.initAndValidate(); } }
public static void updateConfigsFromZookeeper(Configurations configurations, CuratorFramework client) throws Exception { configurations.updateGlobalConfig(readGlobalConfigBytesFromZookeeper(client)); }
public void updateGlobalConfig(Map<String, Object> globalConfig) { if(globalConfig != null) { getConfigurations().put(ConfigurationType.GLOBAL.getTypeName(), globalConfig); validations = FieldValidator.readValidations(getGlobalConfig()); } }
/** * Pulled from global config * Note: enrichment writes out to 1 kafka topic, so it is not pulling this config by sensor. * * @return batch timeout for writing to kafka * @see org.apache.metron.common.configuration.EnrichmentConfigurations#BATCH_TIMEOUT_CONF */ public int getBatchTimeout() { return getAs(BATCH_TIMEOUT_CONF, getGlobalConfig(true), 0, Integer.class); }
public static int getBatchSize(Map<String, Object> conf) { return getAs( BATCH_SIZE_CONF ,conf , 1 , Integer.class ); }
@Override public void writeSensorConfigToZookeeper(String sensorType, byte[] configData, CuratorFramework client) throws Exception { ops.writeSensorConfigToZookeeper(sensorType, configData, client); }
/** * Dumps all config * @param client * @throws Exception */ public void dump(CuratorFramework client) throws Exception { ConfigurationsUtils.dumpConfigs(System.out, client); }
@Override public String toString() { return "Configurations{" + "validations=" + validations + ", configurations=" + getConfigurations()+ '}'; } }
public static byte[] readSensorEnrichmentConfigBytesFromZookeeper(String sensorType, CuratorFramework client) throws Exception { return readFromZookeeper(ENRICHMENT.getZookeeperRoot() + "/" + sensorType, client); }
public static byte[] readProfilerConfigBytesFromZookeeper(CuratorFramework client) throws Exception { return readFromZookeeper(PROFILER.getZookeeperRoot(), client); }
public static byte[] readSensorParserConfigBytesFromZookeeper(String sensorType, CuratorFramework client) throws Exception { return readFromZookeeper(PARSER.getZookeeperRoot() + "/" + sensorType, client); }
public static byte[] readSensorIndexingConfigBytesFromZookeeper(String sensorType, CuratorFramework client) throws Exception { return readFromZookeeper(INDEXING.getZookeeperRoot() + "/" + sensorType, client); }