Package ch.autumo.commons.configuration
Class ConfigurationManager
java.lang.Object
ch.autumo.commons.generic.PropertiesManager
ch.autumo.commons.configuration.ConfigurationManager
Configuration manager.
-
Field Summary
FieldsFields inherited from class ch.autumo.commons.generic.PropertiesManager
CONFIG_PATH, generalProps, isInitialized, isWithinDesktop, isWithinServlet, rootPath
-
Method Summary
Modifier and TypeMethodDescriptionString[]
Get web app roles.getDecodedString
(String key, SecureApplication app) Decode encrypted value, if it is encrypted by ifacex standards!static ConfigurationManager
Get configuration manager.int
Get integer value.int
Get integer value.int
getIntNoWarn
(String key) Get integer value; no warning if value is not available.String[]
Get all keys starting with a specific key-prefix.getMimeTypes
(String key) Get allowed mime types.static Properties
getModuleConfig
(String configFile) Get module root configuration.static Properties
getModuleConfigRelative
(String relativePath) Get module root configuration.static Properties
getModuleConfigWithFullPath
(String configFilePath) Get module root configuration.String[]
getSepValues
(String key) Get comma-separated values, e.g.String[]
getSepValuesNoWarn
(String key) Get comma-separated values, e.g.Get a string value.Get a string value or default value if non-existent.getStringNoWarn
(String key) Get a string value; no warning if value is not available.String[]
Get all values starting with a specific key-prefix.static Document
getXMLModuleConfig
(String xmlConfigFile, String moduleName) Get XML module root configuration.static Document
getXMLModuleConfigRelative
(String xmlRelativePath, String moduleName) Get XML module root configuration.static Document
getXMLModuleConfigWithFullPath
(String xmlConfigFilePath, String moduleName) Get XML module root configuration.boolean
getYesOrNo
(String key) Get yes (true) or no (false), if the configuration is messed up false is returned.boolean
getYesOrNoNoWarn
(String key) Get yes (true) or no (false), if the configuration is messed up false is returned.void
initializeManager
(Properties config) Customized initialization with configuration properties.static void
writeXMLModuleConfigWithFullPath
(String xmlConfigFilePath, Document xmlDoc) Write XML module configuration.Methods inherited from class ch.autumo.commons.generic.PropertiesManager
getConfigFileName, getFullConfigBasePath, getProperties, getRootPath, initialize, initializeDesktop, initializeRelative, initializeWithFullPath, initializeWithFullPath, initializeWithProperties, isInitialized, isRemote, runsWithinDesktopContext, runsWithinServletContext, updateProperty
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger.
-
-
Method Details
-
getInstance
Get configuration manager.- Returns:
- manager
-
initializeManager
Description copied from class:PropertiesManager
Customized initialization with configuration properties.- Specified by:
initializeManager
in classPropertiesManager
- Parameters:
config
- configuration properties- Throws:
Exception
- if manager cannot be initialized
-
getString
Get a string value.- Parameters:
key
- key- Returns:
- value
-
getString
Get a string value or default value if non-existent.- Parameters:
key
- keydefaultVal
- default value- Returns:
- value
-
getStringNoWarn
Get a string value; no warning if value is not available.- Parameters:
key
- key- Returns:
- value
-
getKeys
Get all keys starting with a specific key-prefix.- Parameters:
keyPrefix
- key prefix, e.g. 'dispatcher_'- Returns:
- collected values
-
getValues
Get all values starting with a specific key-prefix.- Parameters:
keyPrefix
- key prefix, e.g. 'dispatcher_'- Returns:
- collected values
-
getInt
Get integer value.- Parameters:
key
- key- Returns:
- integer value
-
getInt
Get integer value.- Parameters:
key
- keydefaultVal
- default value or default value if non-existent.- Returns:
- integer value
-
getIntNoWarn
Get integer value; no warning if value is not available.- Parameters:
key
- key- Returns:
- integer value
-
getYesOrNo
Get yes (true) or no (false), if the configuration is messed up false is returned.- Parameters:
key
- key- Returns:
- true or false
-
getYesOrNoNoWarn
Get yes (true) or no (false), if the configuration is messed up false is returned. No warning if key is missing.- Parameters:
key
- key- Returns:
- true or false
-
getDecodedString
Decode encrypted value, if it is encrypted by ifacex standards! See 'encoder.sh'.- Parameters:
key
- keyapp
- ifacex secure application- Returns:
- encrypted value
- Throws:
UtilsException
- if decoding fails
-
getAppRoles
Get web app roles.- Returns:
- web app roles
-
getSepValuesNoWarn
Get comma-separated values, e.g. 'a,b,c'. If the configuration is messed up an empty array is returned. No warning if key is missing.- Parameters:
key
- key- Returns:
- values
-
getSepValues
Get comma-separated values, e.g. 'a,b,c'.- Parameters:
key
- key- Returns:
- values
-
getMimeTypes
Get allowed mime types.- Parameters:
key
- mime type key- Returns:
- allowed mime types
-
getModuleConfig
Get module root configuration.- Parameters:
configFile
- only the file name, path is concluded by ROOTPATH and cfg-directory- Returns:
- properties
- Throws:
Exception
- if module configuration cannot be loaded
-
getModuleConfigRelative
Get module root configuration.- Parameters:
relativePath
- relative path that is concluded with ROOTPATH- Returns:
- doc root
- Throws:
Exception
- if module configuration cannot be loaded
-
getModuleConfigWithFullPath
Get module root configuration.- Parameters:
configFilePath
- the full configuration file path- Returns:
- properties
- Throws:
Exception
- if module configuration cannot be loaded
-
getXMLModuleConfig
Get XML module root configuration. No resource paths!- Parameters:
xmlConfigFile
- only the file name, path is concluded by ROOTPATH and cfg-directorymoduleName
- module name- Returns:
- XML doc root
-
getXMLModuleConfigRelative
Get XML module root configuration. No resource paths!- Parameters:
xmlRelativePath
- relative path that is concluded with ROOTPATHmoduleName
- module name- Returns:
- XML doc root
-
getXMLModuleConfigWithFullPath
Get XML module root configuration. The given path can be a resource too, but make sure there are no mixed path separators, e.g. "/\"!- Parameters:
xmlConfigFilePath
- the full configuration file pathmoduleName
- module name- Returns:
- XML doc root
-
writeXMLModuleConfigWithFullPath
Write XML module configuration.- Parameters:
xmlConfigFilePath
- the full config file pathxmlDoc
- XML doc
-