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.ObjectCollection 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 voidcheckParamAndThrow(java.lang.String key)voidclear()Removes all configuration parameters.java.lang.StringgetParameter(java.lang.String key, java.lang.String defaultValue)Returns the value associated to the specifiedkey.booleangetParameterAsBoolean(java.lang.String key)Returns the value associated to the specifiedkeyasboolean.intgetParameterAsInt(java.lang.String key, int defaultValue)Returns the value associated to the specifiedkeyasint.protected java.util.Map<java.lang.String,java.lang.String>getParams()Returns theMapthat stores all the configuration parameters.protected booleanisDefined(java.lang.String key)Checks if the specified parameter is defined or not.protected booleanloadFromFile(java.lang.String fileName, java.lang.String prefix)Loads the properties from a file.protected booleanloadFromResource(java.lang.String resource, java.lang.String prefix)Loads the properties from a resource stream.voidsetParameter(java.lang.String key, java.lang.String value)Defines a configuration parameter.java.lang.StringtoString()Returns aStringwith 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 bykeyis not defined- Returns:
- value associated to the specified
keyordefaultValueif the parameter is not previously defined
-
getParameterAsBoolean
public final boolean getParameterAsBoolean(java.lang.String key)
Returns the value associated to the specifiedkeyasboolean.- Parameters:
key- the key whose associated value is to be returned- Returns:
trueif value equals to"true", otherwisefalse
-
getParameterAsInt
public final int getParameterAsInt(java.lang.String key, int defaultValue)Returns the value associated to the specifiedkeyasint.- Parameters:
key- the key whose associated value is to be returneddefaultValue- the value that should be returned if the parameter specified bykeyis not defined- Returns:
- value associated to the specified
keyordefaultValueif 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:
trueif 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 aStringwith all defined properties.Note: Any property identified by a key that contains the word password will not have its value exposed.
- Overrides:
toStringin classjava.lang.Object
-
getParams
protected final java.util.Map<java.lang.String,java.lang.String> getParams()
Returns theMapthat stores all the configuration parameters.- Returns:
Mapthat 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:
trueif 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:
trueif the configuration properties could be loaded, otherwisefalse
-
-