Package com.ibm.di.connector.maximo.util
Class AbstractConfigurationParameters
- java.lang.Object
-
- com.ibm.di.connector.maximo.util.AbstractConfigurationParameters
-
- Direct Known Subclasses:
MxConnConfiguration
public abstract class AbstractConfigurationParameters extends java.lang.Object
Collection of configuration parameters.Note: This class is thread-safe.
- Since:
- 7.1
- See Also:
SimpleTpaeIFConnector
-
-
Constructor Summary
Constructors Constructor Description AbstractConfigurationParameters(Log log)
Constructs a newAbstractConfigurationParameters
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkParamAndThrow(java.lang.String key)
void
clear()
Removes all configuration parameters.java.lang.String
getParameter(java.lang.String key, java.lang.String defaultValue)
Returns the value associated to the specifiedkey
.boolean
getParameterAsBoolean(java.lang.String key)
Returns the value associated to the specifiedkey
asboolean
.int
getParameterAsInt(java.lang.String key, int defaultValue)
Returns the value associated to the specifiedkey
asint
.protected java.util.Map<java.lang.String,java.lang.String>
getParams()
Returns theMap
that stores all the configuration parameters.protected boolean
isDefined(java.lang.String key)
Checks if the specified parameter is defined or not.protected boolean
loadFromFile(java.lang.String fileName, java.lang.String prefix)
Loads the properties from a file.protected boolean
loadFromResource(java.lang.String resource, java.lang.String prefix)
Loads the properties from a resource stream.void
setParameter(java.lang.String key, java.lang.String value)
Defines a configuration parameter.java.lang.String
toString()
Returns aString
with all defined properties.
-
-
-
Field Detail
-
logger
protected Log logger
Logger used by the TPAE IF Connector.
-
-
Constructor Detail
-
AbstractConfigurationParameters
public AbstractConfigurationParameters(Log log)
Constructs a newAbstractConfigurationParameters
.
-
-
Method Detail
-
clear
public final void clear()
Removes all configuration parameters.
-
getParameter
public final java.lang.String getParameter(java.lang.String key, java.lang.String defaultValue)
Returns the value associated to the specifiedkey
.- Parameters:
key
- the key whose associated value is to be returneddefaultValue
- the value that should be returned if the parameter specified bykey
is not defined- Returns:
- value associated to the specified
key
ordefaultValue
if the parameter is not previously defined
-
getParameterAsBoolean
public final boolean getParameterAsBoolean(java.lang.String key)
Returns the value associated to the specifiedkey
asboolean
.- Parameters:
key
- the key whose associated value is to be returned- Returns:
true
if value equals to"true"
, otherwisefalse
-
getParameterAsInt
public final int getParameterAsInt(java.lang.String key, int defaultValue)
Returns the value associated to the specifiedkey
asint
.- Parameters:
key
- the key whose associated value is to be returneddefaultValue
- the value that should be returned if the parameter specified bykey
is not defined- Returns:
- value associated to the specified
key
ordefaultValue
if the parameter is not previously defined
-
isDefined
protected final boolean isDefined(java.lang.String key)
Checks if the specified parameter is defined or not.- Parameters:
key
- the key that identifies the parameter- Returns:
true
if the parameter has an associated value, otherwisefalse
- See Also:
StringUtils.isBlank(String)
-
checkParamAndThrow
protected void checkParamAndThrow(java.lang.String key)
-
setParameter
public final void setParameter(java.lang.String key, java.lang.String value)
Defines a configuration parameter.- Parameters:
key
- configuration parameter keyvalue
- configuration parameter value
-
toString
public final java.lang.String toString()
Returns aString
with all defined properties.Note: Any property identified by a key that contains the word password will not have its value exposed.
- Overrides:
toString
in classjava.lang.Object
-
getParams
protected final java.util.Map<java.lang.String,java.lang.String> getParams()
Returns theMap
that stores all the configuration parameters.- Returns:
Map
that stores all the configuration parameters
-
loadFromFile
protected final boolean loadFromFile(java.lang.String fileName, java.lang.String prefix)
Loads the properties from a file.- Parameters:
fileName
- path to the file containing the configuration propertiesprefix
- prefix of the configuration properties that should be loaded- Returns:
true
if the configuration properties could be loaded, otherwisefalse
-
loadFromResource
protected final boolean loadFromResource(java.lang.String resource, java.lang.String prefix)
Loads the properties from a resource stream.- Parameters:
resource
- path to the resource stream that contains the configuration propertiesprefix
- prefix of the configuration properties that should be loaded- Returns:
true
if the configuration properties could be loaded, otherwisefalse
-
-