summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-11-07 20:32:51 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:59 +0100
commit95ac034b72580306e9246f7efa3f7ba709a02183 (patch)
tree9dc36b32d1ff881132b3424d761aa3b06c06717d /parameter/ParameterMgr.cpp
parent99041c5b5ed90dd66c65fa1903a74f5f3f9a8fdc (diff)
downloadexternal_parameter-framework-95ac034b72580306e9246f7efa3f7ba709a02183.zip
external_parameter-framework-95ac034b72580306e9246f7efa3f7ba709a02183.tar.gz
external_parameter-framework-95ac034b72580306e9246f7efa3f7ba709a02183.tar.bz2
PFW: file organization
BZ: 12888, 12925, 13285, 13289 - Removed hard coded paths from source files - Separated test related resources and programs into a test subfolder - Schemas folder at root containing the schemas, a symbolic link to that folder might be a good way to enable schema aware editing - Now global configuration file path is passed from the hosting platform instead of the class name. - Global configuration path contains only the relevant class related descriptions (plugin paths, structure, settings) - .user environment file eclipsed through git-ignore (and removed from projects) - Removed system class configuration obsolete files Change-Id: I99b783ba22bca05238a760b2127939a91e976be8 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/25404 Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp80
1 files changed, 35 insertions, 45 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 61e204a..102d28b 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -55,7 +55,6 @@
#include "ParameterFrameworkConfiguration.h"
#include "FrameworkConfigurationGroup.h"
#include "FrameworkConfigurationLocation.h"
-#include "SystemClassConfiguration.h"
#include "ConfigurableDomains.h"
#include "ConfigurableDomain.h"
#include "DomainConfiguration.h"
@@ -88,7 +87,7 @@ const char* gacSystemSchemasSubFolder = "Schemas";
// Config File System looks normally like this:
// ---------------------------------------------
-//├── ParameterFrameworkConfiguration.xml
+//├── <ParameterFrameworkConfiguration>.xml
//├── Schemas
//│ └── *.xsd
//├── Settings
@@ -168,16 +167,14 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
// Remote command parsers array Size
const uint32_t CParameterMgr::guiNbRemoteCommandParserItems = sizeof(gastRemoteCommandParserItems) / sizeof(gastRemoteCommandParserItems[0]);
-CParameterMgr::CParameterMgr(const string& strParameterFrameworkConfigurationFolderPath, const string& strSystemClassName) :
+CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
_bTuningModeIsOn(false),
_bValueSpaceIsRaw(false),
_bOutputRawFormatIsHex(false),
_bAutoSyncOn(true),
_pMainParameterBlackboard(new CParameterBlackboard),
_pElementLibrarySet(new CElementLibrarySet),
- _strParameterFrameworkConfigurationFolderPath(strParameterFrameworkConfigurationFolderPath),
- _strSchemaFolderLocation(strParameterFrameworkConfigurationFolderPath + "/" + gacSystemSchemasSubFolder),
- _pSystemClassConfiguration(NULL),
+ _strXmlConfigurationFilePath(strConfigurationFilePath),
_uiStructureChecksum(0),
_pRemoteProcessorServer(NULL),
_uiMaxCommandUsageLength(0),
@@ -191,8 +188,8 @@ CParameterMgr::CParameterMgr(const string& strParameterFrameworkConfigurationFol
// Deal with children
addChild(new CParameterFrameworkConfiguration);
addChild(new CSelectionCriteria);
- addChild(new CSystemClass(strSystemClassName));
- addChild(new CConfigurableDomains(strSystemClassName));
+ addChild(new CSystemClass);
+ addChild(new CConfigurableDomains);
// Feed element library
feedElementLibraries();
@@ -212,6 +209,16 @@ CParameterMgr::CParameterMgr(const string& strParameterFrameworkConfigurationFol
pRemoteCommandParserItem->_pcHelp,
pRemoteCommandParserItem->_pcDescription);
}
+
+ // Configuration file folder
+ uint32_t uiSlashPos = _strXmlConfigurationFilePath.rfind('/', -1);
+
+ assert(uiSlashPos != (uint32_t)-1);
+
+ _strXmlConfigurationFolderPath = _strXmlConfigurationFilePath.substr(0, uiSlashPos);
+
+ // Schema absolute folder location
+ _strSchemaFolderLocation = _strXmlConfigurationFolderPath + "/" + gacSystemSchemasSubFolder;
}
CParameterMgr::~CParameterMgr()
@@ -348,18 +355,19 @@ bool CParameterMgr::loadFrameworkConfiguration(string& strError)
{
CAutoLog autoLog(this, "Loading framework configuration");
- // Get Xml config file name
- string strXmlConfigurationFilePath = _strParameterFrameworkConfigurationFolderPath + "/" + gacParameterFrameworkConfigurationFileName;
-
// Parse Structure XML file
CXmlElementSerializingContext elementSerializingContext(strError);
- if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), strXmlConfigurationFilePath, _strParameterFrameworkConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
+ if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), _strXmlConfigurationFilePath, _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
return false;
}
+ // Set class name to system class and configurable domains
+ getSystemClass()->setName(getConstFrameworkConfiguration()->getSystemClassName());
+ getConfigurableDomains()->setName(getConstFrameworkConfiguration()->getSystemClassName());
+
// Get subsystem plugins folders element
- const CFrameworkConfigurationGroup* pSubsystemPluginFolders= static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChild("SubsystemPluginFolders"));
+ const CFrameworkConfigurationGroup* pSubsystemPluginFolders = static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChild("SubsystemPluginFolders"));
if (!pSubsystemPluginFolders) {
@@ -378,32 +386,16 @@ bool CParameterMgr::loadFrameworkConfiguration(string& strError)
return false;
}
+ // Collect plugin paths
for (uiPluginFolderLocation = 0; uiPluginFolderLocation < uiNbPluginFolderLocations; uiPluginFolderLocation++) {
const CFrameworkConfigurationLocation* pSubsystemPluginLocation = static_cast<const CFrameworkConfigurationLocation*>(pSubsystemPluginFolders->getChild(uiPluginFolderLocation));
- _astrPluginFolderPaths.push_back(pSubsystemPluginLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath));
+ _astrPluginFolderPaths.push_back(pSubsystemPluginLocation->getFilePath(_strXmlConfigurationFilePath));
}
- // Get configuration for current system class
- const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChildOfKind("ParameterConfiguration"));
-
- if (!pParameterConfigurationGroup) {
-
- strError = "Parameter Framework Configuration: couldn't find ParameterConfiguration element";
-
- return false;
- }
- _pSystemClassConfiguration = static_cast<const CSystemClassConfiguration*>(pParameterConfigurationGroup->findChild(getSystemClass()->getName()));
-
- if (!_pSystemClassConfiguration) {
-
- strError = "No framework configuration found for SystemClass " + getSystemClass()->getName();
-
- return false;
- }
// Log tuning availability
- log("Tuning %s", _pSystemClassConfiguration->isTuningAllowed() ? "allowed" : "prohibited");
+ log("Tuning %s", getConstFrameworkConfiguration()->isTuningAllowed() ? "allowed" : "prohibited");
return true;
}
@@ -416,7 +408,7 @@ bool CParameterMgr::loadStructure(string& strError)
CAutoLog autoLog(this, "Loading " + pSystemClass->getName() + " system class structure");
// Get structure description element
- const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(_pSystemClassConfiguration->findChildOfKind("StructureDescriptionFileLocation"));
+ const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(getConstFrameworkConfiguration()->findChildOfKind("StructureDescriptionFileLocation"));
if (!pStructureDescriptionFileLocation) {
@@ -426,10 +418,10 @@ bool CParameterMgr::loadStructure(string& strError)
}
// Get Xml structure folder
- string strXmlStructureFolder = pStructureDescriptionFileLocation->getFolderPath(_strParameterFrameworkConfigurationFolderPath);
+ string strXmlStructureFolder = pStructureDescriptionFileLocation->getFolderPath(_strXmlConfigurationFolderPath);
// Get Xml structure file name
- string strXmlStructureFilePath = pStructureDescriptionFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath);
+ string strXmlStructureFilePath = pStructureDescriptionFileLocation->getFilePath(_strXmlConfigurationFolderPath);
// Parse Structure XML file
CXmlParameterSerializingContext parameterBuildContext(strError);
@@ -455,7 +447,7 @@ bool CParameterMgr::loadSettings(string& strError)
CAutoLog autoLog(this, "Loading settings");
// Get settings configuration element
- const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(_pSystemClassConfiguration->findChildOfKind("SettingsConfiguration"));
+ const CFrameworkConfigurationGroup* pParameterConfigurationGroup = static_cast<const CFrameworkConfigurationGroup*>(getConstFrameworkConfiguration()->findChildOfKind("SettingsConfiguration"));
if (!pParameterConfigurationGroup) {
@@ -471,7 +463,7 @@ bool CParameterMgr::loadSettings(string& strError)
if (pBinarySettingsFileLocation) {
// Get Xml binary settings file name
- strXmlBinarySettingsFilePath = pBinarySettingsFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath);
+ strXmlBinarySettingsFilePath = pBinarySettingsFileLocation->getFilePath(_strXmlConfigurationFolderPath);
}
// Get configurable domains element
@@ -487,10 +479,10 @@ bool CParameterMgr::loadSettings(string& strError)
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Get Xml configuration domains file name
- string strXmlConfigurationDomainsFilePath = pConfigurableDomainsFileLocation->getFilePath(_strParameterFrameworkConfigurationFolderPath);
+ string strXmlConfigurationDomainsFilePath = pConfigurableDomainsFileLocation->getFilePath(_strXmlConfigurationFolderPath);
// Get Xml configuration domains folder
- string strXmlConfigurationDomainsFolder = pConfigurableDomainsFileLocation->getFolderPath(_strParameterFrameworkConfigurationFolderPath);
+ 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);
@@ -1247,7 +1239,7 @@ bool CParameterMgr::getValue(const string& strPath, string& strValue, string& st
bool CParameterMgr::setTuningMode(bool bOn, string& strError)
{
// Tuning allowed?
- if (bOn && !_pSystemClassConfiguration->isTuningAllowed()) {
+ if (bOn && !getConstFrameworkConfiguration()->isTuningAllowed()) {
strError = "Tuning prohibited";
@@ -1700,8 +1692,6 @@ void CParameterMgr::feedElementLibraries()
pFrameworkConfigurationLibrary->addElementBuilder(new TElementBuilderTemplate<CParameterFrameworkConfiguration>("ParameterFrameworkConfiguration"));
pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("SubsystemPluginFolders"));
pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("PluginFolderLocation"));
- pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("ParameterConfiguration"));
- pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CSystemClassConfiguration>("SystemClassConfiguration"));
pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("StructureDescriptionFileLocation"));
pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationGroup>("SettingsConfiguration"));
pFrameworkConfigurationLibrary->addElementBuilder(new TKindElementBuilderTemplate<CFrameworkConfigurationLocation>("ConfigurableDomainsFileLocation"));
@@ -1744,7 +1734,7 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
CAutoLog autoLog(this, "Handling remote processing interface");
// Start server if tuning allowed
- if (_pSystemClassConfiguration->isTuningAllowed()) {
+ if (getConstFrameworkConfiguration()->isTuningAllowed()) {
log("Loading remote processor library");
@@ -1777,9 +1767,9 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
}
// Create server
- _pRemoteProcessorServer = pfnCreateRemoteProcessorServer(_pSystemClassConfiguration->getServerPort(), _pCommandHandler);
+ _pRemoteProcessorServer = pfnCreateRemoteProcessorServer(getConstFrameworkConfiguration()->getServerPort(), _pCommandHandler);
- log("Starting remote processor server on port %d", _pSystemClassConfiguration->getServerPort());
+ log("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort());
// Start
if (!_pRemoteProcessorServer->start()) {