/** * Get a component opt as a boolean using {@link Boolean#valueOf(String)}. * * @param name component name * @param option option name * @param defVal default value * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ public boolean getComponentOptBool(String name, String option, boolean defVal) { String val = getComponentOpt(name, option, Boolean.toString(defVal)); return Boolean.valueOf(val); }
/** * Get a component opt as a boolean using {@link Boolean#valueOf(String)}. * * @param name component name * @param option option name * @param defVal default value * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ public boolean getComponentOptBool(String name, String option, boolean defVal) { String val = getComponentOpt(name, option, Boolean.toString(defVal)); return Boolean.valueOf(val); }
/** * Get a component opt; use {@link Integer#decode(String)} so as to take hex * oct and bin values too. * * @param name component name * @param option option name * @param defVal default value * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ public int getComponentOptInt(String name, String option, int defVal) { String val = getComponentOpt(name, option, Integer.toString(defVal)); return Integer.decode(val); }
/** * Get a component opt; use {@link Integer#decode(String)} so as to take hex * oct and bin values too. * * @param name component name * @param option option name * @param defVal default value * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ public int getComponentOptInt(String name, String option, int defVal) { String val = getComponentOpt(name, option, Integer.toString(defVal)); return Integer.decode(val); }
/** * Get a component opt; use {@link Long#decode(String)} so as to take hex * oct and bin values too. * * @param name component name * @param option option name * @param defVal default value * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ public long getComponentOptLong(String name, String option, long defVal) { String val = getComponentOpt(name, option, Long.toString(defVal)); return Long.decode(val); }
static String getMetainfoComponentName(String roleGroup, ConfTreeOperations appConf) throws BadConfigException { String prefix = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, null); if (prefix == null) { return roleGroup; } if (!roleGroup.startsWith(prefix)) { throw new BadConfigException("Component " + roleGroup + " doesn't start" + " with prefix " + prefix); } return roleGroup.substring(prefix.length()); } }
static String getMetainfoComponentName(String roleGroup, ConfTreeOperations appConf) throws BadConfigException { String prefix = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, null); if (prefix == null) { return roleGroup; } if (!roleGroup.startsWith(prefix)) { throw new BadConfigException("Component " + roleGroup + " doesn't start" + " with prefix " + prefix); } return roleGroup.substring(prefix.length()); } }
/** * Get the value of a YARN requirement (cores, RAM, etc). * These are returned as integers, but there is special handling of the * string {@link ResourceKeys#YARN_RESOURCE_MAX}, which triggers * the return of the maximum value. * @param group component to get from * @param option option name * @param defVal default value * @param maxVal value to return if the max val is requested * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ private int getResourceRequirement(ConfTreeOperations resources, String group, String option, int defVal, int maxVal) { String val = resources.getComponentOpt(group, option, Integer.toString(defVal)); Integer intVal; if (YARN_RESOURCE_MAX.equals(val)) { intVal = maxVal; } else { intVal = Integer.decode(val); } return intVal; }
/** * Get the value of a YARN requirement (cores, RAM, etc). * These are returned as integers, but there is special handling of the * string {@link ResourceKeys#YARN_RESOURCE_MAX}, which triggers * the return of the maximum value. * @param group component to get from * @param option option name * @param defVal default value * @param maxVal value to return if the max val is requested * @return parsed value * @throws NumberFormatException if the role could not be parsed. */ private int getResourceRequirement(ConfTreeOperations resources, String group, String option, int defVal, int maxVal) { String val = resources.getComponentOpt(group, option, Integer.toString(defVal)); Integer intVal; if (YARN_RESOURCE_MAX.equals(val)) { intVal = maxVal; } else { intVal = Integer.decode(val); } return intVal; }
protected Map<String, DefaultConfig> getDefaultConfigs(String roleGroup) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); return metaInfoMap.get(mapKey).defaultConfigs; }
protected Map<String, DefaultConfig> getDefaultConfigs(String roleGroup) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); String mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); return metaInfoMap.get(mapKey).defaultConfigs; }
@VisibleForTesting protected Metainfo getMetaInfo(String roleGroup) { String mapKey = DEFAULT_METAINFO_MAP_KEY; if (roleGroup != null) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); } MetainfoHolder mh = this.metaInfoMap.get(mapKey); if (mh == null) { return null; } return mh.metaInfo; }
@VisibleForTesting protected Metainfo getMetaInfo(String roleGroup) { String mapKey = DEFAULT_METAINFO_MAP_KEY; if (roleGroup != null) { ConfTreeOperations appConf = getAmState().getAppConfSnapshot(); mapKey = appConf.getComponentOpt(roleGroup, ROLE_PREFIX, DEFAULT_METAINFO_MAP_KEY); } MetainfoHolder mh = this.metaInfoMap.get(mapKey); if (mh == null) { return null; } return mh.metaInfo; }
for (String component : resources.getComponentNames()) { String prefix = SliderUtils.trimPrefix( resources.getComponentOpt(component, ROLE_PREFIX, null)); if (prefix != null) { rolePrefixMap.put(component, prefix);
for (String component : resources.getComponentNames()) { String prefix = SliderUtils.trimPrefix( resources.getComponentOpt(component, ROLE_PREFIX, null)); if (prefix != null) { rolePrefixMap.put(component, prefix);
tokens.put("${ZK_HOST}", appConf.get(OptionKeys.ZOOKEEPER_HOSTS)); tokens.put("${DEFAULT_ZK_PATH}", appConf.get(OptionKeys.ZOOKEEPER_PATH)); String prefix = appConf.getComponentOpt(componentGroup, ROLE_PREFIX, null); String dataDirSuffix = "";
tokens.put("${ZK_HOST}", appConf.get(OptionKeys.ZOOKEEPER_HOSTS)); tokens.put("${DEFAULT_ZK_PATH}", appConf.get(OptionKeys.ZOOKEEPER_PATH)); String prefix = appConf.getComponentOpt(componentGroup, ROLE_PREFIX, null); String dataDirSuffix = "";
composedConfigName = containerName + "." + configName; appConfigValue = appConf.getComponentOpt(roleGroup, composedConfigName, null); log.debug(
composedConfigName = containerName + "." + configName; appConfigValue = appConf.getComponentOpt(roleGroup, composedConfigName, null); log.debug(
.getComponentOpt(role.getGroup(), ROLE_PREFIX, null); if (SliderUtils.isSet(prefix)) { cd.setRoleOpt(rolename, ROLE_PREFIX, SliderUtils.trimPrefix(prefix));