/** * Check key in current Props then search in parent */ public boolean containsKey(final Object k) { return this._current.containsKey(k) || (this._parent != null && this._parent.containsKey(k)); }
public boolean loadProjectWhiteList() { if (this.props.containsKey(ProjectWhitelist.XML_FILE_PARAM)) { ProjectWhitelist.load(this.props); return true; } return false; } }
/** * Returns the double representation of the value. If the value is null, then the default value is * returned. If the value isn't a double, then a parse exception will be thrown. */ public double getDouble(final String name, final double defaultValue) { if (containsKey(name)) { return Double.parseDouble(get(name).trim()); } else { return defaultValue; } }
/** * Gets the class from the Props. If it doesn't exist, it will return the defaultClass */ public Class<?> getClass(final String key, final Class<?> defaultClass) { if (containsKey(key)) { return getClass(key); } else { return defaultClass; } }
/** * Gets the string from the Props. If it doesn't exist, it will return the defaultValue */ public String getString(final String key, final String defaultValue) { if (containsKey(key)) { return get(key); } else { return defaultValue; } }
/** * Returns a list of strings with the sep as the separator of the value. If the value is null, * it'll return the defaultValue. */ public List<String> getStringList(final String key, final List<String> defaultValue, final String sep) { if (containsKey(key)) { return getStringList(key, sep); } else { return defaultValue; } }
/** * Returns true if the value equals "true". If the value is null, then the default value is * returned. */ public boolean getBoolean(final String key, final boolean defaultValue) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key).trim()); } else { return defaultValue; } }
/** * Returns the long representation of the value. If the value is null, then the default value is * returned. If the value isn't a long, then a parse exception will be thrown. */ public long getLong(final String name, final long defaultValue) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { return defaultValue; } }
/** * Returns the int representation of the value. If the value is null, then the default value is * returned. If the value isn't a int, then a parse exception will be thrown. */ public int getInt(final String name, final int defaultValue) { if (containsKey(name)) { return Integer.parseInt(get(name).trim()); } else { return defaultValue; } }
/** * Returns the double representation of the value. If the value is null, then the default value is * returned. If the value isn't a uri, then a IllegalArgumentException will be thrown. */ public URI getUri(final String name, final URI defaultValue) { if (containsKey(name)) { return getUri(name); } else { return defaultValue; } }
/** * Returns a list of strings with the comma as the separator of the value. If the value is null, * it'll return the defaultValue. */ public List<String> getStringList(final String key, final List<String> defaultValue) { if (containsKey(key)) { return getStringList(key); } else { return defaultValue; } }
protected List<String> getCommandList() { final List<String> commands = new ArrayList<>(); commands.add(this.jobProps.getString(COMMAND)); for (int i = 1; this.jobProps.containsKey(COMMAND + "." + i); i++) { commands.add(this.jobProps.getString(COMMAND + "." + i)); } return commands; }
public Class<?> getClass(final String key, final boolean initialize, final ClassLoader cl) { try { if (containsKey(key)) { return Class.forName(get(key), initialize, cl); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } catch (final ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
/** * Returns the int representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a int, then a parse exception * will be thrown. */ public int getInt(final String name) { if (containsKey(name)) { return Integer.parseInt(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns the double representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a double, then a parse exception * will be thrown. */ public double getDouble(final String name) { if (containsKey(name)) { return Double.parseDouble(get(name).trim()); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
/** * Returns true if the value equals "true". If the value is null, then an * UndefinedPropertyException is thrown. */ public boolean getBoolean(final String key) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
/** * Returns the long representation of the value. If the value is null, then a * UndefinedPropertyException will be thrown. If the value isn't a long, then a parse exception * will be thrown. */ public long getLong(final String name) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
public static String getExternalLogViewer(final Props azkProps, final String jobId, final Props jobProps) { // If no topic was configured to be an external analyzer, return empty if (!azkProps .containsKey(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_LOGVIEWER_TOPIC)) { return ""; } // Find out which external link we should use to lead to our log viewer final String topic = azkProps .getString(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_LOGVIEWER_TOPIC); return getLinkFromJobAndExecId(topic, azkProps, jobId, jobProps); }
/** * Gets the string from the Props. If it doesn't exist, throw and UndefinedPropertiesException */ public String getString(final String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
public static String getExternalAnalyzerOnReq(final Props azkProps, final HttpServletRequest req) { // If no topic was configured to be an external analyzer, return empty if (!azkProps.containsKey(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC)) { return ""; } // Find out which external link we should use to lead to our analyzer final String topic = azkProps .getString(Constants.ConfigurationKeys.AZKABAN_SERVER_EXTERNAL_ANALYZER_TOPIC); return getLinkFromRequest(topic, azkProps, req); }