com.ibm.di.connector.maximo.util
Class AbstractConfigurationParameters

java.lang.Object
  extended by 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

Field Summary
protected  Log logger
          Logger used by the TPAE IF Connector.
 
Constructor Summary
AbstractConfigurationParameters(Log log)
          Constructs a new AbstractConfigurationParameters.
 
Method Summary
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 specified key.
 boolean getParameterAsBoolean(java.lang.String key)
          Returns the value associated to the specified key as boolean.
 int getParameterAsInt(java.lang.String key, int defaultValue)
          Returns the value associated to the specified key as int.
protected  java.util.Map<java.lang.String,java.lang.String> getParams()
          Returns the Map 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 a String with all defined properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected Log logger
Logger used by the TPAE IF Connector.

Constructor Detail

AbstractConfigurationParameters

public AbstractConfigurationParameters(Log log)
Constructs a new AbstractConfigurationParameters.

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 specified key.

Parameters:
key - the key whose associated value is to be returned
defaultValue - the value that should be returned if the parameter specified by key is not defined
Returns:
value associated to the specified key or defaultValue if the parameter is not previously defined

getParameterAsBoolean

public final boolean getParameterAsBoolean(java.lang.String key)
Returns the value associated to the specified key as boolean.

Parameters:
key - the key whose associated value is to be returned
Returns:
true if value equals to "true", otherwise false

getParameterAsInt

public final int getParameterAsInt(java.lang.String key,
                                   int defaultValue)
Returns the value associated to the specified key as int.

Parameters:
key - the key whose associated value is to be returned
defaultValue - the value that should be returned if the parameter specified by key is not defined
Returns:
value associated to the specified key or defaultValue 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, otherwise false
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 key
value - configuration parameter value

toString

public final java.lang.String toString()
Returns a String 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 class java.lang.Object

getParams

protected final java.util.Map<java.lang.String,java.lang.String> getParams()
Returns the Map 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 properties
prefix - prefix of the configuration properties that should be loaded
Returns:
true if the configuration properties could be loaded, otherwise false

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 properties
prefix - prefix of the configuration properties that should be loaded
Returns:
true if the configuration properties could be loaded, otherwise false