/** * Creates a new instance of {@link SystemAdmins} with an empty admin mapping. * @return New empty instance of {@link SystemAdmins} */ public static SystemAdmins empty() { return new SystemAdmins(new MapConfig()); }
@Override public Config sanitize() { return new MapConfig(sanitizeMap()); }
@Override public String toString() { return sanitizeMap().toString(); } }
@Override public String toString() { return sanitizeMap().toString(); } }
/** * Creates a new instance of {@link SystemAdmins} with an empty admin mapping. * @return New empty instance of {@link SystemAdmins} */ public static SystemAdmins empty() { return new SystemAdmins(new MapConfig()); }
/** * @return The bootstrapped configuration that's been read after bootstrap has * been invoked. */ public Config getConfig() { if (isBootstrapped) { return new MapConfig(configMap); } else { throw new SamzaException("Must call bootstrap before retrieving config."); } }
static Config mergeConfig(Map<String, String> originalConfig, Map<String, String> generatedConfig) { Map<String, String> mergedConfig = new HashMap<>(generatedConfig); originalConfig.forEach((k, v) -> { if (generatedConfig.containsKey(k) && !Objects.equals(generatedConfig.get(k), v)) { LOG.info("Replacing generated config for key: {} value: {} with original config value: {}", k, generatedConfig.get(k), v); } mergedConfig.put(k, v); }); return Util.rewriteConfig(new MapConfig(mergedConfig)); }
public Config regexSubset(String regex) { Map<String, String> out = new HashMap<String, String>(); Pattern pattern = Pattern.compile(regex); for (Entry<String, String> entry : entrySet()) { String k = entry.getKey(); Matcher matcher = pattern.matcher(k); if (matcher.find()) { out.put(k, entry.getValue()); } } return new MapConfig(out); }
public Config regexSubset(String regex) { Map<String, String> out = new HashMap<String, String>(); Pattern pattern = Pattern.compile(regex); for (Entry<String, String> entry : entrySet()) { String k = entry.getKey(); Matcher matcher = pattern.matcher(k); if (matcher.find()) { out.put(k, entry.getValue()); } } return new MapConfig(out); }
static Config mergeConfig(Map<String, String> originalConfig, Map<String, String> generatedConfig) { Map<String, String> mergedConfig = new HashMap<>(generatedConfig); originalConfig.forEach((k, v) -> { if (generatedConfig.containsKey(k) && !Objects.equals(generatedConfig.get(k), v)) { LOG.info("Replacing generated config for key: {} value: {} with original config value: {}", k, generatedConfig.get(k), v); } mergedConfig.put(k, v); }); return Util.rewriteConfig(new MapConfig(mergedConfig)); }
static Config mergeConfig(Map<String, String> originalConfig, Map<String, String> generatedConfig) { Map<String, String> mergedConfig = new HashMap<>(generatedConfig); originalConfig.forEach((k, v) -> { if (generatedConfig.containsKey(k) && !Objects.equals(generatedConfig.get(k), v)) { LOG.info("Replacing generated config for key: {} value: {} with original config value: {}", k, generatedConfig.get(k), v); } mergedConfig.put(k, v); }); return Util.rewriteConfig(new MapConfig(mergedConfig)); }
public Config subset(String prefix, boolean stripPrefix) { Map<String, String> out = new HashMap<String, String>(); for (Entry<String, String> entry : entrySet()) { String k = entry.getKey(); if (k != null && k.startsWith(prefix)) { if (stripPrefix) { k = k.substring(prefix.length()); } out.put(k, entry.getValue()); } } return new MapConfig(out); }
private UdfResolver createUdfResolver(Map<String, String> config) { String udfResolveValue = config.get(CFG_UDF_RESOLVER); Validate.notEmpty(udfResolveValue, "udfResolver config is not set or empty"); HashMap<String, String> domainConfig = getDomainProperties(config, String.format(CFG_FMT_UDF_RESOLVER_DOMAIN, udfResolveValue), false); Properties props = new Properties(); props.putAll(domainConfig); HashMap<String, String> udfConfig = getDomainProperties(config, CFG_UDF_CONFIG_DOMAIN, false); return new ConfigBasedUdfResolver(props, new MapConfig(udfConfig)); }
public MockContext() { this(new MapConfig( Collections.singletonMap("metrics.timer.debug.enabled", "true") )); }
@Override public Config deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new MapConfig(OBJECT_MAPPER.<Map<String, String>>readValue(node, new TypeReference<Map<String, String>>() { })); } }
@Override public Config deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new MapConfig(OBJECT_MAPPER.<Map<String, String>>readValue(node, new TypeReference<Map<String, String>>() { })); } }
@Override public Config deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new MapConfig(OBJECT_MAPPER.<Map<String, String>>readValue(node, new TypeReference<Map<String, String>>() { })); } }
private Config getConfig() { Map<String, String> map = new HashMap<>(); map.putAll(config); return new MapConfig(map); }
private static Config getConfig() { Map<String, String> configMap = new HashMap<>(); configMap.put(AzureConfig.AZURE_STORAGE_CONNECT, storageConnectionString); return new MapConfig(configMap); }
private Config buildConfigForContainerCount(int count) { Map<String, String> map = new HashMap<>(); map.put("job.container.count", String.valueOf(count)); return new MapConfig(map); }