/** * Get a single map config. * * @param configKey * @return configuration value map, or NULL if not exist. */ public Map<String, String> getMapConfig(String configKey) { return getRecord().getMapField(configKey); }
/** * Determine whether the given config key is in the simple config * @param configKey The key to check whether exists * @return True if exists, otherwise false */ public boolean simpleConfigContains(String configKey) { return getRecord().getSimpleFields().containsKey(configKey); }
/** * Get all simple configurations. * * @return all simple configurations. */ public Map<String, String> getSimpleConfigs() { return Collections.unmodifiableMap(getRecord().getSimpleFields()); }
/** * Put a set of simple configs. * * @param configsMap */ public void putSimpleConfigs(Map<String, String> configsMap) { getRecord().getSimpleFields().putAll(configsMap); }
/** * Determine whether the given config key is the map config * @param configKey The key to check whether exists * @return True if exists, otherwise false */ public boolean mapConfigContains(String configKey) { return getRecord().getMapFields().containsKey(configKey); }
/** * Get all simple configurations. * * @return all simple configurations. */ public Map<String, String> getSimpleConfigs() { return Collections.unmodifiableMap(getRecord().getSimpleFields()); }
/** * Get a single simple config value. * * @param configKey * @return configuration value, or NULL if not exist. */ public String getSimpleConfig(String configKey) { return getRecord().getSimpleFields().get(configKey); }
/** * Put a set of simple configs. * * @param configsMap */ public void putSimpleConfigs(Map<String, String> configsMap) { getRecord().getSimpleFields().putAll(configsMap); }
/** * Put a single simple config value. * * @param configKey * @param configVal */ public void putSimpleConfig(String configKey, String configVal) { getRecord().getSimpleFields().put(configKey, configVal); }
/** * Get a single map config. * * @param configKey * @return configuration value map, or NULL if not exist. */ public Map<String, String> getMapConfig(String configKey) { return getRecord().getMapField(configKey); }
/** * Put a single map config. * * @param configKey * @param configValMap */ public void putMapConfig(String configKey, Map<String, String> configValMap) { getRecord().setMapField(configKey, configValMap); }
/** * Get the stored map fields * @return a map of map fields */ public Map<String, Map<String, String>> getMapConfigs() { return getRecord().getMapFields(); }
/** * Get a single simple config value. * * @param configKey * @return configuration value, or NULL if not exist. */ public String getSimpleConfig(String configKey) { return getRecord().getSimpleFields().get(configKey); }
/** * Put a single map config. * * @param configKey * @param configValMap */ public void putMapConfig(String configKey, Map<String, String> configValMap) { getRecord().setMapField(configKey, configValMap); }
/** * Determine whether the given config key is in the simple config * @param configKey The key to check whether exists * @return True if exists, otherwise false */ public boolean simpleConfigContains(String configKey) { return getRecord().getSimpleFields().containsKey(configKey); }
/** * Determine whether the given config key is the map config * @param configKey The key to check whether exists * @return True if exists, otherwise false */ public boolean mapConfigContains(String configKey) { return getRecord().getMapFields().containsKey(configKey); }
/** * Get the stored map fields * @return a map of map fields */ public Map<String, Map<String, String>> getMapConfigs() { return getRecord().getMapFields(); }
/** * Put a single simple config value. * * @param configKey * @param configVal */ public void putSimpleConfig(String configKey, String configVal) { getRecord().getSimpleFields().put(configKey, configVal); }
@GET @Path("{resourceName}/configs") public Response getResourceConfig(@PathParam("clusterId") String clusterId, @PathParam("resourceName") String resourceName) { ConfigAccessor accessor = getConfigAccessor(); ResourceConfig resourceConfig = accessor.getResourceConfig(clusterId, resourceName); if (resourceConfig != null) { return JSONRepresentation(resourceConfig.getRecord()); } return notFound(); }
/** * Create the resource config. Fails if it already exists in ZK. * @param accessor * @param resource * @param resourceConfig * @return */ private static boolean createResourceConfig(HelixDataAccessor accessor, String resource, ResourceConfig resourceConfig) { PropertyKey.Builder keyBuilder = accessor.keyBuilder(); return accessor.getBaseDataAccessor().create(keyBuilder.resourceConfig(resource).getPath(), resourceConfig.getRecord(), AccessOption.PERSISTENT); }