be.ehealth.technicalconnector.config.impl
Class ConfigValidatorImpl

java.lang.Object
  extended by be.ehealth.technicalconnector.config.impl.ConfigValidatorImpl
All Implemented Interfaces:
Configuration, ConfigValidator

public class ConfigValidatorImpl
extends Object
implements ConfigValidator

Implementation of ConfigValidatorImpl


Field Summary
static String PROP_VALIDATOR_ACTIVATOR
          Boolean property to activate the fact that invalid config a blokking issues is.
 
Constructor Summary
ConfigValidatorImpl(List<String> expectedProps)
           
ConfigValidatorImpl(List<String> expectedProps, Configuration config)
           
 
Method Summary
 boolean containsKey(String key)
          Property contains key.
 Boolean getBooleanProperty(String key, Boolean defaultValue)
          Gets the boolean property.
 Configuration getConfig()
           
 Configuration getCurrentConfig()
           
 Duration getDurationProperty(String key, Long defaultValue, TimeUnit defaultTimeUnit)
           
 Integer getIntegerProperty(String key, Integer defaultValue)
          Gets the integer property.
 Long getLongProperty(String key, Long defaultValue)
          Gets the long property.
 List<String> getMatchingProperties(String rootKey)
          Gets the properties that match a root key.
 String getProperty(String key)
          Gets the property by Key from the DEFAULT_CONFIG.
 String getProperty(String key, String defaultValue)
          Gets the property by Key.
 List<Object> getUnfoundPropertiesAfterValidation()
          will do the validation of the current config ( if not done yet ) and return the properties that were not found.
 URL getURLProperty(String property)
          Gets the uRL property.
 boolean hasDurationProperty(String key)
           
 boolean hasMatchingProperty(String rootKey)
           
 boolean hasProperty(String key)
          Checks for property.
 void invalidate()
          Method to invalidate all the cached configuration.
 void invalidateCache()
          This method will invalidate the current config.
 boolean isReloading()
           
 boolean isValid()
           
 void reload()
          Method to reload the configuration modules.
 void setConfigLocation(String location)
          Sets the configLocation and remove the current configuration.
 void setProperty(String key, String value)
          Method to override a property at runtime.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_VALIDATOR_ACTIVATOR

public static final String PROP_VALIDATOR_ACTIVATOR
Boolean property to activate the fact that invalid config a blokking issues is. If this property is TRUE then a ConfigurationException will be throw when the config is invalid.

Default value is TRUE.

See Also:
Constant Field Values
Constructor Detail

ConfigValidatorImpl

public ConfigValidatorImpl(List<String> expectedProps)

ConfigValidatorImpl

public ConfigValidatorImpl(List<String> expectedProps,
                           Configuration config)
Method Detail

getConfig

public final Configuration getConfig()
                              throws TechnicalConnectorException
Specified by:
getConfig in interface ConfigValidator
Returns:
the current configuration
Throws:
TechnicalConnectorException

getUnfoundPropertiesAfterValidation

public List<Object> getUnfoundPropertiesAfterValidation()
                                                 throws TechnicalConnectorException
Description copied from interface: ConfigValidator
will do the validation of the current config ( if not done yet ) and return the properties that were not found.

Specified by:
getUnfoundPropertiesAfterValidation in interface ConfigValidator
Returns:
List of property strings that were not found
Throws:
TechnicalConnectorException - if exception occurs while initializeing config.

isValid

public final boolean isValid()
                      throws TechnicalConnectorException
Specified by:
isValid in interface ConfigValidator
Returns:
if the current config is valid;
Throws:
TechnicalConnectorException

invalidateCache

public final void invalidateCache()
Description copied from interface: ConfigValidator
This method will invalidate the current config.

Specified by:
invalidateCache in interface ConfigValidator

getProperty

public final String getProperty(String key,
                                String defaultValue)
Description copied from interface: Configuration
Gets the property by Key.

