summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2014-12-19 11:15:02 +0100
committerDavid Wagner <david.wagner@intel.com>2015-01-22 11:53:52 +0100
commit29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b (patch)
tree5786f9d76eae3a29eb7f22a0727921979e53c8bb /parameter/ParameterMgr.cpp
parentc39e7f4bbad04e92b53054b61b3f3deaa98ccd61 (diff)
downloadexternal_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.zip
external_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.tar.gz
external_parameter-framework-29fa61fc5bc02f72f99e66ad50e4de8cb6b8490b.tar.bz2
Extract and specialize domain import- and export-specific contexts
Import and Export of ConfigurableDomains have different context needs: e.g. the value representation is only used for export; auto-validation is only meaningful for import whereas the "with settings" context is common to both. We create two new classes, derived from XmlDomainSerializingContext and move most of its content to each class it belongs to. Change-Id: I56589cdb3a8ea417e11d2ed98ccd055d7cdead67 Signed-off-by: David Wagner <david.wagner@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index b707225..749aacd 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -60,6 +60,8 @@
#include "ConfigurableDomain.h"
#include "DomainConfiguration.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainExportContext.h"
+#include "XmlDomainImportContext.h"
#include "BitParameterBlockType.h"
#include "BitParameterType.h"
#include "StringParameterType.h"
@@ -620,18 +622,18 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
string strXmlConfigurationDomainsFolder = pConfigurableDomainsFileLocation->getFolderPath(_strXmlConfigurationFolderPath);
// Parse configuration domains XML file (ask to read settings from XML file if they are not provided as binary)
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, !pBinarySettingsFileLocation);
+ CXmlDomainImportContext xmlDomainImportContext(strError, !pBinarySettingsFileLocation);
// Selection criteria definition for rule creation
- xmlDomainSerializingContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition());
+ xmlDomainImportContext.setSelectionCriteriaDefinition(getConstSelectionCriteria()->getSelectionCriteriaDefinition());
// Auto validation of configurations if no binary settings provided
- xmlDomainSerializingContext.setAutoValidationRequired(!pBinarySettingsFileLocation);
+ xmlDomainImportContext.setAutoValidationRequired(!pBinarySettingsFileLocation);
log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
// Do parse
- if (!xmlParse(xmlDomainSerializingContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
+ if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
return false;
}
@@ -2009,14 +2011,14 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings);
// Selection criteria definition for rule creation
- xmlDomainSerializingContext.setSelectionCriteriaDefinition(
+ xmlDomainImportContext.setSelectionCriteriaDefinition(
getConstSelectionCriteria()->getSelectionCriteriaDefinition());
// Init serializing context
- xmlDomainSerializingContext.set(
+ xmlDomainImportContext.set(
_pElementLibrarySet->getElementLibrary(EParameterConfigurationLibrary),
"", _strSchemaFolderLocation);
@@ -2050,7 +2052,7 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
// Use a doc sink that instantiate Configurable Domains from the given doc source
CXmlMemoryDocSink memorySink(pConfigurableDomains);
- bool bProcessSuccess = memorySink.process(*pSource, xmlDomainSerializingContext);
+ bool bProcessSuccess = memorySink.process(*pSource, xmlDomainImportContext);
if (!bProcessSuccess) {
@@ -2088,13 +2090,13 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
pConfigurableDomains->getKind() + ".xsd";
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
// Value space
- xmlDomainSerializingContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
// Output raw format
- xmlDomainSerializingContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
// Use a doc source by loading data from instantiated Configurable Domains
CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(),
@@ -2115,7 +2117,7 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
pSink = new CXmlStringDocSink(strXmlDest);
}
- bool bProcessSuccess = pSink->process(memorySource, xmlDomainSerializingContext);
+ bool bProcessSuccess = pSink->process(memorySource, xmlDomainExportContext);
delete pSink;
return bProcessSuccess;