Class ConfigUtils
-
- All Implemented Interfaces:
public class ConfigUtilsGeorge Politis
-
-
Field Summary
Fields Modifier and Type Field Description public static StringPASSWORD_CMD_LINE_ARGSpublic static StringPASSWORD_SYS_PROPS
-
Constructor Summary
Constructors Constructor Description ConfigUtils()
-
Method Summary
Modifier and Type Method Description static FilegetAbsoluteFile(String path, ConfigurationService cfg)Gets an absolute path in the form of File from an absolute or relative path specified in the form of a String. static booleangetBoolean(ConfigurationService cfg, String property, boolean defaultValue)Gets the value as a booleanof a property from either a specificConfigurationServiceorSystem.static intgetInt(ConfigurationService cfg, String property, int defaultValue)Gets the value as an intof a property from either a specificConfigurationServiceorSystem.static longgetLong(ConfigurationService cfg, String property, long defaultValue)Gets the value as an longof a property from either a specificConfigurationServiceorSystem.static StringgetString(ConfigurationService cfg, String property, String defaultValue)Gets the value as a Stringof a property from either a specificConfigurationServiceorSystem.static StringgetString(ConfigurationService cfg, String property, String propertyAlternative, String defaultValue)Gets the value as a Stringof a property from either a specificConfigurationServiceorSystem.static StringgetSystemPropertiesDebugString()Goes over all system properties and builds a string of their names and values for debug purposes. -
-
Method Detail
-
getAbsoluteFile
static File getAbsoluteFile(String path, ConfigurationService cfg)
Gets an absolute path in the form of File from an absolute or relative path specified in the form of a String. If path is relative, it is resolved against ConfigurationService.PNAME_SC_HOME_DIR_LOCATION and ConfigurationService.PNAME_SC_HOME_DIR_NAME, user.home, or the current working directory.
- Parameters:
path- the absolute or relative path in the form of Stringfor/from which an absolute path in the form of File is to be returnedcfg- the ConfigurationService to be employed by the method (invocation) if necessary- Returns:
an absolute path in the form of File for/from the specified path
-
getBoolean
static boolean getBoolean(ConfigurationService cfg, String property, boolean defaultValue)
Gets the value as a
booleanof a property from either a specificConfigurationServiceorSystem.- Parameters:
cfg- theConfigurationServiceto get the value from ornullif the property is to be retrieved fromSystemproperty- the name of the property to getdefaultValue- the value to be returned ifpropertyis not associated with a value- Returns:
the value as a
booleanofpropertyretrieved from eithercfgorSystem
-
getInt
static int getInt(ConfigurationService cfg, String property, int defaultValue)
Gets the value as an
intof a property from either a specificConfigurationServiceorSystem.- Parameters:
cfg- theConfigurationServiceto get the value from ornullif the property is to be retrieved fromSystemproperty- the name of the property to getdefaultValue- the value to be returned ifpropertyis not associated with a value- Returns:
the value as an
intofpropertyretrieved from eithercfgorSystem
-
getLong
static long getLong(ConfigurationService cfg, String property, long defaultValue)
Gets the value as an
longof a property from either a specificConfigurationServiceorSystem.- Parameters:
cfg- theConfigurationServiceto get the value from ornullif the property is to be retrieved fromSystemproperty- the name of the property to getdefaultValue- the value to be returned ifpropertyis not associated with a value- Returns:
the value as an
longofpropertyretrieved from eithercfgorSystem
-
getString
static String getString(ConfigurationService cfg, String property, String defaultValue)
Gets the value as a
Stringof a property from either a specificConfigurationServiceorSystem.- Parameters:
cfg- theConfigurationServiceto get the value from ornullif the property is to be retrieved fromSystemproperty- the name of the property to getdefaultValue- the value to be returned ifpropertyis not associated with a value- Returns:
the value as a
Stringofpropertyretrieved from eithercfgorSystem
-
getString
static String getString(ConfigurationService cfg, String property, String propertyAlternative, String defaultValue)
Gets the value as a
Stringof a property from either a specificConfigurationServiceorSystem.- Parameters:
cfg- theConfigurationServiceto get the value from ornullif the property is to be retrieved fromSystemproperty- the name of the property to getpropertyAlternative- an alternative name of the propertydefaultValue- the value to be returned ifpropertyis not associated with a value- Returns:
the value as a
Stringofpropertyretrieved from eithercfgorSystem
-
getSystemPropertiesDebugString
static String getSystemPropertiesDebugString()
Goes over all system properties and builds a string of their names and values for debug purposes.
-
-
-
-