Specified by:
getProperty in interface Configuration
Parameters:
key - the key
defaultValue - the default value
Returns:
the property

getLongProperty

public final Long getLongProperty(String key,
                                  Long defaultValue)
Description copied from interface: Configuration
Gets the long property.

Specified by:
getLongProperty in interface Configuration
Parameters:
key - the key
defaultValue - the default value
Returns:
the long property

getIntegerProperty

public final Integer getIntegerProperty(String key,
                                        Integer defaultValue)
Description copied from interface: Configuration
Gets the integer property.

Specified by:
getIntegerProperty in interface Configuration
Parameters:
key - the key
defaultValue - the default value
Returns:
the integer property

getBooleanProperty

public final Boolean getBooleanProperty(String key,
                                        Boolean defaultValue)
Description copied from interface: Configuration
Gets the boolean property.

Specified by:
getBooleanProperty in interface Configuration
Parameters:
key - the key
defaultValue - the default value
Returns:
the boolean property

getDurationProperty

public Duration getDurationProperty(String key,
                                    Long defaultValue,
                                    TimeUnit defaultTimeUnit)
Specified by:
getDurationProperty in interface Configuration

hasDurationProperty

public boolean hasDurationProperty(String key)
Specified by:
hasDurationProperty in interface Configuration

getProperty

public final String getProperty(String key)
Description copied from interface: Configuration
Gets the property by Key from the DEFAULT_CONFIG.

Specified by:
getProperty in interface Configuration
Parameters:
key - the key
Returns:
the property

containsKey

public final boolean containsKey(String key)
Description copied from interface: Configuration
Property contains key.

Specified by:
containsKey in interface Configuration
Parameters:
key - the key
Returns:
true, if successful

getURLProperty

public final URL getURLProperty(String property)
Description copied from interface: Configuration
Gets the uRL property.

Specified by:
getURLProperty in interface Configuration
Parameters:
property - the string
Returns:
the uRL property

setProperty

public final void setProperty(String key,
                              String value)
Description copied from interface: Configuration
Method to override a property at runtime.

Specified by:
setProperty in interface Configuration
Parameters:
key - the key
value - the value

hasProperty

public final boolean hasProperty(String key)
Description copied from interface: Configuration
Checks for property.

Specified by:
hasProperty in interface Configuration
Parameters:
key - the key
Returns:
true, if successful

hasMatchingProperty

public boolean hasMatchingProperty(String rootKey)
Specified by:
hasMatchingProperty in interface Configuration

getMatchingProperties

public final List<String> getMatchingProperties(String rootKey)
Description copied from interface: Configuration
Gets the properties that match a root key.

Specified by:
getMatchingProperties in interface Configuration
Parameters:
rootKey - the root key
Returns:
the properties

setConfigLocation

public final void setConfigLocation(String location)
                             throws TechnicalConnectorException
Description copied from interface: Configuration
Sets the configLocation and remove the current configuration. when used with a null value , the default configuration is set.

Specified by:
setConfigLocation in interface Configuration
Throws:
TechnicalConnectorException

getCurrentConfig

public final Configuration getCurrentConfig()
Specified by:
getCurrentConfig in interface Configuration
Returns:
the currenct configuration;

invalidate

public void invalidate()
                throws TechnicalConnectorException
Description copied from interface: Configuration
Method to invalidate all the cached configuration.

Specified by:
invalidate in interface Configuration
Throws:
TechnicalConnectorException

reload

public void reload()
            throws TechnicalConnectorException
Description copied from interface: Configuration
Method to reload the configuration modules.

This method must be called when you change properties at runtime that are used by configuration modules.

Specified by:
reload in interface Configuration
Throws:
TechnicalConnectorException

isReloading

public boolean isReloading()
Specified by:
isReloading in interface Configuration



Connector Packaging TRUSSMAKER 3.20.2 API
Copyright © {inceptionYear}-2020 eHealth. All Rights Reserved.