code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
private static Props copyNext(final Props source) { Props priorNodeCopy = null; if (source.getParent() != null) { priorNodeCopy = copyNext(source.getParent()); } final Props dest = new Props(priorNodeCopy); for (final String key : source.localKeySet()) { dest.put(key, source.get(key)); ...
Recursive Clone function of Props @param source the source Props object @return the cloned Props object
copyNext
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public static Props getInstance(Props parent, Props current, String source) { Props props = new Props(parent, current); props.setSource(source); return props; }
Create a new Props instance @param parent parent props @param current current props @param source source value @return new Prop Instance
getInstance
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
private void loadFrom(final InputStream inputStream) throws IOException { final Properties properties = new Properties(); properties.load(inputStream); this.put(properties); }
load this Prop Object from a @Properties formatted InputStream @param inputStream inputStream for loading Properties Object @throws IOException read exception
loadFrom
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Props getEarliestAncestor() { if (this._parent == null) { return this; } return this._parent.getEarliestAncestor(); }
Get the Root Props Object @return the root Props Object or this Props itself
getEarliestAncestor
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void setEarliestAncestor(final Props parent) { final Props props = getEarliestAncestor(); props.setParent(parent); }
Set the Props Object as the root of this Props Object @param parent the earliest ancestor Props Object
setEarliestAncestor
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public boolean containsKey(final Object k) { return this._current.containsKey(k) || (this._parent != null && this._parent.containsKey(k)); }
Check key in current Props then search in parent
containsKey
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public boolean containsValue(final Object value) { return this._current.containsValue(value) || (this._parent != null && this._parent.containsValue(value)); }
Check value in current Props then search in parent
containsValue
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public String get(final Object key) { if (this._current.containsKey(key)) { return this._current.get(key); } else if (this._parent != null) { return this._parent.get(key); } else { return null; } }
Return value if available in current Props otherwise return from parent
get
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Set<String> localKeySet() { return this._current.keySet(); }
Get the key set from the current Props
localKeySet
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public String put(final String key, final String value) { return this._current.put(key, value); }
Put the given string value for the string key. This method performs any variable substitution in the value replacing any occurance of ${name} with the value of get("name"). @param key The key to put the value to @param value The value to do substitution on and store @throws IllegalArgumentException If the variable giv...
put
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void put(final Properties properties) { for (final String propName : properties.stringPropertyNames()) { this._current.put(propName, properties.getProperty(propName)); } }
Put the given Properties into the Props. This method performs any variable substitution in the value replacing any occurrence of ${name} with the value of get("name"). get() is called first on the Props and next on the Properties object. @param properties The properties to put @throws IllegalArgumentException If the v...
put
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void putAll(final Map<? extends String, ? extends String> m) { if (m == null) { return; } for (final Map.Entry<? extends String, ? extends String> entry : m.entrySet()) { this.put(entry.getKey(), entry.getValue()); } }
Put everything in the map into the props.
putAll
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void putAll(final Props p) { if (p == null) { return; } for (final String key : p.getKeySet()) { this.put(key, p.get(key)); } }
Put all properties in the props into the current props. Will handle null p.
putAll
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void putLocal(final Props p) { for (final String key : p.localKeySet()) { this.put(key, p.get(key)); } }
Puts only the local props from p into the current properties
putLocal
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public String removeLocal(final Object s) { return this._current.remove(s); }
Remove only the local value of key s, and not the parents.
removeLocal
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public int size() { return getKeySet().size(); }
The number of unique keys defined by this Props and all parent Props
size
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public int localSize() { return this._current.size(); }
The number of unique keys defined by this Props (keys defined only in parent Props are not counted)
localSize
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Class<?> getClass(final String key) { try { if (containsKey(key)) { return Class.forName(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } } catch (final ClassNotFoundException e) { throw new IllegalA...
Attempts to return the Class that corresponds to the Props value. If the class doesn't exit, an IllegalArgumentException will be thrown.
getClass
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
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 + "'"); } } c...
Attempts to return the Class that corresponds to the Props value. If the class doesn't exit, an IllegalArgumentException will be thrown.
getClass
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Class<?> getClass(final String key, final Class<?> defaultClass) { if (containsKey(key)) { return getClass(key); } else { return defaultClass; } }
Gets the class from the Props. If it doesn't exist, it will return the defaultClass
getClass
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public String getString(final String key, final String defaultValue) { if (containsKey(key)) { return get(key); } else { return defaultValue; } }
Gets the string from the Props. If it doesn't exist, it will return the defaultValue
getString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public String getString(final String key) { if (containsKey(key)) { return get(key); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
Gets the string from the Props. If it doesn't exist, throw and UndefinedPropertiesException
getString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public List<String> getStringList(final String key) { return getStringList(key, "\\s*,\\s*"); }
Returns a list of strings with the comma as the separator of the value
getStringList
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public List<String> getStringListFromCluster(final String key) { final List<String> curlist = getStringList(key, "\\s*;\\s*"); // remove empty elements in the array for (final Iterator<String> iter = curlist.listIterator(); iter.hasNext(); ) { final String a = iter.next(); if (a.length() == 0) {...
Returns a list of clusters with the comma as the separator of the value e.g., for input string: "thrift://hcat1:port,thrift://hcat2:port;thrift://hcat3:port,thrift://hcat4:port;" we will get ["thrift://hcat1:port,thrift://hcat2:port", "thrift://hcat3:port,thrift://hcat4:port"] as output
getStringListFromCluster
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public List<String> getStringList(final String key, final String sep) { String val = get(key); if (val == null || (val = val.trim()).length() == 0) { return Collections.emptyList(); } return Arrays.asList(val.split(sep)); }
Returns a list of strings with the sep as the separator of the value
getStringList
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public List<String> getStringList(final String key, final List<String> defaultValue) { if (containsKey(key)) { return getStringList(key); } 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.
getStringList
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
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 a list of strings with the sep as the separator of the value. If the value is null, it'll return the defaultValue.
getStringList
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public boolean getBoolean(final String key, final boolean defaultValue) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key).trim()); } else { return defaultValue; } }
Returns true if the value equals "true". If the value is null, then the default value is returned.
getBoolean
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public boolean getBoolean(final String key) { if (containsKey(key)) { return "true".equalsIgnoreCase(get(key)); } else { throw new UndefinedPropertyException("Missing required property '" + key + "'"); } }
Returns true if the value equals "true". If the value is null, then an UndefinedPropertyException is thrown.
getBoolean
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public long getLong(final String name, final long defaultValue) { if (containsKey(name)) { return Long.parseLong(get(name)); } 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.
getLong
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public long getLong(final String name) { if (containsKey(name)) { return Long.parseLong(get(name)); } else { throw new UndefinedPropertyException("Missing required property '" + name + "'"); } }
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.
getLong
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public int getInt(final String name, final int defaultValue) { if (containsKey(name)) { return Integer.parseInt(get(name).trim()); } 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.
getInt
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
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 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.
getInt
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public double getDouble(final String name, final double defaultValue) { if (containsKey(name)) { return Double.parseDouble(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 double, then a parse exception will be thrown.
getDouble
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public double getDouble(final String name) { if (containsKey(name)) { return Double.parseDouble(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.
getDouble
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public URI getUri(final String name, final Boolean addTrailingSlash) { if (containsKey(name)) { try { String rawValue = get(name); if (rawValue == null) return null; String finalValue = !addTrailingSlash || rawValue.endsWith("/") ? rawValue : rawValue + "/"; return new URI(fin...
Returns the uri representation of the value. If the value is null, then an UndefinedPropertyException will be thrown. If the value isn't a uri, then an IllegalArgumentException will be thrown. If addTrailingSlash is true and the value isn't null, a trailing forward slash will be added to the URI.
getUri
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public URI getUri(final String name, final URI defaultValue, final Boolean addTrailingSlash) { if (containsKey(name)) { return getUri(name, addTrailingSlash); } 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. If addTrailingSlash is true and the value isn't null, a trailing forward slash will be added to the URI.
getUri
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public URI getUri(final String name, final String defaultValue) { try { return getUri(name, new URI(defaultValue)); } catch (final URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } }
Convert a URI-formatted string value to URI object
getUri
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void storeLocal(final File file) throws IOException { final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); try { storeLocal(out); } finally { out.close(); } }
Store only those properties defined at this local level @param file The file to write to @throws IOException If the file can't be found or there is an io error
storeLocal
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Props local() { return new Props(null, this._current); }
Returns a copy of only the local values of this props
local
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void storeLocal(final OutputStream out) throws IOException { final Properties p = new Properties(); for (final String key : this._current.keySet()) { p.setProperty(key, get(key)); } p.store(out, null); }
Store only those properties defined at this local level @param out The output stream to write to @throws IOException If the file can't be found or there is an io error
storeLocal
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Properties toProperties() { final Properties p = new Properties(); for (final String key : this._current.keySet()) { p.setProperty(key, get(key)); } return p; }
Returns a java.util.Properties file populated with the current Properties in here. Note: if you want to import parent properties (e.g., database credentials), please use toAllProperties
toProperties
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Properties toAllProperties() { final Properties allProp = new Properties(); // import local properties allProp.putAll(toProperties()); // import parent properties if (this._parent != null) { allProp.putAll(this._parent.toProperties()); } return allProp; }
Returns a java.util.Properties file populated with both current and parent properties.
toAllProperties
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void storeFlattened(final File file) throws IOException { final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); try { storeFlattened(out); } finally { out.close(); } }
Store all properties, those local and also those in parent props @param file The file to store to @throws IOException If there is an error writing
storeFlattened
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public void storeFlattened(final OutputStream out) throws IOException { final Properties p = new Properties(); for (Props curr = this; curr != null; curr = curr.getParent()) { for (final String key : curr.localKeySet()) { if (!p.containsKey(key)) { p.setProperty(key, get(key)); }...
Store all properties, those local and also those in parent props @param out The stream to write to @throws IOException If there is an error writing
storeFlattened
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Map<String, String> getFlattened() { final TreeMap<String, String> returnVal = new TreeMap<>(); returnVal.putAll(getMapByPrefix("")); return returnVal; }
Returns a new constructed map of all the flattened properties, the item in the returned map is sorted alphabetically by the key value. @Return a new constructed TreeMap (sorted map) of all properties (including parents' properties)
getFlattened
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Map<String, String> getMapByPrefix(final String prefix) { final Map<String, String> values = (this._parent == null) ? new HashMap<>() : this._parent.getMapByPrefix(prefix); // when there is a conflict, value from the child takes the priority. if (prefix == null) { // when prefix is n...
Get a new de-duplicated map of all the flattened properties by given prefix. The prefix will be removed in the return map's keySet. @param prefix the prefix string @return a new constructed de-duplicated HashMap of all properties (including parents' properties) with the give prefix
getMapByPrefix
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public Set<String> getKeySet() { final HashSet<String> keySet = new HashSet<>(); keySet.addAll(localKeySet()); if (this._parent != null) { keySet.addAll(this._parent.getKeySet()); } return keySet; }
Returns a set of all keys, including the parents
getKeySet
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
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
logProperties
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
@Override public int hashCode() { int code = this._current.hashCode(); if (this._parent != null) { code += this._parent.hashCode(); } return code; }
override object's default hash code function
hashCode
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Props.java
Apache-2.0
public static Props loadPropsInDir(final File dir, final String... suffixes) { return loadPropsInDir(null, dir, suffixes); }
Load job schedules from the given directories @param dir The directory to look in @param suffixes File suffixes to load @return The loaded set of schedules
loadPropsInDir
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) { try { final Props props = new Props(parent); final File[] files = dir.listFiles(); Arrays.sort(files); if (files != null) { for (final File f : files) { if (f.isFile() && ends...
Load job schedules from the given directories @param parent The parent properties for these properties @param dir The directory to look in @param suffixes File suffixes to load @return The loaded set of schedules
loadPropsInDir
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props loadProps(final Props parent, final File... propFiles) { try { Props props = new Props(parent); for (final File f : propFiles) { if (f.isFile()) { props = new Props(props, f); } } return props; } catch (final IOException e) { throw new...
Load Props @param parent parent prop @param propFiles prop files @return constructed new Prop
loadProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props loadPluginProps(final File pluginDir) { if (!pluginDir.exists()) { LOGGER.error("Error! Plugin path " + pluginDir.getPath() + " doesn't exist."); return null; } if (!pluginDir.isDirectory()) { LOGGER.error("The plugin path " + pluginDir + " is not a directory."); ...
Load plugin properties @param pluginDir plugin's Base Directory @return The properties
loadPluginProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props loadPropsInDirs(final List<File> dirs, final String... suffixes) { final Props props = new Props(); for (final File dir : dirs) { props.putLocal(loadPropsInDir(dir, suffixes)); } return props; }
Load job schedules from the given directories @param dirs The directories to check for properties @param suffixes The suffixes to load @return The properties
loadPropsInDirs
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static void loadPropsBySuffix(final File jobPath, final Props props, final String... suffixes) { try { if (jobPath.isDirectory()) { final File[] files = jobPath.listFiles(); if (files != null) { for (final File file : files) { loadPropsBySuffix(file, props, s...
Load properties from the given path @param jobPath The path to load from @param props The parent properties for loaded properties @param suffixes The suffixes of files to load
loadPropsBySuffix
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
private static boolean endsWith(final File file, final String... suffixes) { for (final String suffix : suffixes) { if (file.getName().endsWith(suffix)) { return true; } } return false; }
Load properties from the given path @param jobPath The path to load from @param props The parent properties for loaded properties @param suffixes The suffixes of files to load
endsWith
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static boolean isVariableReplacementPattern(final String value) { final Matcher matcher = VARIABLE_REPLACEMENT_PATTERN.matcher(value); return matcher.matches(); }
Check if the prop value is a variable replacement pattern
isVariableReplacementPattern
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props resolveProps(final Props props) { return resolveProps(props, false); }
Resolve Props, disallowing undefined properties to be referenced.
resolveProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props resolveProps(final Props props, final boolean allowUndefined) { if (props == null) { return null; } final Props resolvedProps = new Props(); final LinkedHashSet<String> visitedVariables = new LinkedHashSet<>(); for (final String key : props.getKeySet()) { String val...
Resolve Props @param props props @param allowUndefined whether undefined properties are allowed to be referenced. @return resolved props @throws UndefinedPropertyException if allowUndefined is set to false and there is a reference to an undefined property.
resolveProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props newProps(final Props parentProps, final String filePath) throws IOException { return (filePath == null) ? (parentProps == null ? null : new Props(parentProps)) : newProps(parentProps, new File(filePath)); }
new Props based on default Props and expand it from external prop file @param parentProps parent Props @param filePath filePath @return combined props @throws IOException
newProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props newProps(final Props parentProps, final File file) throws IOException { if (file.exists()) { LOGGER.info("Prop file " + file + "found. Attempted to load."); return new Props(parentProps, file); } else { LOGGER.info("Prop file " + file + "not found. Using the default props on...
new Props based on default Props and expand it from external prop file @param parentProps parent Props @param file prop file @return combined props @throws IOException
newProps
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
private static String resolveVariableReplacement(final String value, final Props props, final LinkedHashSet<String> visitedVariables, final boolean allowUndefined) { final StringBuffer buffer = new StringBuffer(); int startIndex = 0; final Matcher matcher = VARIABLE_REPLACEMENT_PATTERN.matcher(value)...
new Props based on default Props and expand it from external prop file @param parentProps parent Props @param file prop file @return combined props @throws IOException
resolveVariableReplacement
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
private static String resolveVariableExpression(final String value) { final JexlEngine jexl = new JexlEngine(); return resolveVariableExpression(value, value.length(), jexl); }
new Props based on default Props and expand it from external prop file @param parentProps parent Props @param file prop file @return combined props @throws IOException
resolveVariableExpression
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
private static String resolveVariableExpression(final String value, final int last, final JexlEngine jexl) { final int lastIndex = value.lastIndexOf("$(", last); if (lastIndex == -1) { return value; } // Want to check that everything is well formed, and that // we properly capture $( .....
Function that looks for expressions to parse. It parses backwards to capture embedded expressions
resolveVariableExpression
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static String toJSONString(final Props props, final boolean localOnly) { final Map<String, String> map = toStringMap(props, localOnly); return JSONUtils.toJSON(map); }
Convert props to json string @param props props @param localOnly include local prop sets only or not @return json string format of props
toJSONString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
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); ...
Convert props to Map @param props props @param localOnly include local prop sets only or not @return String Map of props
toStringMap
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props fromJSONString(final String json) throws IOException { final Map<String, String> obj = (Map<String, String>) JSONUtils.parseJSONFromString(json); final Props props = new Props(null, obj); return props; }
Convert json String to Prop Object @param json json formatted string @return a new constructed Prop Object @throws IOException exception on parsing json string to prop object
fromJSONString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) { if (propsMap == null) { return null; } final String source = (String) propsMap.get("source"); final Map<String, String> propsParams = (Map<String, String>) propsMap.get("props"); final Map<String, Object> p...
Convert a hierarchical Map to Prop Object @param propsMap a hierarchical Map @return a new constructed Props Object
fromHierarchicalMap
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static Map<String, Object> toHierarchicalMap(final Props props) { final Map<String, Object> propsMap = new HashMap<>(); propsMap.put("source", props.getSource()); propsMap.put("props", toStringMap(props, true)); if (props.getParent() != null) { propsMap.put("parent", toHierarchicalMap(prop...
Convert a Props object to a hierarchical Map @param props props object @return a hierarchical Map presented Props object
toHierarchicalMap
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static String getPropertyDiff(Props oldProps, Props newProps) { final StringBuilder builder = new StringBuilder(""); // oldProps can not be null during the below comparison process. if (oldProps == null) { oldProps = new Props(); } if (newProps == null) { newProps = new Props()...
The difference between old and new Props @param oldProps old Props @param newProps new Props @return string formatted difference
getPropertyDiff
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/PropsUtils.java
Apache-2.0
public static String formatDateTimeZone(final long timestampMs) { return format(timestampMs, DATE_TIME_ZONE_PATTERN); }
Produce a formatted string using the pattern "yyyy/MM/dd HH:mm:ss z" and the system's time zone. @param timestampMs the number of milliseconds since Epoch
formatDateTimeZone
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static String formatDateTime(final long timestampMs) { return format(timestampMs, DATE_TIME_PATTERN); }
Produce a formatted string using the pattern "yyyy-MM-dd HH:mm:ss" and the system's time zone. @param timestampMs the number of milliseconds since Epoch
formatDateTime
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
private static String format(final long timestampMs, final String pattern) { if (timestampMs < 0) { return "-"; } final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); final ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestampMs), ZoneId....
Produce a formatted string using the pattern "yyyy-MM-dd HH:mm:ss" and the system's time zone. @param timestampMs the number of milliseconds since Epoch
format
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static long convertDateTimeToUTCMillis(final String dateTime) { final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_TIME_PATTERN); final LocalDateTime parsedDate = LocalDateTime.parse(dateTime, formatter); return parsedDate.atZone(ZoneOffset.UTC).toInstant().toEpochMilli(); }
Takes a date string formatted as "yyyy-MM-dd HH:mm:ss" and converts it into milliseconds since the Epoch in UTC.
convertDateTimeToUTCMillis
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static String formatInISOOffsetDateTime(final long millisSinceEpoch, final String zoneOffset) { requireNonNull(zoneOffset, "zone offset is null."); final ZonedDateTime zonedDateTime = ZonedDateTime .ofInstant(Instant.ofEpochMilli(millisSinceEpoch), ZoneOffset.of(zoneOffset)); return Dat...
Produce a formatted string using the {@link DateTimeFormatter#ISO_OFFSET_DATE_TIME} formatter. @param millisSinceEpoch the timestamp @param zoneOffset the time zone offset. Example: "Z", "+08:00", "-08:00" @return the formatted date-time value @throws DateTimeException if the zoneOffset is invalid
formatInISOOffsetDateTime
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static String formatDuration(final long startTime, final long endTime) { if (startTime == -1) { return "-"; } final long durationMS; if (endTime == -1) { durationMS = System.currentTimeMillis() - startTime; } else { durationMS = endTime - startTime; } long seconds ...
Format time period pair to Duration String @param startTime start time @param endTime end time @return Duration String
formatDuration
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static String formatPeriod(final ReadablePeriod period) { String periodStr = "null"; if (period == null) { return periodStr; } if (period.get(DurationFieldType.years()) > 0) { final int years = period.get(DurationFieldType.years()); periodStr = years + " year(s)"; } else i...
Format ReadablePeriod object to string @param period readable period object @return String presentation of ReadablePeriod Object
formatPeriod
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static ReadablePeriod parsePeriodString(final String periodStr) { final ReadablePeriod period; final char periodUnit = periodStr.charAt(periodStr.length() - 1); if (periodStr.equals("null") || periodUnit == 'n') { return null; } final int periodInt = Integer.parseInt(periodStr....
Parse Period String to a ReadablePeriod Object @param periodStr string formatted period @return ReadablePeriod Object
parsePeriodString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static String createPeriodString(final ReadablePeriod period) { String periodStr = "null"; if (period == null) { return periodStr; } if (period.get(DurationFieldType.years()) > 0) { final int years = period.get(DurationFieldType.years()); periodStr = years + "y"; } else if...
Convert ReadablePeriod Object to string @param period ReadablePeriod Object @return string formatted ReadablePeriod Object
createPeriodString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static boolean timeEscapedOver(final long referenceTime, final int second) { return ((System.currentTimeMillis() - referenceTime) / 1000F) > (second * 1.0); }
Check the time escaped over n seconds @param referenceTime reference time @param second number of seconds @return true when the time escaped more than n seconds
timeEscapedOver
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static int daysEscapedOver(final long referenceTime) { return Math .round(((System.currentTimeMillis() - referenceTime) / 1000f) / (ONE_DAY * 1.0f) - 0.5f); }
Check how many days escaped over @param referenceTime reference time @return number of days
daysEscapedOver
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/TimeUtils.java
Apache-2.0
public static boolean equals(final Object a, final Object b) { if (a == null || b == null) { return a == b; } return a.equals(b); }
Equivalent to Object.equals except that it handles nulls. If a and b are both null, true is returned.
equals
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static <T> T nonNull(final T t) { if (t == null) { throw new IllegalArgumentException("Null value not allowed."); } else { return t; } }
Return the object if it is non-null, otherwise throw an exception @param <T> The type of the object @param t The object @return The object if it is not null @throws IllegalArgumentException if the object is null
nonNull
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static File findFilefromDir(final File dir, final String fn) { if (dir.isDirectory()) { for (final File f : dir.listFiles()) { if (f.getName().equals(fn)) { return f; } } } return null; }
Return the object if it is non-null, otherwise throw an exception @param <T> The type of the object @param t The object @return The object if it is not null @throws IllegalArgumentException if the object is null
findFilefromDir
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static <T> T ifNull(final T value, final T defaultValue) { return (value == null) ? defaultValue : value; }
Return the value itself if it is non-null, otherwise return the default value @param value The object @param defaultValue default value if object == null @param <T> The type of the object @return The object itself or default value when it is null
ifNull
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static void croak(final String message, final int exitCode) { System.err.println(message); System.exit(exitCode); }
Print the message and then exit with the given exit code @param message The message to print @param exitCode The exit code
croak
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static boolean isValidPort(final int port) { if (port >= 1 && port <= 65535) { return true; } return false; }
Tests whether a port is valid or not @return true, if port is valid
isValidPort
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static File createTempDir() { return createTempDir(new File(System.getProperty("java.io.tmpdir"))); }
Tests whether a port is valid or not @return true, if port is valid
createTempDir
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static File createTempDir(final File parent) { final File temp = new File(parent, Integer.toString(Math.abs(RANDOM.nextInt()) % 100000000)); temp.delete(); temp.mkdir(); temp.deleteOnExit(); return temp; }
Tests whether a port is valid or not @return true, if port is valid
createTempDir
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static void zip(final File input, final File output) throws IOException { final FileOutputStream out = new FileOutputStream(output); final ZipOutputStream zOut = new ZipOutputStream(out); try { zipFile("", input, zOut); } finally { zOut.close(); } }
Tests whether a port is valid or not @return true, if port is valid
zip
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static void zipFolderContent(final File folder, final File output) throws IOException { final FileOutputStream out = new FileOutputStream(output); final ZipOutputStream zOut = new ZipOutputStream(out); try { final File[] files = folder.listFiles(); if (files != null) { for (...
Tests whether a port is valid or not @return true, if port is valid
zipFolderContent
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
private static void zipFile(final String path, final File input, final ZipOutputStream zOut) throws IOException { if (input.isDirectory()) { final File[] files = input.listFiles(); if (files != null) { for (final File f : files) { final String childPath = path + inp...
Tests whether a port is valid or not @return true, if port is valid
zipFile
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static void unzip(final ZipFile source, final File dest) throws IOException { final Enumeration<?> entries = source.entries(); while (entries.hasMoreElements()) { final ZipEntry entry = (ZipEntry) entries.nextElement(); final File newFile = new File(dest, entry.getName()); if (!newFile....
Tests whether a port is valid or not @return true, if port is valid
unzip
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static String flattenToString(final Collection<?> collection, final String delimiter) { final StringBuffer buffer = new StringBuffer(); for (final Object obj : collection) { buffer.append(obj.toString()); buffer.append(delimiter); } if (buffer.length() > 0) { buffer.setLe...
Tests whether a port is valid or not @return true, if port is valid
flattenToString
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static Double convertToDouble(final Object obj) { if (obj instanceof String) { return Double.parseDouble((String) obj); } return (Double) obj; }
Tests whether a port is valid or not @return true, if port is valid
convertToDouble
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
private static RuntimeException getCause(final InvocationTargetException e) { final Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new IllegalStateException(e.getCause()); } }
Get the root cause of the Exception @param e The Exception @return The root cause of the Exception
getCause
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
public static Object callConstructor(final Class<?> cls, final Object... args) { return callConstructor(cls, getTypes(args), args); }
Construct a class object with the given arguments @param cls The class @param args The arguments @return Constructed Object
callConstructor
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
private static Class<?>[] getTypes(final Object... args) { final Class<?>[] argTypes = new Class<?>[args.length]; for (int i = 0; i < argTypes.length; i++) { argTypes[i] = args[i].getClass(); } return argTypes; }
Get the Class of all the objects @param args The objects to get the Classes from @return The classes as an array
getTypes
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0
private static Object callConstructor(final Class<?> cls, final Class<?>[] argTypes, final Object[] args) { try { final Constructor<?> cons = cls.getConstructor(argTypes); return cons.newInstance(args); } catch (final InvocationTargetException e) { throw getCause(e); } catch (final I...
Call the class constructor with the given arguments @param cls The class @param args The arguments @return The constructed object
callConstructor
java
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
https://github.com/azkaban/azkaban/blob/master/az-core/src/main/java/azkaban/utils/Utils.java
Apache-2.0