Class ConfUtils
- java.lang.Object
-
- com.digitalpebble.stormcrawler.util.ConfUtils
-
public class ConfUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map
extractConfigElement(Map conf)
If the config consists of a single key 'config', its values are used insteadstatic boolean
getBoolean(Map<String,Object> conf, String key, boolean defaultValue)
static boolean
getBoolean(Map<String,Object> conf, String prefix, String optional, String suffix, boolean defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default valuestatic float
getFloat(Map<String,Object> conf, String key, float defaultValue)
static int
getInt(Map<String,Object> conf, String key, int defaultValue)
static int
getInt(Map<String,Object> conf, String prefix, String optional, String suffix, int defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default valuestatic long
getLong(Map<String,Object> conf, String key, long defaultValue)
static String
getString(Map<String,Object> conf, String key)
static String
getString(Map<String,Object> conf, String key, String defaultValue)
static String
getString(Map<String,Object> stormConf, String prefix, String optional, String suffix)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix or null.static String
getString(Map<String,Object> stormConf, String prefix, String optional, String suffix, String defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default valuestatic org.apache.storm.Config
loadConf(String resource, org.apache.storm.Config conf)
static List<String>
loadListFromConf(String prefix, String optional, String suffix, Map stormConf)
Return one or more Strings regardless of whether they are represented as a single String or a list in the config for the combination all 2 String parameters.static List<String>
loadListFromConf(String paramKey, Map stormConf)
Return one or more Strings regardless of whether they are represented as a single String or a list in the config or an empty List if no value could be found for that key.
-
-
-
Method Detail
-
getInt
public static int getInt(Map<String,Object> conf, String prefix, String optional, String suffix, int defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
-
getBoolean
public static boolean getBoolean(Map<String,Object> conf, String prefix, String optional, String suffix, boolean defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
-
getBoolean
public static boolean getBoolean(Map<String,Object> conf, String key, boolean defaultValue)
-
getString
public static String getString(Map<String,Object> stormConf, String prefix, String optional, String suffix)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix or null.
-
getString
public static String getString(Map<String,Object> stormConf, String prefix, String optional, String suffix, String defaultValue)
Returns the value for prefix + optional + suffix, if nothing is found then return prefix + suffix and if that fails too, the default value
-
getString
public static String getString(Map<String,Object> conf, String key, String defaultValue)
-
loadListFromConf
public static List<String> loadListFromConf(String paramKey, Map stormConf)
Return one or more Strings regardless of whether they are represented as a single String or a list in the config or an empty List if no value could be found for that key.
-
loadListFromConf
public static List<String> loadListFromConf(String prefix, String optional, String suffix, Map stormConf)
Return one or more Strings regardless of whether they are represented as a single String or a list in the config for the combination all 2 String parameters. If nothing is found, try using the prefix and suffix only to see if a more generic param was set e.g. "opensearch." + "status." + "addresses" then "opensearch."+"addresses"- Parameters:
prefix
- non-optional part of the keyoptional
- string to be tried firstsuffix
- non-optional part of the key- Returns:
- List of String values
-
loadConf
public static org.apache.storm.Config loadConf(String resource, org.apache.storm.Config conf) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-