aboutsummaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorMattijs Korpershoek <mattijsx.korpershoek@intel.com>2014-04-08 14:10:03 +0200
committerMattijs Korpershoek <mattijsx.korpershoek@intel.com>2014-06-25 10:52:21 +0200
commitcce85f6b6691e4b1ddb81171e3ca5b5aeb71e6b9 (patch)
tree8f797fac149da0d4e54c2e40b224a76cb9242c47 /parameter/ParameterMgr.cpp
parent3141891778a0564887d25b8b06b898daf3c1c9b5 (diff)
downloadexternal_parameter-framework-cce85f6b6691e4b1ddb81171e3ca5b5aeb71e6b9.zip
external_parameter-framework-cce85f6b6691e4b1ddb81171e3ca5b5aeb71e6b9.tar.gz
external_parameter-framework-cce85f6b6691e4b1ddb81171e3ca5b5aeb71e6b9.tar.bz2
Test-platform enable/disable xml validation
BZ: 184054 test-platform has no way to tell to the parameter framework that it wants the parameter framework to validate xmls on loading. New command added to test-platform executable. setValidateSchemasOnStart true|false If set to true, the parameter framework will try to validate the .xmls with the .xsds located next to them. If set to false, it will never attempt to validate. SetValidateSchemas is false by default to allow backward compatibility. Note(a): This assumes that the script is able to find the .xsd files (which should be in /tmp/Schemas/). Change-Id: I7a5b0bc09d31e6647d8c631380d31503666e7e7b Signed-off-by: Mattijs Korpershoek <mattijsx.korpershoek@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp47
1 files changed, 35 insertions, 12 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 639c59f..2882f67 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -1,4 +1,4 @@
- /*
+/*
* Copyright (c) 2011-2014, Intel Corporation
* All rights reserved.
*
@@ -36,8 +36,10 @@
#include "NamedElementBuilderTemplate.h"
#include "KindElementBuilderTemplate.h"
#include "ElementBuilderTemplate.h"
+#include "XmlFileIncluderElement.h"
#include "SelectionCriterionType.h"
#include "SubsystemElementBuilder.h"
+#include "FileIncluderElementBuilder.h"
#include "SelectionCriteria.h"
#include "ComponentType.h"
#include "ComponentInstance.h"
@@ -289,7 +291,9 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
_pLogger(NULL),
_uiLogDepth(0),
_bFailOnMissingSubsystem(true),
- _bFailOnFailedSettingsLoad(true)
+ _bFailOnFailedSettingsLoad(true),
+ _bValidateSchemasOnStart(false)
+
{
// Tuning Mode Mutex
bzero(&_blackboardMutex, sizeof(_blackboardMutex));
@@ -301,9 +305,6 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
addChild(new CSystemClass);
addChild(new CConfigurableDomains);
- // Feed element library
- feedElementLibraries();
-
_pCommandHandler = new CCommandHandler(this);
// Add command parsers
@@ -409,6 +410,8 @@ bool CParameterMgr::load(string& strError)
{
CAutoLog autoLog(this, "Loading");
+ feedElementLibraries();
+
// Load Framework configuration
if (!loadFrameworkConfiguration(strError)) {
@@ -644,12 +647,16 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName)
{
// Init serializing context
- elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(eElementLibrary), strXmlFolder, _strSchemaFolderLocation);
+ elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(
+ eElementLibrary), strXmlFolder, _strSchemaFolderLocation);
// Get Schema file associated to root element
string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd";
- CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath, pRootElement->getKind(), pRootElement->getName(), strNameAttrituteName);
+ CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ pRootElement->getName(), strNameAttrituteName,
+ _bValidateSchemasOnStart);
// Start clean
pRootElement->clean();
@@ -776,10 +783,22 @@ void CParameterMgr::setFailureOnFailedSettingsLoad(bool bFail)
{
_bFailOnFailedSettingsLoad = bFail;
}
+
bool CParameterMgr::getFailureOnFailedSettingsLoad()
{
return _bFailOnFailedSettingsLoad;
}
+
+void CParameterMgr::setValidateSchemasOnStart(bool bValidate)
+{
+ _bValidateSchemasOnStart = bValidate;
+}
+
+bool CParameterMgr::getValidateSchemasOnStart() const
+{
+ return _bValidateSchemasOnStart;
+}
+
/////////////////// Remote command parsers
/// Version
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1999,14 +2018,16 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
// when importing from a file strXmlSource is the file name
pSource = new CXmlFileDocSource(strXmlSource, strXmlSchemaFilePath,
pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName");
+ pConfigurableDomains->getName(), "SystemClassName",
+ _bValidateSchemasOnStart);
} else {
// when importing from an xml string, strXmlSource contains the string
pSource = new CXmlStringDocSource(strXmlSource, strXmlSchemaFilePath,
pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName");
+ pConfigurableDomains->getName(), "SystemClassName",
+ _bValidateSchemasOnStart);
}
// Start clean
@@ -2063,7 +2084,8 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
// Use a doc source by loading data from instantiated Configurable Domains
CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(),
- strXmlSchemaFilePath, "parameter-framework", getVersion());
+ strXmlSchemaFilePath, "parameter-framework",
+ getVersion(), _bValidateSchemasOnStart);
// Xml Sink
CXmlDocSink* pSink;
@@ -2181,7 +2203,7 @@ void CParameterMgr::feedElementLibraries()
pParameterCreationLibrary->addElementBuilder("EnumParameter", new TNamedElementBuilderTemplate<CEnumParameterType>());
pParameterCreationLibrary->addElementBuilder("ValuePair", new TElementBuilderTemplate<CEnumValuePair>());
pParameterCreationLibrary->addElementBuilder("FixedPointParameter", new TNamedElementBuilderTemplate<CFixedPointParameterType>());
- pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new TKindElementBuilderTemplate<CXmlFileIncluderElement>());
+ pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new CFileIncluderElementBuilder(_bValidateSchemasOnStart));
_pElementLibrarySet->addElementLibrary(pParameterCreationLibrary);
@@ -2338,7 +2360,8 @@ bool CParameterMgr::getSystemClassXMLString(string& strResult)
CXmlSerializingContext xmlSerializingContext(strError);
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind());
+ CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind(),
+ _bValidateSchemasOnStart);
// Use a doc sink that write the doc data in a string
CXmlStringDocSink stringSink(strResult);