diff options
author | Kevin Rocard <kevinx.rocard@intel.com> | 2013-07-18 09:13:51 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-02-12 17:04:08 +0100 |
commit | d6909ebe19bf6e2817dadea32e06dda9d22bf073 (patch) | |
tree | a07834b6847662ab2f5e74c0d741de23a946516b /parameter/ParameterMgr.cpp | |
parent | 325bf97a49f9d1225a7815de8bd9c16b556d5070 (diff) | |
download | external_parameter-framework-d6909ebe19bf6e2817dadea32e06dda9d22bf073.zip external_parameter-framework-d6909ebe19bf6e2817dadea32e06dda9d22bf073.tar.gz external_parameter-framework-d6909ebe19bf6e2817dadea32e06dda9d22bf073.tar.bz2 |
Add an option to continue on failed setting load
BZ: 122982
When the PFW starts it loads the configurable domains, if the load
fails, it used to abort the parameterMgr global load.
Add an option to continue on failed setting load, as if there were none.
Change-Id: Ifd3cd859ad0eaef266be4c9245ebd28c9e9c0a74
Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com>
Reviewed-on: http://android.intel.com:8080/119924
Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r-- | parameter/ParameterMgr.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 927515c..59dc057 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -281,7 +281,8 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) : _uiMaxCommandUsageLength(0), _pLogger(NULL), _uiLogDepth(0), - _bFailOnMissingSubsystem(true) + _bFailOnMissingSubsystem(true), + _bFailOnFailedSettingsLoad(true) { // Tuning Mode Mutex bzero(&_blackboardMutex, sizeof(_blackboardMutex)); @@ -537,6 +538,27 @@ bool CParameterMgr::loadStructure(string& strError) bool CParameterMgr::loadSettings(string& strError) { + string strLoadError; + bool success = loadSettingsFromConfigFile(strLoadError); + + if (!success && !_bFailOnFailedSettingsLoad) { + // Load can not fail, ie continue but log the load errors + log_info(strLoadError); + log_info("Failed to load settings, continue without domains."); + success = true; + } + + if (!success) { + // Propagate the litteral error only if the function fails + strError = strLoadError; + return false; + } + + return true; +} + +bool CParameterMgr::loadSettingsFromConfigFile(string& strError) +{ CAutoLog autoLog(this, "Loading settings"); // Get settings configuration element @@ -567,7 +589,7 @@ bool CParameterMgr::loadSettings(string& strError) strError = "No ConfigurableDomainsFileLocation element found for SystemClass " + getSystemClass()->getName(); return false; - } + } // Get destination root element CConfigurableDomains* pConfigurableDomains = getConfigurableDomains(); @@ -737,6 +759,15 @@ bool CParameterMgr::getFailureOnMissingSubsystem() const { return _bFailOnMissingSubsystem; } + +void CParameterMgr::setFailureOnFailedSettingsLoad(bool bFail) +{ + _bFailOnFailedSettingsLoad = bFail; +} +bool CParameterMgr::getFailureOnFailedSettingsLoad() +{ + return _bFailOnFailedSettingsLoad; +} /////////////////// Remote command parsers /// Version CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) |