Class ConfigurationManager
java.lang.Object
ch.autumo.commons.generic.PropertiesManager
ch.autumo.commons.configuration.ConfigurationManager
Central configuration manager: loads, reads and writes application configuration
(properties and XML) from the configured root path.
-
Field Summary
FieldsFields inherited from class PropertiesManager
CONFIG_PATH, generalProps, isInitialized, isWithinDesktop, isWithinServlet, rootPathModifier and TypeFieldDescriptionstatic final StringStandard configuration path.protected PropertiesThe general configuration properties ('cfg/app.cfg').protected static booleanInitialized?protected booleanRuns within desktop context?protected booleanRuns within servlet context?protected static StringROOT path. -
Method Summary
Modifier and TypeMethodDescriptionString[]Get web app roles.getDecodedString(String key, SecureApplication app) Decode encrypted value, if it is encrypted by ifacex standards! See 'encoder.sh'.static ConfigurationManagerGet configuration manager.intGet integer value.intGet integer value.intgetIntNoWarn(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 PropertiesgetModuleConfig(String configFile) Get module root configuration.static PropertiesgetModuleConfigRelative(String relativePath) Get module root configuration.static PropertiesgetModuleConfigWithFullPath(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 DocumentgetXMLModuleConfig(String xmlConfigFile, String moduleName) Get XML module root configuration.static DocumentgetXMLModuleConfigRelative(String xmlRelativePath, String moduleName) Get XML module root configuration.static DocumentgetXMLModuleConfigWithFullPath(String xmlConfigFilePath, String moduleName) Get XML module root configuration.booleangetYesOrNo(String key) Get yes (true) or no (false), if the configuration is messed up false is returned.booleangetYesOrNoNoWarn(String key) Get yes (true) or no (false), if the configuration is messed up false is returned.voidinitializeManager(Properties config) Customized initialization with configuration properties.static voidwriteXMLModuleConfigWithFullPath(String xmlConfigFilePath, Document xmlDoc) Write XML module configuration.Methods inherited from class PropertiesManager
getConfigFileName, getFullConfigBasePath, getProperties, getRootPath, initialize, initializeDesktop, initializeRelative, initializeWithFullPath, initializeWithFullPath, initializeWithProperties, initializeWithProperties, isInitialized, isRemote, runsWithinDesktopContext, runsWithinServletContext, updatePropertyModifier and TypeMethodDescriptionReturns the file name of the base configuration.Returns the full base path, where the base configuration is.Get internal properties.Get app root path.voidinitialize(String configFile) Initialize with standard config path 'ROOTPATH/cfg'.voidinitializeDesktop(String desktopCfgFile, String appName) Initialize with desktop configuration which must have been created beforehand by the desktop application!voidinitializeRelative(String relativePath) Initialize with path 'ROOTPATH/given-path-and-file.cfg'.voidinitializeWithFullPath(String configFilePath) Customized initialization with full configuration file path.voidinitializeWithFullPath(String configFilePath, boolean isWithinServlet) Customized initialization with full configuration file path.voidinitializeWithProperties(Properties config) Customized initialization with already loaded properties.voidinitializeWithProperties(Properties config, boolean isWithinServlet) Customized initialization with already loaded properties.static booleanIs inizialized?booleanisRemote()Returns true if it doesn't run server-side.booleanReturn true, if this configuration manager runs within a desktop otherwise false.booleanReturn true, if this configuration manager runs within a servlet otherwise false.updateProperty(String key, String value) Update or add a value to the internal properties.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger.
-
-
Method Details
-
getInstance
-
initializeManager
Description copied from class:PropertiesManagerCustomized initialization with configuration properties.- Specified by:
initializeManagerin classPropertiesManager- Parameters:
config- configuration properties- Throws:
Exception- if manager cannot be initialized
-
getString
-
getString
-
getStringNoWarn
-
getKeys
-
getValues
-
getInt
-
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
-
getSepValuesNoWarn
-
getSepValues
-
getMimeTypes
-
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
-
getXMLModuleConfigRelative
-
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
-