/** * The number of unique keys defined by this Props and all parent Props */ public int size() { return getKeySet().size(); }
/** * Returns a set of all keys, including the parents */ public Set<String> getKeySet() { final HashSet<String> keySet = new HashSet<>(); keySet.addAll(localKeySet()); if (this._parent != null) { keySet.addAll(this._parent.getKeySet()); } return keySet; }
/** * Logs the property in the given logger */ public void logProperties(final Logger logger, final String comment) { logger.info(comment); for (final String key : getKeySet()) { logger.info(" key=" + key + " value=" + get(key)); } }
/** * Returns true if the properties are equivalent, regardless of the hierarchy. */ public boolean equalsProps(final Props p) { if (p == null) { return false; } final Set<String> myKeySet = getKeySet(); for (final String s : myKeySet) { if (!get(s).equals(p.get(s))) { return false; } } return myKeySet.size() == p.getKeySet().size(); }
public static Map<String, String> toStringMap(final Props props, final boolean localOnly) { final HashMap<String, String> map = new HashMap<>(); final Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet(); for (final String key : keyset) { final String value = props.get(key); map.put(key, value); } return map; }
/** * Put all properties in the props into the current props. Will handle null p. */ public void putAll(final Props p) { if (p == null) { return; } for (final String key : p.getKeySet()) { this.put(key, p.get(key)); } }
public static Props resolveProps(final Props props) { if (props == null) { return null; } final Props resolvedProps = new Props(); final LinkedHashSet<String> visitedVariables = new LinkedHashSet<>(); for (final String key : props.getKeySet()) { String value = props.get(key); if (value == null) { logger.warn("Null value in props for key '" + key + "'. Replacing with empty string."); value = ""; } visitedVariables.add(key); final String replacedValue = resolveVariableReplacement(value, props, visitedVariables); visitedVariables.clear(); resolvedProps.put(key, replacedValue); } for (final String key : resolvedProps.getKeySet()) { final String value = resolvedProps.get(key); final String expressedValue = resolveVariableExpression(value); resolvedProps.put(key, expressedValue); } return resolvedProps; }
for (final String k : pluginJobProps.getKeySet()) { if (!jobProps.containsKey(k)) { jobProps.put(k, pluginJobProps.get(k));
new ArrayList<>(); for (final String key : prop.getKeySet()) { final String value = prop.get(key); parameters.add(new Pair<>(key, value));
new ArrayList<>(); for (final String key : jobProp.getKeySet()) { final String value = jobProp.get(key); parameters.add(new Pair<>(key, value));
/** * The number of unique keys defined by this Props and all parent Props */ public int size() { return getKeySet().size(); }
/** * The number of unique keys defined by this Props and all parent Props * * @return the int */ public int size() { return getKeySet().size(); }
/** * Logs the property in the given logger * * @param logger the logger * @param comment the comment */ public void logProperties(final Logger logger, final String comment) { logger.info(comment); for (final String key : getKeySet()) { logger.info(" key=" + key + " value=" + get(key)); } }
/** * Logs the property in the given logger * * @param logger * @param comment */ public void logProperties(Logger logger, String comment) { logger.info(comment); for (String key : getKeySet()) { logger.info(" key=" + key + " value=" + get(key)); } }
public static Map<String, String> toStringMap(Props props, boolean localOnly) { HashMap<String, String> map = new HashMap<String, String>(); Set<String> keyset = localOnly ? props.localKeySet() : props.getKeySet(); for (String key: keyset) { String value = props.get(key); map.put(key, value); } return map; }
/** * Put all properties in the props into the current props. Will handle null p. * * @param p the p */ public void putAll(final Props p) { if (p == null) { return; } for (final String key : p.getKeySet()) { this.put(key, p.get(key)); } }
public static Props resolveProps(Props props) { if (props == null) return null; Props resolvedProps = new Props(); LinkedHashSet<String> visitedVariables = new LinkedHashSet<String>(); for (String key : props.getKeySet()) { String value = props.get(key); visitedVariables.add(key); String replacedValue = resolveVariableReplacement(value, props, visitedVariables); visitedVariables.clear(); resolvedProps.put(key, replacedValue); } return resolvedProps; };
private void appendProps(Set<String> suppressed) { AzkabanProcessBuilder builder = this.getBuilder(); Props props = getJobProps(); for (String key : props.getKeySet()) { if (!suppressed.contains(key)) { builder.addArg("--" + key, props.get(key)); } } } }