aboutsummaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
Diffstat (limited to 'parameter')
-rw-r--r--parameter/Android.mk123
-rw-r--r--parameter/CMakeLists.txt189
-rw-r--r--parameter/ConfigurableDomain.cpp63
-rw-r--r--parameter/ConfigurableDomain.h41
-rw-r--r--parameter/ConfigurableDomains.cpp63
-rw-r--r--parameter/ConfigurableDomains.h36
-rw-r--r--parameter/DomainConfiguration.cpp17
-rwxr-xr-xparameter/Element.cpp14
-rw-r--r--parameter/Element.h14
-rw-r--r--parameter/ParameterMgr.cpp344
-rw-r--r--parameter/ParameterMgr.h133
-rw-r--r--parameter/ParameterMgrFullConnector.cpp370
-rw-r--r--parameter/ParameterMgrLogger.h21
-rw-r--r--parameter/ParameterMgrPlatformConnector.cpp22
-rw-r--r--parameter/SelectionCriterionRule.cpp11
-rw-r--r--parameter/XmlDomainExportContext.h72
-rw-r--r--parameter/XmlDomainImportContext.h85
-rw-r--r--parameter/XmlDomainSerializingContext.cpp89
-rw-r--r--parameter/XmlDomainSerializingContext.h36
-rw-r--r--parameter/include/ParameterMgrFullConnector.h284
-rw-r--r--parameter/include/ParameterMgrLoggerForward.h (renamed from parameter/ParameterMgrLogger.cpp)19
-rw-r--r--parameter/include/ParameterMgrPlatformConnector.h31
22 files changed, 1598 insertions, 479 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 2027e97..8592c52 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -34,87 +34,88 @@ LOCAL_PATH := $(call my-dir)
common_copy_headers_to := parameter
common_copy_headers := \
+ include/ParameterMgrLoggerForward.h \
include/ParameterMgrPlatformConnector.h \
+ include/ParameterMgrFullConnector.h \
include/SelectionCriterionTypeInterface.h \
include/SelectionCriterionInterface.h \
include/ParameterHandle.h
common_src_files := \
- Subsystem.cpp \
- PathNavigator.cpp \
- Element.cpp \
- SystemClass.cpp \
- ParameterMgr.cpp \
- SelectionCriteria.cpp \
- SelectionCriterionLibrary.cpp \
- SelectionCriteriaDefinition.cpp \
- SelectionCriterionType.cpp \
- ElementLibrary.cpp \
- SubsystemElementBuilder.cpp \
- SelectionCriterion.cpp \
+ AreaConfiguration.cpp \
+ ArrayParameter.cpp \
+ AutoLog.cpp \
+ BaseParameter.cpp \
+ BinarySerializableElement.cpp \
+ BinaryStream.cpp \
+ BitParameterBlock.cpp \
+ BitParameterBlockType.cpp \
+ BitParameter.cpp \
+ BitParameterType.cpp \
+ BitwiseAreaConfiguration.cpp \
+ BooleanParameterType.cpp \
+ ComponentInstance.cpp \
ComponentLibrary.cpp \
+ ComponentType.cpp \
+ CompoundRule.cpp \
+ ConfigurableDomain.cpp \
+ ConfigurableDomains.cpp \
+ ConfigurableElementAggregator.cpp \
ConfigurableElement.cpp \
+ ConfigurationAccessContext.cpp \
+ DomainConfiguration.cpp \
+ Element.cpp \
+ ElementLibrary.cpp \
+ ElementLibrarySet.cpp \
+ ElementLocator.cpp \
+ EnumParameterType.cpp \
+ EnumValuePair.cpp \
+ ErrorContext.cpp \
+ FixedPointParameterType.cpp \
+ FormattedSubsystemObject.cpp \
+ FrameworkConfigurationLocation.cpp \
+ HardwareBackSynchronizer.cpp \
+ InstanceConfigurableElement.cpp \
+ InstanceDefinition.cpp \
+ IntegerParameterType.cpp \
+ LinearParameterAdaptation.cpp \
+ MappingContext.cpp \
MappingData.cpp \
+ ParameterAccessContext.cpp \
+ ParameterAdaptation.cpp \
ParameterBlackboard.cpp \
- ComponentType.cpp \
- TypeElement.cpp \
- InstanceConfigurableElement.cpp \
- ComponentInstance.cpp \
ParameterBlockType.cpp \
- ParameterType.cpp \
Parameter.cpp \
- BooleanParameterType.cpp \
- IntegerParameterType.cpp \
- ArrayParameter.cpp \
- InstanceDefinition.cpp \
- ParameterMgrPlatformConnector.cpp \
- FixedPointParameterType.cpp \
- ParameterAccessContext.cpp \
- XmlFileIncluderElement.cpp \
ParameterFrameworkConfiguration.cpp \
- FrameworkConfigurationLocation.cpp \
+ ParameterHandle.cpp \
+ ParameterMgr.cpp \
+ ParameterMgrFullConnector.cpp \
+ ParameterMgrPlatformConnector.cpp \
+ ParameterType.cpp \
+ PathNavigator.cpp \
PluginLocation.cpp \
- ElementLibrarySet.cpp \
- ErrorContext.cpp \
- AreaConfiguration.cpp \
- DomainConfiguration.cpp \
- ConfigurableDomain.cpp \
- SyncerSet.cpp \
- ConfigurableDomains.cpp \
- BinaryStream.cpp \
- ConfigurationAccessContext.cpp \
- XmlElementSerializingContext.cpp \
- XmlParameterSerializingContext.cpp \
- XmlDomainSerializingContext.cpp \
- BinarySerializableElement.cpp \
- BitwiseAreaConfiguration.cpp \
- BitParameterBlockType.cpp \
- BitParameterBlock.cpp \
- BitParameterType.cpp \
- BitParameter.cpp \
- ElementLocator.cpp \
- ParameterMgrLogger.cpp \
- AutoLog.cpp \
- CompoundRule.cpp \
+ RuleParser.cpp \
+ SelectionCriteria.cpp \
+ SelectionCriteriaDefinition.cpp \
+ SelectionCriterion.cpp \
+ SelectionCriterionLibrary.cpp \
SelectionCriterionRule.cpp \
- ConfigurableElementAggregator.cpp \
- HardwareBackSynchronizer.cpp \
+ SelectionCriterionType.cpp \
SimulatedBackSynchronizer.cpp \
- MappingContext.cpp \
+ StringParameter.cpp \
+ StringParameterType.cpp \
+ Subsystem.cpp \
+ SubsystemElementBuilder.cpp \
SubsystemObject.cpp \
- FormattedSubsystemObject.cpp \
SubsystemObjectCreator.cpp \
- BaseParameter.cpp \
- StringParameterType.cpp \
- StringParameter.cpp \
- EnumParameterType.cpp \
+ SyncerSet.cpp \
+ SystemClass.cpp \
+ TypeElement.cpp \
VirtualSubsystem.cpp \
VirtualSyncer.cpp \
- ParameterHandle.cpp \
- ParameterAdaptation.cpp \
- LinearParameterAdaptation.cpp \
- RuleParser.cpp \
- EnumValuePair.cpp
+ XmlElementSerializingContext.cpp \
+ XmlFileIncluderElement.cpp \
+ XmlParameterSerializingContext.cpp
common_module := libparameter
common_module_tags := optional
diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt
index f98848f..9f93da7 100644
--- a/parameter/CMakeLists.txt
+++ b/parameter/CMakeLists.txt
@@ -27,156 +27,80 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_library(parameter SHARED
- Subsystem.cpp
- PathNavigator.cpp
- Element.cpp
- SystemClass.cpp
- ParameterMgr.cpp
- SelectionCriteria.cpp
- SelectionCriterionLibrary.cpp
- SelectionCriteriaDefinition.cpp
- SelectionCriterionType.cpp
- ElementLibrary.cpp
- SubsystemElementBuilder.cpp
- SelectionCriterion.cpp
- ComponentLibrary.cpp
- ConfigurableElement.cpp
- MappingData.cpp
- ParameterBlackboard.cpp
- ComponentType.cpp
- TypeElement.cpp
- InstanceConfigurableElement.cpp
- ComponentInstance.cpp
- ParameterBlockType.cpp
- ParameterType.cpp
- Parameter.cpp
- BooleanParameterType.cpp
- IntegerParameterType.cpp
- ArrayParameter.cpp
- InstanceDefinition.cpp
- ParameterMgrPlatformConnector.cpp
- FixedPointParameterType.cpp
- ParameterAccessContext.cpp
- XmlFileIncluderElement.cpp
- ParameterFrameworkConfiguration.cpp
- FrameworkConfigurationLocation.cpp
- PluginLocation.cpp
- ElementLibrarySet.cpp
- ErrorContext.cpp
AreaConfiguration.cpp
- DomainConfiguration.cpp
- ConfigurableDomain.cpp
- SyncerSet.cpp
- ConfigurableDomains.cpp
- BinaryStream.cpp
- ConfigurationAccessContext.cpp
- XmlElementSerializingContext.cpp
- XmlParameterSerializingContext.cpp
- XmlDomainSerializingContext.cpp
+ ArrayParameter.cpp
+ AutoLog.cpp
+ BaseParameter.cpp
BinarySerializableElement.cpp
- BitwiseAreaConfiguration.cpp
- BitParameterBlockType.cpp
+ BinaryStream.cpp
BitParameterBlock.cpp
- BitParameterType.cpp
+ BitParameterBlockType.cpp
BitParameter.cpp
- ElementLocator.cpp
- ParameterMgrLogger.cpp
- AutoLog.cpp
+ BitParameterType.cpp
+ BitwiseAreaConfiguration.cpp
+ BooleanParameterType.cpp
+ ComponentInstance.cpp
+ ComponentLibrary.cpp
+ ComponentType.cpp
CompoundRule.cpp
- SelectionCriterionRule.cpp
+ ConfigurableDomain.cpp
+ ConfigurableDomains.cpp
ConfigurableElementAggregator.cpp
- HardwareBackSynchronizer.cpp
- SimulatedBackSynchronizer.cpp
- MappingContext.cpp
- SubsystemObject.cpp
- FormattedSubsystemObject.cpp
- SubsystemObjectCreator.cpp
- BaseParameter.cpp
- StringParameterType.cpp
- StringParameter.cpp
- EnumParameterType.cpp
- VirtualSubsystem.cpp
- VirtualSyncer.cpp
- ParameterHandle.cpp
- ParameterAdaptation.cpp
- LinearParameterAdaptation.cpp
- RuleParser.cpp
- EnumValuePair.cpp
- Subsystem.cpp
- PathNavigator.cpp
+ ConfigurableElement.cpp
+ ConfigurationAccessContext.cpp
+ DomainConfiguration.cpp
Element.cpp
- SystemClass.cpp
- ParameterMgr.cpp
- SelectionCriteria.cpp
- SelectionCriterionLibrary.cpp
- SelectionCriteriaDefinition.cpp
- SelectionCriterionType.cpp
ElementLibrary.cpp
- SubsystemElementBuilder.cpp
- SelectionCriterion.cpp
- ComponentLibrary.cpp
- ConfigurableElement.cpp
+ ElementLibrarySet.cpp
+ ElementLocator.cpp
+ EnumParameterType.cpp
+ EnumValuePair.cpp
+ ErrorContext.cpp
+ FixedPointParameterType.cpp
+ FormattedSubsystemObject.cpp
+ FrameworkConfigurationLocation.cpp
+ HardwareBackSynchronizer.cpp
+ InstanceConfigurableElement.cpp
+ InstanceDefinition.cpp
+ IntegerParameterType.cpp
+ LinearParameterAdaptation.cpp
+ MappingContext.cpp
MappingData.cpp
+ ParameterAccessContext.cpp
+ ParameterAdaptation.cpp
ParameterBlackboard.cpp
- ComponentType.cpp
- TypeElement.cpp
- InstanceConfigurableElement.cpp
- ComponentInstance.cpp
ParameterBlockType.cpp
- ParameterType.cpp
Parameter.cpp
- BooleanParameterType.cpp
- IntegerParameterType.cpp
- ArrayParameter.cpp
- InstanceDefinition.cpp
- ParameterMgrPlatformConnector.cpp
- FixedPointParameterType.cpp
- ParameterAccessContext.cpp
- XmlFileIncluderElement.cpp
ParameterFrameworkConfiguration.cpp
- FrameworkConfigurationLocation.cpp
+ ParameterHandle.cpp
+ ParameterMgr.cpp
+ ParameterMgrFullConnector.cpp
+ ParameterMgrPlatformConnector.cpp
+ ParameterType.cpp
+ PathNavigator.cpp
PluginLocation.cpp
- ElementLibrarySet.cpp
- ErrorContext.cpp
- AreaConfiguration.cpp
- DomainConfiguration.cpp
- ConfigurableDomain.cpp
- SyncerSet.cpp
- ConfigurableDomains.cpp
- BinaryStream.cpp
- ConfigurationAccessContext.cpp
- XmlElementSerializingContext.cpp
- XmlParameterSerializingContext.cpp
- XmlDomainSerializingContext.cpp
- BinarySerializableElement.cpp
- BitwiseAreaConfiguration.cpp
- BitParameterBlockType.cpp
- BitParameterBlock.cpp
- BitParameterType.cpp
- BitParameter.cpp
- ElementLocator.cpp
- ParameterMgrLogger.cpp
- AutoLog.cpp
- CompoundRule.cpp
+ RuleParser.cpp
+ SelectionCriteria.cpp
+ SelectionCriteriaDefinition.cpp
+ SelectionCriterion.cpp
+ SelectionCriterionLibrary.cpp
SelectionCriterionRule.cpp
- ConfigurableElementAggregator.cpp
- HardwareBackSynchronizer.cpp
+ SelectionCriterionType.cpp
SimulatedBackSynchronizer.cpp
- MappingContext.cpp
+ StringParameter.cpp
+ StringParameterType.cpp
+ Subsystem.cpp
+ SubsystemElementBuilder.cpp
SubsystemObject.cpp
- FormattedSubsystemObject.cpp
SubsystemObjectCreator.cpp
- BaseParameter.cpp
- StringParameterType.cpp
- StringParameter.cpp
- EnumParameterType.cpp
+ SyncerSet.cpp
+ SystemClass.cpp
+ TypeElement.cpp
VirtualSubsystem.cpp
VirtualSyncer.cpp
- ParameterHandle.cpp
- ParameterAdaptation.cpp
- LinearParameterAdaptation.cpp
- RuleParser.cpp
- EnumValuePair.cpp)
+ XmlElementSerializingContext.cpp
+ XmlFileIncluderElement.cpp
+ XmlParameterSerializingContext.cpp)
include_directories(
include
@@ -185,12 +109,15 @@ include_directories(
"${PROJECT_SOURCE_DIR}/remote-processor")
# No need to link with libremote-processor: it is accessed via dlopen()
-target_link_libraries(parameter xmlserializer pfw_utility)
+find_library(dl dl)
+target_link_libraries(parameter xmlserializer pfw_utility dl)
install(TARGETS parameter LIBRARY DESTINATION lib)
# Client headers
install(FILES
include/ParameterHandle.h
+ include/ParameterMgrLoggerForward.h
+ include/ParameterMgrFullConnector.h
include/ParameterMgrPlatformConnector.h
include/SelectionCriterionInterface.h
include/SelectionCriterionTypeInterface.h
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index 61a8d5b..35acb9c 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -32,12 +32,19 @@
#include "ConfigurableElement.h"
#include "ConfigurationAccessContext.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainImportContext.h"
+#include "XmlDomainExportContext.h"
#include <assert.h>
#define base CBinarySerializableElement
using std::string;
+CConfigurableDomain::CConfigurableDomain() :
+ _bSequenceAware(false), _pLastAppliedConfiguration(NULL)
+{
+}
+
CConfigurableDomain::CConfigurableDomain(const string& strName) : base(strName), _bSequenceAware(false), _pLastAppliedConfiguration(NULL)
{
}
@@ -111,9 +118,15 @@ bool CConfigurableDomain::getSequenceAwareness() const
// From IXmlSource
void CConfigurableDomain::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
+ base::toXml(xmlElement, serializingContext);
+
// Sequence awareness
xmlElement.setAttributeBoolean("SequenceAware", _bSequenceAware);
+}
+void CConfigurableDomain::childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const
+{
// Configurations
composeDomainConfigurations(xmlElement, serializingContext);
@@ -133,7 +146,7 @@ void CConfigurableDomain::composeDomainConfigurations(CXmlElement& xmlElement, C
xmlElement.createChild(xmlConfigurationsElement, "Configurations");
// Delegate to base
- base::toXml(xmlConfigurationsElement, serializingContext);
+ base::childrenToXml(xmlConfigurationsElement, serializingContext);
}
void CConfigurableDomain::composeConfigurableElements(CXmlElement& xmlElement) const
@@ -163,9 +176,10 @@ void CConfigurableDomain::composeConfigurableElements(CXmlElement& xmlElement) c
void CConfigurableDomain::composeSettings(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Context
- const CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<const CXmlDomainSerializingContext&>(serializingContext);
+ const CXmlDomainExportContext& xmlDomainExportContext =
+ static_cast<const CXmlDomainExportContext&>(serializingContext);
- if (!xmlDomainSerializingContext.withSettings()) {
+ if (!xmlDomainExportContext.withSettings()) {
return;
}
@@ -200,20 +214,25 @@ void CConfigurableDomain::composeSettings(CXmlElement& xmlElement, CXmlSerializi
bool CConfigurableDomain::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
// Context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainImportContext& xmlDomainImportContext =
+ static_cast<CXmlDomainImportContext&>(serializingContext);
// Sequence awareness (optional)
_bSequenceAware = xmlElement.hasAttribute("SequenceAware") && xmlElement.getAttributeBoolean("SequenceAware");
+ setName(xmlElement.getAttributeString("Name"));
+
// Local parsing. Do not dig
- if (!parseDomainConfigurations(xmlElement, serializingContext) || !parseConfigurableElements(xmlElement, serializingContext) || !parseSettings(xmlElement, serializingContext)) {
+ if (!parseDomainConfigurations(xmlElement, xmlDomainImportContext) ||
+ !parseConfigurableElements(xmlElement, xmlDomainImportContext) ||
+ !parseSettings(xmlElement, xmlDomainImportContext)) {
return false;
}
// All provided configurations are parsed
// Attempt validation on areas of non provided configurations for all configurable elements if required
- if (xmlDomainSerializingContext.autoValidationRequired()) {
+ if (xmlDomainImportContext.autoValidationRequired()) {
autoValidateAll();
}
@@ -222,7 +241,8 @@ bool CConfigurableDomain::fromXml(const CXmlElement& xmlElement, CXmlSerializing
}
// XML parsing
-bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
// We're supposedly clean
assert(_configurableElementList.empty());
@@ -237,14 +257,10 @@ bool CConfigurableDomain::parseDomainConfigurations(const CXmlElement& xmlElemen
}
// Parse configurable elements
-bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
- // Get System Class Element
- CElement* pRootElement = getRoot();
-
- CElement* pSystemClassElement = pRootElement->findChildOfKind("SystemClass");
-
- assert(pSystemClassElement);
+ CSystemClass& systemClass = serializingContext.getSystemClass();
// Get ConfigurableElements element
CXmlElement xmlConfigurableElementsElement;
@@ -264,14 +280,15 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen
string strError;
// Is there an element and does it match system class name?
- if (!pathNavigator.navigateThrough(pSystemClassElement->getName(), strError)) {
+ if (!pathNavigator.navigateThrough(systemClass.getName(), strError)) {
serializingContext.setError("Could not find configurable element of path " + strConfigurableElementPath + " from ConfigurableDomain description " + getName() + " (" + strError + ")");
return false;
}
// Browse system class for configurable element
- CConfigurableElement* pConfigurableElement = static_cast<CConfigurableElement*>(pSystemClassElement->findDescendant(pathNavigator));
+ CConfigurableElement* pConfigurableElement =
+ static_cast<CConfigurableElement*>(systemClass.findDescendant(pathNavigator));
if (!pConfigurableElement) {
@@ -292,13 +309,11 @@ bool CConfigurableDomain::parseConfigurableElements(const CXmlElement& xmlElemen
}
// Parse settings
-bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
+bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext)
{
- // Context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
-
// Check we actually need to parse configuration settings
- if (!xmlDomainSerializingContext.withSettings()) {
+ if (!serializingContext.withSettings()) {
// No parsing required
return true;
@@ -323,12 +338,14 @@ bool CConfigurableDomain::parseSettings(const CXmlElement& xmlElement, CXmlSeria
if (!pDomainConfiguration) {
- xmlDomainSerializingContext.setError("Could not find domain configuration referred to by configurable domain " + getName());
+ serializingContext.setError("Could not find domain configuration referred to by"
+ " configurable domain \"" + getName() + "\".");
return false;
}
// Have domain configuration parse settings for all configurable elements
- if (!pDomainConfiguration->parseSettings(xmlConfigurationSettingsElement, xmlDomainSerializingContext)) {
+ if (!pDomainConfiguration->parseSettings(xmlConfigurationSettingsElement,
+ serializingContext)) {
return false;
}
diff --git a/parameter/ConfigurableDomain.h b/parameter/ConfigurableDomain.h
index e91a5cb..a29c1ba 100644
--- a/parameter/ConfigurableDomain.h
+++ b/parameter/ConfigurableDomain.h
@@ -30,6 +30,8 @@
#pragma once
#include "BinarySerializableElement.h"
+#include "XmlSerializingContext.h"
+#include "XmlDomainImportContext.h"
#include "SyncerSet.h"
#include <list>
#include <set>
@@ -46,6 +48,7 @@ class CConfigurableDomain : public CBinarySerializableElement
typedef std::list<CConfigurableElement*>::const_iterator ConfigurableElementListIterator;
typedef std::map<const CConfigurableElement*, CSyncerSet*>::const_iterator ConfigurableElementToSyncerSetMapIterator;
public:
+ CConfigurableDomain();
CConfigurableDomain(const std::string& strName);
virtual ~CConfigurableDomain();
@@ -103,6 +106,8 @@ public:
// From IXmlSource
virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+ virtual void childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const;
// Class kind
virtual std::string getKind() const;
@@ -152,9 +157,39 @@ private:
void doRemoveConfigurableElement(CConfigurableElement* pConfigurableElement, bool bRecomputeSyncSet);
// XML parsing
- bool parseDomainConfigurations(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
- bool parseConfigurableElements(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
- bool parseSettings(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
+ /**
+ * Deserialize domain configurations from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] serializingContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseDomainConfigurations(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
+ /**
+ * Deserialize domain elements from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] serializingContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseConfigurableElements(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
+ /**
+ * Deserialize settings from an Xml document and add them to
+ * the domain.
+ *
+ * @param[in] xmlElement the XML element to be parsed
+ * @param[in] xmlDomainImportContext context for the deserialization
+ *
+ * @return false if an error occurs, true otherwise.
+ */
+ bool parseSettings(const CXmlElement& xmlElement,
+ CXmlDomainImportContext& serializingContext);
// XML composing
void composeDomainConfigurations(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index f11a155..b77e2aa 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -104,7 +104,7 @@ void CConfigurableDomains::toXml(CXmlElement& xmlElement, CXmlSerializingContext
// Set attribute
xmlElement.setAttributeString("SystemClassName", getName());
- base::toXml(xmlElement, serializingContext);
+ base::childrenToXml(xmlElement, serializingContext);
}
// Configuration/Domains handling
@@ -127,26 +127,52 @@ bool CConfigurableDomains::createDomain(const string& strName, string& strError)
return true;
}
-bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
+bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrite,
+ string& strError)
{
- CConfigurableDomain* pConfigurableDomain = findConfigurableDomain(strName, strError);
+ string strErrorDrop;
- if (!pConfigurableDomain) {
+ string strDomainName(domain.getName());
+ CConfigurableDomain* pExistingDomain = findConfigurableDomain(strDomainName, strErrorDrop);
- return false;
- }
+ if (pExistingDomain) {
+ if (!bOverwrite) {
+ strError = "Can't add domain \"" + strDomainName +
+ "\" because it already exists and overwrite was not requested.";
+ return false;
+ }
- log_info("Deleting configurable domain \"%s\"", strName.c_str());
+ deleteDomain(*pExistingDomain);
+ }
- // Hierarchy
- removeChild(pConfigurableDomain);
+ log_info("Adding configurable domain \"" + strDomainName + "\"");
- // Destroy
- delete pConfigurableDomain;
+ addChild(&domain);
return true;
}
+void CConfigurableDomains::deleteDomain(CConfigurableDomain& configurableDomain)
+{
+ log_info("Deleting configurable domain \"" + configurableDomain.getName() + "\"");
+
+ removeChild(&configurableDomain);
+
+ delete &configurableDomain;
+}
+
+bool CConfigurableDomains::deleteDomain(const string& strName, string& strError)
+{
+ CConfigurableDomain* pConfigurableDomain = findConfigurableDomain(strName, strError);
+
+ if (pConfigurableDomain) {
+ deleteDomain(*pConfigurableDomain);
+ return true;
+ }
+
+ return false;
+}
+
void CConfigurableDomains::deleteAllDomains()
{
log_info("Deleting all configurable domains");
@@ -566,17 +592,10 @@ bool CConfigurableDomains::serializeSettings(const string& strBinarySettingsFile
// Domain retrieval
CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError)
{
- // Find domain
- CConfigurableDomain* pConfigurableDomain = static_cast<CConfigurableDomain*>(findChild(strDomain));
-
- if (!pConfigurableDomain) {
-
- strError = "Configurable domain " + strDomain + " not found";
-
- return NULL;
- }
-
- return pConfigurableDomain;
+ // Call the const equivalent
+ return const_cast<CConfigurableDomain*>(
+ static_cast<const CConfigurableDomains*>(this)->findConfigurableDomain(strDomain, strError)
+ );
}
const CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError) const
diff --git a/parameter/ConfigurableDomains.h b/parameter/ConfigurableDomains.h
index 01c94ac..3cc16df 100644
--- a/parameter/ConfigurableDomains.h
+++ b/parameter/ConfigurableDomains.h
@@ -49,6 +49,30 @@ public:
// Configuration/Domains handling
/// Domains
bool createDomain(const std::string& strName, std::string& strError);
+
+ /*
+ * Adds a domain object to configurable domains. The ConfigurableDomains
+ * object takes ownership of the ConfigurableDomain object.
+ *
+ * @param[in] pDomain the domain object.
+ * @param[in] bOverwrite if false, will refuse to overwrite an existing
+ * domain, otherwise, an existing domain with the same name will first be
+ * removed.
+ * @param[in,out] strError error message
+ *
+ * @returns true if the domain was successfully added
+ */
+ bool addDomain(CConfigurableDomain& domain, bool bOverwrite, std::string& strError);
+
+ /**
+ * Delete a domain by name
+ *
+ * @param[in] strName name of the domain to be deleted
+ * @param[in,out] strError error message
+ *
+ * @returns true of the domain was sucessfully deleted, false otherwise (i.e.
+ * the domain didn't exist).
+ */
bool deleteDomain(const std::string& strName, std::string& strError);
void deleteAllDomains();
bool renameDomain(const std::string& strName, const std::string& strNewName, std::string& strError);
@@ -87,6 +111,9 @@ public:
bool& bIsLastApplied,
std::string& strError) const;
+ const CConfigurableDomain* findConfigurableDomain(const std::string& strDomain,
+ std::string& strError) const;
+
// Binary settings load/store
bool serializeSettings(const std::string& strBinarySettingsFilePath, bool bOut, uint8_t uiStructureChecksum, std::string& strError);
@@ -102,12 +129,19 @@ public:
// Class kind
virtual std::string getKind() const;
private:
+ /** Delete a domain
+ *
+ * @param(in] configurableDomain domain to be deleted
+ * @param[in,out] strError error message
+ * @returns true of the domain was sucessfully deleted, false otherwise (i.e.
+ * the domain didn't exist).
+ */
+ void deleteDomain(CConfigurableDomain& configurableDomain);
// Returns true if children dynamic creation is to be dealt with
virtual bool childrenAreDynamic() const;
// Gather owned configurable elements owned by any domain
void gatherAllOwnedConfigurableElements(std::set<const CConfigurableElement*>& configurableElementSet) const;
// Domain retrieval
CConfigurableDomain* findConfigurableDomain(const std::string& strDomain, std::string& strError);
- const CConfigurableDomain* findConfigurableDomain(const std::string& strDomain, std::string& strError) const;
};
diff --git a/parameter/DomainConfiguration.cpp b/parameter/DomainConfiguration.cpp
index 41ffeef..9c353ee 100644
--- a/parameter/DomainConfiguration.cpp
+++ b/parameter/DomainConfiguration.cpp
@@ -33,6 +33,8 @@
#include "CompoundRule.h"
#include "Subsystem.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainImportContext.h"
+#include "XmlDomainExportContext.h"
#include "ConfigurationAccessContext.h"
#include <assert.h>
#include "RuleParser.h"
@@ -71,7 +73,7 @@ bool CDomainConfiguration::childrenAreDynamic() const
bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext)
{
// Actual XML context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainImportContext& xmlDomainImportContext = static_cast<CXmlDomainImportContext&>(serializingContext);
// Take care of configurable elements / area configurations ranks
std::list<CAreaConfiguration*> areaConfigurationList;
@@ -90,7 +92,7 @@ bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsEl
if (!pAreaConfiguration) {
- xmlDomainSerializingContext.setError("Configurable Element " + strConfigurableElementPath + " referred to by Configuration " + getPath() + " not associated to Domain");
+ xmlDomainImportContext.setError("Configurable Element " + strConfigurableElementPath + " referred to by Configuration " + getPath() + " not associated to Domain");
return false;
}
@@ -98,7 +100,7 @@ bool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsEl
areaConfigurationList.push_back(pAreaConfiguration);
// Parse
- if (!serializeConfigurableElementSettings(pAreaConfiguration, xmlConfigurableElementSettingsElement, xmlDomainSerializingContext, false)) {
+ if (!serializeConfigurableElementSettings(pAreaConfiguration, xmlConfigurableElementSettingsElement, xmlDomainImportContext, false)) {
return false;
}
@@ -140,7 +142,8 @@ void CDomainConfiguration::composeSettings(CXmlElement& xmlConfigurationSettings
bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut)
{
// Actual XML context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainExportContext& xmlDomainExportContext =
+ static_cast<CXmlDomainExportContext&>(serializingContext);
// Configurable Element
const CConfigurableElement* pConfigurableElement = pAreaConfiguration->getConfigurableElement();
@@ -183,10 +186,10 @@ bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfigurati
CConfigurationAccessContext configurationAccessContext(strError, bSerializeOut);
// Provide current value space
- configurationAccessContext.setValueSpaceRaw(xmlDomainSerializingContext.valueSpaceIsRaw());
+ configurationAccessContext.setValueSpaceRaw(xmlDomainExportContext.valueSpaceIsRaw());
// Provide current output raw format
- configurationAccessContext.setOutputRawFormat(xmlDomainSerializingContext.outputRawFormatIsHex());
+ configurationAccessContext.setOutputRawFormat(xmlDomainExportContext.outputRawFormatIsHex());
// Get subsystem
const CSubsystem* pSubsystem = pConfigurableElement->getBelongingSubsystem();
@@ -203,7 +206,7 @@ bool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfigurati
if (!pAreaConfiguration->serializeXmlSettings(xmlConfigurableElementSettingsElementContent, configurationAccessContext)) {
// Forward error
- xmlDomainSerializingContext.setError(strError);
+ xmlDomainExportContext.setError(strError);
return false;
}
diff --git a/parameter/Element.cpp b/parameter/Element.cpp
index 2c8393d..4ccf149 100755
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -292,8 +292,8 @@ bool CElement::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& se
return true;
}
-// From IXmlSource
-void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+void CElement::childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const
{
// Browse children and propagate
uint32_t uiNbChildren = getNbChildren();
@@ -308,15 +308,17 @@ void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializin
xmlElement.createChild(xmlChildElement, pChild->getKind());
- // Set attributes
- pChild->setXmlNameAttribute(xmlChildElement);
-
-
// Propagate
pChild->toXml(xmlChildElement, serializingContext);
}
}
+void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ setXmlNameAttribute(xmlElement);
+ childrenToXml(xmlElement, serializingContext);
+}
+
void CElement::setXmlNameAttribute(CXmlElement& xmlElement) const
{
// By default, set Name attribute if any
diff --git a/parameter/Element.h b/parameter/Element.h
index 8469ab6..4636dbd 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -94,6 +94,20 @@ public:
// From IXmlSource
virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+ /**
+ * Serialize the children to XML
+ *
+ * This method is virtual, to be derived in case a special treatment is
+ * needed before doing so.
+ *
+ * @param[in,out] xmlElement the XML Element below which the children must
+ * be serialized (which may or may not be the CElement
+ * object upon which this method is called)
+ * @param[in,out] serializingContext information about the serialization
+ */
+ virtual void childrenToXml(CXmlElement& xmlElement,
+ CXmlSerializingContext& serializingContext) const;
+
// Content structure dump
void dumpContent(std::string& strContent, CErrorContext& errorContext, const uint32_t uiDepth = 0) const;
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index b707225..4b8bdf6 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"
@@ -87,6 +89,7 @@
#include "XmlMemoryDocSource.h"
#include "Utility.h"
#include <sstream>
+#include <memory>
#define base CElement
@@ -257,6 +260,11 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
{ "importDomainsWithSettingsXML",
&CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1,
"<file path>", "Import domains including settings from XML file" },
+ { "importDomainWithSettingsXML",
+ &CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess, 1,
+ "<file path> [overwrite]", "Import a single domain including settings from XML file."
+ " Does not overwrite an existing domain unless 'overwrite' is passed as second"
+ " argument" },
{ "exportSettings", &CParameterMgr::exportSettingsCommmandProcess, 1,
"<file path>", "Export settings to binary file" },
{ "importSettings", &CParameterMgr::importSettingsCommmandProcess, 1,
@@ -264,6 +272,9 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
{ "getDomainsWithSettingsXML",
&CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
"", "Print domains including settings as XML" },
+ { "getDomainWithSettingsXML",
+ &CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess, 1,
+ "<domain>", "Print the given domain including settings as XML" },
{ "setDomainsWithSettingsXML",
&CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess, 1,
"<xml configurable domains>", "Import domains including settings from XML string" },
@@ -295,6 +306,7 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) :
_uiMaxCommandUsageLength(0),
_pLogger(NULL),
_uiLogDepth(0),
+ _bForceNoRemoteInterface(false),
_bFailOnMissingSubsystem(true),
_bFailOnFailedSettingsLoad(true),
_bValidateSchemasOnStart(false)
@@ -620,18 +632,19 @@ 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,
+ *getSystemClass());
// 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;
}
@@ -648,6 +661,38 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
return true;
}
+bool CParameterMgr::importDomainFromFile(const string& strXmlFilePath, bool bOverwrite,
+ string& strError)
+{
+ CXmlDomainImportContext xmlDomainImportContext(strError, true, *getSystemClass());
+
+ // Selection criteria definition for rule creation
+ xmlDomainImportContext.setSelectionCriteriaDefinition(
+ getConstSelectionCriteria()->getSelectionCriteriaDefinition());
+
+ // Auto validation of configurations
+ xmlDomainImportContext.setAutoValidationRequired(true);
+
+ // We initialize the domain with an empty name but since we have set the isDomainStandalone
+ // context, the name will be retrieved during de-serialization
+ std::auto_ptr<CConfigurableDomain> standaloneDomain(new CConfigurableDomain());
+ bool bSuccess = xmlParse(xmlDomainImportContext, standaloneDomain.get(),
+ strXmlFilePath, "", EParameterConfigurationLibrary, "");
+
+ if (!bSuccess) {
+ return false;
+ }
+
+ bSuccess = getConfigurableDomains()->addDomain(*standaloneDomain, bOverwrite, strError);
+ if (!bSuccess) {
+ return false;
+ }
+
+ // ownership has been transfered to the ConfigurableDomains object
+ standaloneDomain.release();
+ return true;
+}
+
// XML parsing
bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName)
{
@@ -658,17 +703,25 @@ bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingCo
// Get Schema file associated to root element
string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd";
- CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath,
- pRootElement->getKind(),
- pRootElement->getName(), strNameAttrituteName,
- _bValidateSchemasOnStart);
+ std::auto_ptr<CXmlFileDocSource> fileDocSource(NULL);
+
+ if (strNameAttrituteName.empty()) {
+ fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ _bValidateSchemasOnStart));
+ } else {
+ fileDocSource.reset(new CXmlFileDocSource(strXmlFilePath, strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ pRootElement->getName(), strNameAttrituteName,
+ _bValidateSchemasOnStart));
+ }
// Start clean
pRootElement->clean();
CXmlMemoryDocSink memorySink(pRootElement);
- if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(*fileDocSource, elementSerializingContext)) {
//Cleanup
pRootElement->clean();
@@ -794,6 +847,16 @@ bool CParameterMgr::getFailureOnFailedSettingsLoad()
return _bFailOnFailedSettingsLoad;
}
+const string& CParameterMgr::getSchemaFolderLocation() const
+{
+ return _strSchemaFolderLocation;
+}
+
+void CParameterMgr::setSchemaFolderLocation(const string& strSchemaFolderLocation)
+{
+ _strSchemaFolderLocation = strSchemaFolderLocation;
+}
+
void CParameterMgr::setValidateSchemasOnStart(bool bValidate)
{
_bValidateSchemasOnStart = bValidate;
@@ -1066,17 +1129,12 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCom
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return getConfigurableDomains()->renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- // Check tuning mode
- if (!checkTuningModeOn(strResult)) {
-
- return CCommandHandler::EFailed;
- }
-
// Set property
bool bSequenceAware;
@@ -1093,7 +1151,8 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenes
return CCommandHandler::EShowUsage;
}
- return getConfigurableDomains()->setSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return setSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1101,7 +1160,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenes
// Get property
bool bSequenceAware;
- if (!getConfigurableDomains()->getSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult)) {
+ if (!getSequenceAwareness(remoteCommand.getArgument(0), bSequenceAware, strResult)) {
return CCommandHandler::EFailed;
}
@@ -1163,7 +1222,9 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfiguration
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- return getConfigurableDomains()->renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.getArgument(2), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return renameConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
+ remoteCommand.getArgument(2), strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1185,12 +1246,6 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfiguratio
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- // Check tuning mode
- if (!checkTuningModeOn(strResult)) {
-
- return CCommandHandler::EFailed;
- }
-
// Build configurable element path list
std::vector<string> astrNewElementSequence;
@@ -1202,7 +1257,9 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceC
}
// Delegate to configurable domains
- return getConfigurableDomains()->setElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), astrNewElementSequence, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return setElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
+ astrNewElementSequence, strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
@@ -1214,19 +1271,25 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceC
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
- return getConfigurableDomains()->setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), remoteCommand.packArguments(2, remoteCommand.getArgumentCount() - 2), getConstSelectionCriteria()->getSelectionCriteriaDefinition(), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
+ remoteCommand.packArguments(2, remoteCommand.getArgumentCount() - 2), strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
- return getConfigurableDomains()->clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
+ return clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
+ strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
- return getConfigurableDomains()->getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
+ return getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
+ strResult) ?
+ CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
/// Elements/Parameters
@@ -1362,11 +1425,6 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommman
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
- // Check tuning mode
- if (!checkTuningModeOn(strResult)) {
-
- return CCommandHandler::EFailed;
- }
// Get value to set
string strValue = remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1);
@@ -1513,6 +1571,26 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableD
return importDomainsXml(remoteCommand.getArgument(0), true, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+{
+ bool bOverwrite = false;
+
+ // Look for optional arguments
+ if (remoteCommand.getArgumentCount() > 1) {
+
+ if (remoteCommand.getArgument(1) == "overwrite") {
+
+ bOverwrite = true;
+ } else {
+ // Show usage
+ return CCommandHandler::EShowUsage;
+ }
+ }
+
+ return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, strResult) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
@@ -1538,6 +1616,16 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess(
+ const IRemoteCommand& remoteCommand, string& strResult)
+{
+ string strDomainName = remoteCommand.getArgument(0);
+
+ return exportSingleDomainXml(strResult, strDomainName, true, false, strResult) ?
+ CCommandHandler::ESucceeded : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus
CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
@@ -1562,6 +1650,12 @@ CParameterMgr::CCommandHandler::CommandStatus
// User set/get parameters in main BlackBoard
bool CParameterMgr::accessParameterValue(const string& strPath, string& strValue, bool bSet, string& strError)
{
+ // Forbid write access when not in TuningMode
+ if (bSet && !checkTuningModeOn(strError)) {
+
+ return false;
+ }
+
// Define context
CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
@@ -1817,16 +1911,6 @@ bool CParameterMgr::sync(string& strError)
return true;
}
-// Content dump
-void CParameterMgr::logStructureContent(string& strContent) const
-{
- string strError;
-
- CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
-
- dumpContent(strContent, parameterAccessContext);
-}
-
// Configuration/Domains handling
bool CParameterMgr::createDomain(const string& strName, string& strError)
{
@@ -1852,6 +1936,12 @@ bool CParameterMgr::deleteDomain(const string& strName, string& strError)
return getConfigurableDomains()->deleteDomain(strName, strError);
}
+bool CParameterMgr::renameDomain(const string& strName, const string& strNewName, string& strError)
+{
+ // Delegate to configurable domains
+ return getConfigurableDomains()->renameDomain(strName, strNewName, strError);
+}
+
bool CParameterMgr::deleteAllDomains(string& strError)
{
// Check tuning mode
@@ -1866,6 +1956,23 @@ bool CParameterMgr::deleteAllDomains(string& strError)
return true;
}
+bool CParameterMgr::setSequenceAwareness(const string& strName, bool bSequenceAware, string& strResult)
+{
+ // Check tuning mode
+ if (!checkTuningModeOn(strResult)) {
+
+ return false;
+ }
+
+ return getConfigurableDomains()->setSequenceAwareness(strName, bSequenceAware, strResult);
+}
+
+bool CParameterMgr::getSequenceAwareness(const string& strName, bool& bSequenceAware,
+ string& strResult)
+{
+ return getConfigurableDomains()->getSequenceAwareness(strName, bSequenceAware, strResult);
+}
+
bool CParameterMgr::createConfiguration(const string& strDomain, const string& strConfiguration, string& strError)
{
// Check tuning mode
@@ -1877,6 +1984,12 @@ bool CParameterMgr::createConfiguration(const string& strDomain, const string& s
// Delegate to configurable domains
return getConfigurableDomains()->createConfiguration(strDomain, strConfiguration, _pMainParameterBlackboard, strError);
}
+bool CParameterMgr::renameConfiguration(const string& strDomain, const string& strConfiguration,
+ const string& strNewConfiguration, string& strError)
+{
+ return getConfigurableDomains()->renameConfiguration(strDomain, strConfiguration,
+ strNewConfiguration, strError);
+}
bool CParameterMgr::deleteConfiguration(const string& strDomain, const string& strConfiguration, string& strError)
{
@@ -1955,7 +2068,7 @@ bool CParameterMgr::removeConfigurableElementFromDomain(const string& strDomain,
if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) {
- return CCommandHandler::EFailed;
+ return false;
}
// Convert element
@@ -1979,7 +2092,7 @@ bool CParameterMgr::split(const string& strDomain, const string& strConfigurable
if (!elementLocator.locate(strConfigurableElementPath, &pLocatedElement, strError)) {
- return CCommandHandler::EFailed;
+ return false;
}
// Convert element
@@ -1989,6 +2102,40 @@ bool CParameterMgr::split(const string& strDomain, const string& strConfigurable
return getConfigurableDomains()->split(strDomain, pConfigurableElement, strError);
}
+bool CParameterMgr::setElementSequence(const string& strDomain, const string& strConfiguration,
+ const std::vector<string>& astrNewElementSequence,
+ string& strError)
+{
+ // Check tuning mode
+ if (!checkTuningModeOn(strError)) {
+
+ return false;
+ }
+
+ return getConfigurableDomains()->setElementSequence(strDomain, strConfiguration,
+ astrNewElementSequence, strError);
+}
+
+bool CParameterMgr::getApplicationRule(const string& strDomain, const string& strConfiguration,
+ string& strResult)
+{
+ return getConfigurableDomains()->getApplicationRule(strDomain, strConfiguration, strResult);
+}
+
+bool CParameterMgr::setApplicationRule(const string& strDomain, const string& strConfiguration,
+ const string& strApplicationRule, string& strError)
+{
+ return getConfigurableDomains()->setApplicationRule(strDomain, strConfiguration,
+ strApplicationRule, getConstSelectionCriteria()->getSelectionCriteriaDefinition(),
+ strError);
+}
+
+bool CParameterMgr::clearApplicationRule(const string& strDomain, const string& strConfiguration,
+ string& strError)
+{
+ return getConfigurableDomains()->clearApplicationRule(strDomain, strConfiguration, strError);
+}
+
bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSettings,
bool bFromFile, string& strError)
{
@@ -2009,14 +2156,14 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
// Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass());
// 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 +2197,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) {
@@ -2069,35 +2216,43 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti
return bProcessSuccess;
}
-bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
- string& strError) const
+bool CParameterMgr::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
+ string& strError)
{
+ if (!checkTuningModeOn(strError)) {
+
+ return false;
+ }
+
// check path is absolute
- if (bToFile && strXmlDest[0] != '/') {
+ if (strXmlSource[0] != '/') {
strError = "Please provide absolute path";
return false;
}
- // Root element
- const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+ return importDomainFromFile(strXmlSource, bOverwrite, strError);
+}
- // Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
- pConfigurableDomains->getKind() + ".xsd";
+bool CParameterMgr::serializeElement(string& strXmlDest,
+ CXmlSerializingContext& xmlSerializingContext, bool bToFile,
+ const CElement& element, string& strError) const
+{
+ // check path is absolute
+ if (bToFile && strXmlDest[0] != '/') {
- // Context
- CXmlDomainSerializingContext xmlDomainSerializingContext(strError, bWithSettings);
+ strError = "Please provide absolute path";
- // Value space
- xmlDomainSerializingContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+ return false;
+ }
- // Output raw format
- xmlDomainSerializingContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ // Get Schema file associated to root element
+ string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
+ element.getKind() + ".xsd";
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(),
+ CXmlMemoryDocSource memorySource(&element, element.getKind(),
strXmlSchemaFilePath, "parameter-framework",
getVersion(), _bValidateSchemasOnStart);
@@ -2112,15 +2267,55 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo
} else {
// Use a doc sink to write the doc data in a string
+ // TODO: use a stream rather than a string
pSink = new CXmlStringDocSink(strXmlDest);
}
- bool bProcessSuccess = pSink->process(memorySource, xmlDomainSerializingContext);
+ bool bProcessSuccess = pSink->process(memorySource, xmlSerializingContext);
delete pSink;
return bProcessSuccess;
}
+bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
+ string& strError) const
+{
+ const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+
+
+ return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
+ *pConfigurableDomains, strError);
+}
+
+bool CParameterMgr::exportSingleDomainXml(string& strXmlDest, const string& strDomainName,
+ bool bWithSettings, bool bToFile, string& strError) const
+{
+ const CConfigurableDomains* pAllDomains = getConstConfigurableDomains();
+
+ // Element to be serialized
+ const CConfigurableDomain* pRequestedDomain =
+ pAllDomains->findConfigurableDomain(strDomainName, strError);
+
+ if (!pRequestedDomain) {
+ return false;
+ }
+
+ CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+
+ xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+
+ xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+
+ return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
+ *pRequestedDomain, strError);
+}
+
// Binary Import/Export
bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strError)
{
@@ -2224,7 +2419,7 @@ void CParameterMgr::feedElementLibraries()
// Parameter Configuration Domains creation
CElementLibrary* pParameterConfigurationLibrary = new CElementLibrary;
- pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TNamedElementBuilderTemplate<CConfigurableDomain>());
+ pParameterConfigurationLibrary->addElementBuilder("ConfigurableDomain", new TElementBuilderTemplate<CConfigurableDomain>());
pParameterConfigurationLibrary->addElementBuilder("Configuration", new TNamedElementBuilderTemplate<CDomainConfiguration>());
pParameterConfigurationLibrary->addElementBuilder("CompoundRule", new TElementBuilderTemplate<CCompoundRule>());
pParameterConfigurationLibrary->addElementBuilder("SelectionCriterionRule", new TElementBuilderTemplate<CSelectionCriterionRule>());
@@ -2232,11 +2427,26 @@ void CParameterMgr::feedElementLibraries()
_pElementLibrarySet->addElementLibrary(pParameterConfigurationLibrary);
}
+bool CParameterMgr::getForceNoRemoteInterface() const
+{
+ return _bForceNoRemoteInterface;
+}
+
+void CParameterMgr::setForceNoRemoteInterface(bool bForceNoRemoteInterface)
+{
+ _bForceNoRemoteInterface = bForceNoRemoteInterface;
+}
+
// Remote Processor Server connection handling
bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
{
CAutoLog autoLog(this, "Handling remote processing interface");
+ if (_bForceNoRemoteInterface) {
+ // The user requested not to start the remote interface
+ return true;
+ }
+
// Start server if tuning allowed
if (getConstFrameworkConfiguration()->isTuningAllowed()) {
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index 0ff0272..c6a2fd5 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -88,7 +88,7 @@ class CParameterMgr : private CElement
};
// Version
static const uint32_t guiEditionMajor = 0x2;
- static const uint32_t guiEditionMinor = 0x2;
+ static const uint32_t guiEditionMinor = 0x3;
static const uint32_t guiRevision = 0x0;
// Parameter handle friendship
@@ -143,6 +143,17 @@ public:
// Dynamic parameter handling
CParameterHandle* createParameterHandle(const std::string& strPath, std::string& strError);
+ /** Is the remote interface forcefully disabled ?
+ */
+ bool getForceNoRemoteInterface() const;
+
+ /**
+ * Forcefully disable the remote interface or cancel this policy
+ *
+ * @param[in] bForceNoRemoteInterface disable the remote interface if true.
+ */
+ void setForceNoRemoteInterface(bool bForceNoRemoteInterface);
+
/** Should start fail in case of missing subsystems.
*
* @param[in] bFail: If set to true, parameterMgr start will fail on missing subsystems.
@@ -168,6 +179,18 @@ public:
*/
bool getFailureOnFailedSettingsLoad();
+ /** Get the path to the directory containing the XML Schemas
+ *
+ * @returns the directory containing the XML Schemas
+ */
+ const std::string& getSchemaFolderLocation() const;
+
+ /** Override the directory containing the XML Schemas
+ *
+ * @param[in] strSchemaFolderLocation directory containing the XML Schemas
+ */
+ void setSchemaFolderLocation(const std::string& strSchemaFolderLocation);
+
/** Should .xml files be validated on start ?
*
* @param[in] bValidate:
@@ -205,7 +228,6 @@ public:
bool sync(std::string& strError);
// User set/get parameters
- bool accessValue(CParameterAccessContext& parameterAccessContext, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError);
bool accessParameterValue(const std::string& strPath, std::string& strValue, bool bSet, std::string& strError);
/**
* Returns the element mapping corresponding to the path given in parameter.
@@ -221,10 +243,17 @@ public:
////////// Configuration/Domains handling //////////////
// Creation/Deletion
bool createDomain(const std::string& strName, std::string& strError);
+ bool renameDomain(const std::string& strName, const std::string& strNewName,
+ std::string& strError);
bool deleteDomain(const std::string& strName, std::string& strError);
bool deleteAllDomains(std::string& strError);
+ bool setSequenceAwareness(const std::string& strName, bool bSequenceAware,
+ std::string& strResult);
+ bool getSequenceAwareness(const std::string& strName, bool& bSequenceAware,
+ std::string& strResult);
bool createConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
bool deleteConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
+ bool renameConfiguration(const std::string& strDomain, const std::string& strConfiguration, const std::string& strNewConfiguration, std::string& strError);
// Save/Restore
bool restoreConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::list<std::string>& strError);
@@ -234,6 +263,16 @@ public:
bool addConfigurableElementToDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
bool removeConfigurableElementFromDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
bool split(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
+ bool setElementSequence(const std::string& strDomain, const std::string& strConfiguration,
+ const std::vector<std::string>& astrNewElementSequence,
+ std::string& strError);
+
+ bool getApplicationRule(const std::string& strDomain, const std::string& strConfiguration,
+ std::string& strResult);
+ bool setApplicationRule(const std::string& strDomain, const std::string& strConfiguration,
+ const std::string& strApplicationRule, std::string& strError);
+ bool clearApplicationRule(const std::string& strDomain, const std::string& strConfiguration,
+ std::string& strError);
/**
* Method that imports Configurable Domains from an Xml source.
@@ -251,22 +290,51 @@ public:
std::string& strError);
/**
+ * Method that imports a single Configurable Domain from an Xml source.
+ *
+ * @param[in] strXmlSource a string containing an xml description or a path to an xml file
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bFromFile a boolean that determines if the source is an xml description in
+ * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
+ std::string& strError);
+
+ /**
* Method that exports Configurable Domains to an Xml destination.
- * If bToFile is false, the xml description from the xml document will be written
- * in strXmlDest. Otherwise it will be written in a file located at the path in strXmlDest
*
- * @param[in:out] strXmlDest a std::string containing an xml description or a path to an xml file
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
* @param[in] bWithSettings a boolean that determines if the settings should be used in the
* xml description
* @param[in] bToFile a boolean that determines if the destination is an xml description in
* strXmlDest or contained in a file. In that case strXmlDest is just the file path.
* @param[out] strError is used as the error output
*
- * @return false if any error occures
+ * @return false if any error occurs, true otherwise.
*/
bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile,
std::string& strError) const;
+ /**
+ * Method that exports a given Configurable Domain to an Xml destination.
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
+ * @param[in] strDomainName the name of the domain to be exported
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs, true otherwise.
+ */
+ bool exportSingleDomainXml(std::string& strXmlDest, const std::string& strDomainName,
+ bool bWithSettings, bool bToFile, std::string& strError) const;
+
// Binary Import/Export
bool importDomainsBinary(const std::string& strFileName, std::string& strError);
bool exportDomainsBinary(const std::string& strFileName, std::string& strError);
@@ -281,9 +349,6 @@ public:
*/
bool getSystemClassXMLString(std::string& strResult);
- // Introspect
- void logStructureContent(std::string& strContent) const;
-
// CElement
virtual std::string getKind() const;
@@ -367,11 +432,12 @@ private:
CCommandHandler::CommandStatus importConfigurableDomainsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus exportConfigurableDomainsWithSettingsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
CCommandHandler::CommandStatus importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainWithSettings command.
+ * Command handler method for getConfigurableDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -383,6 +449,18 @@ private:
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
+ * Command handler method for getConfigurableDomainWithSettings command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] strResult a string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus getConfigurableDomainWithSettingsXMLCommmandProcess(
+ const IRemoteCommand& remoteCommand, std::string& strResult);
+
+ /**
* Command handler method for setConfigurableDomainWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
@@ -419,6 +497,7 @@ private:
CParameterBlackboard* getParameterBlackboard();
// Parameter access
+ bool accessValue(CParameterAccessContext& parameterAccessContext, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError);
bool doSetValue(const std::string& strPath, const std::string& strValue, bool bRawValueSpace, bool bDynamicAccess, std::string& strError) const;
bool doGetValue(const std::string& strPath, std::string& strValue, bool bRawValueSpace, bool bHexOutputRawFormat, bool bDynamicAccess, std::string& strError) const;
@@ -435,6 +514,34 @@ private:
// Parse XML file into Root element
bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const std::string& strXmlFilePath, const std::string& strXmlFolder, ElementLibrary eElementLibrary, const std::string& strNameAttrituteName = "Name");
+ /**
+ * Export an element object to an Xml destination.
+ *
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file.
+ * @param[in] xmlSerializingContext the serializing context
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[in] element object to be serialized.
+ * @param[out] strError is used as the error output.
+ *
+ * @return false if any error occurs, true otherwise.
+ */
+ bool serializeElement(std::string& strXmlDest, CXmlSerializingContext& xmlSerializingContext,
+ bool bToFile, const CElement& element, std::string& strError) const;
+
+ /**
+ * Method that imports a single Configurable Domain, with settings, from an Xml file.
+ *
+ * @param[in] strXmlFilePath absolute path to the xml file containing the domain
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importDomainFromFile(const std::string& strXmlFilePath, bool bOverwrite,
+ std::string& strError);
+
+
// Framework Configuration
CParameterFrameworkConfiguration* getFrameworkConfiguration();
const CParameterFrameworkConfiguration* getConstFrameworkConfiguration();
@@ -518,6 +625,12 @@ private:
ILogger* _pLogger;
mutable uint32_t _uiLogDepth;
+ /** If set to false, the remote interface won't be started no matter what.
+ * If set to true - the default - it has no impact on the policy for
+ * starting the remote interface.
+ */
+ bool _bForceNoRemoteInterface;
+
/** If set to true, missing subsystem will abort parameterMgr start.
* If set to false, missing subsystem will fallback on virtual subsystem.
*/
diff --git a/parameter/ParameterMgrFullConnector.cpp b/parameter/ParameterMgrFullConnector.cpp
new file mode 100644
index 0000000..b03facc
--- /dev/null
+++ b/parameter/ParameterMgrFullConnector.cpp
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "ParameterMgrFullConnector.h"
+#include "ParameterMgr.h"
+#include "ParameterMgrLogger.h"
+
+#include <list>
+
+using std::string;
+
+CParameterMgrFullConnector::CParameterMgrFullConnector(const string& strConfigurationFilePath) :
+ _pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _pLogger(NULL)
+{
+ _pParameterMgrLogger = new CParameterMgrLogger<CParameterMgrFullConnector>(*this);
+ _pParameterMgr->setLogger(_pParameterMgrLogger);
+}
+
+CParameterMgrFullConnector::~CParameterMgrFullConnector()
+{
+ delete _pParameterMgr;
+ delete _pParameterMgrLogger;
+}
+
+
+bool CParameterMgrFullConnector::start(string& strError)
+{
+ // Create data structure & Init flow
+ return _pParameterMgr->load(strError) && _pParameterMgr->init(strError);
+}
+
+void CParameterMgrFullConnector::setLogger(CParameterMgrFullConnector::ILogger* pLogger)
+{
+ _pLogger = pLogger;
+}
+
+// Private logging
+void CParameterMgrFullConnector::doLog(bool bIsWarning, const string& strLog)
+{
+ if (_pLogger) {
+
+ _pLogger->log(bIsWarning, strLog);
+ }
+}
+
+CParameterHandle* CParameterMgrFullConnector::createParameterHandle(const string& strPath,
+ string& strError)
+{
+ return _pParameterMgr->createParameterHandle(strPath, strError);
+}
+
+ISelectionCriterionTypeInterface* CParameterMgrFullConnector::createSelectionCriterionType(
+ bool bIsInclusive)
+{
+ return _pParameterMgr->createSelectionCriterionType(bIsInclusive);
+}
+
+ISelectionCriterionInterface* CParameterMgrFullConnector::createSelectionCriterion(
+ const string& strName,
+ const ISelectionCriterionTypeInterface* pSelectionCriterionType)
+{
+ return _pParameterMgr->createSelectionCriterion(strName,
+ static_cast<const CSelectionCriterionType*>(pSelectionCriterionType));
+}
+
+ISelectionCriterionInterface* CParameterMgrFullConnector::getSelectionCriterion(
+ const string& strName)
+{
+ return _pParameterMgr->getSelectionCriterion(strName);
+}
+
+bool CParameterMgrFullConnector::getForceNoRemoteInterface() const
+{
+ return _pParameterMgr->getForceNoRemoteInterface();
+}
+
+void CParameterMgrFullConnector::setForceNoRemoteInterface(bool bForceNoRemoteInterface)
+{
+ _pParameterMgr->setForceNoRemoteInterface(bForceNoRemoteInterface);
+}
+
+void CParameterMgrFullConnector::applyConfigurations()
+{
+ return _pParameterMgr->applyConfigurations();
+}
+
+void CParameterMgrFullConnector::setFailureOnMissingSubsystem(bool bFail)
+{
+ _pParameterMgr->setFailureOnMissingSubsystem(bFail);
+}
+
+bool CParameterMgrFullConnector::getFailureOnMissingSubsystem() const
+{
+ return _pParameterMgr->getFailureOnMissingSubsystem();
+}
+
+void CParameterMgrFullConnector::setFailureOnFailedSettingsLoad(bool bFail)
+{
+ _pParameterMgr->setFailureOnFailedSettingsLoad(bFail);
+}
+
+bool CParameterMgrFullConnector::getFailureOnFailedSettingsLoad()
+{
+ return _pParameterMgr->getFailureOnFailedSettingsLoad();
+}
+
+const string& CParameterMgrFullConnector::getSchemaFolderLocation() const
+{
+ return _pParameterMgr->getSchemaFolderLocation();
+}
+
+void CParameterMgrFullConnector::setSchemaFolderLocation(const string& strSchemaFolderLocation)
+{
+ _pParameterMgr->setSchemaFolderLocation(strSchemaFolderLocation);
+}
+
+void CParameterMgrFullConnector::setValidateSchemasOnStart(bool bValidate)
+{
+ _pParameterMgr->setValidateSchemasOnStart(bValidate);
+}
+
+bool CParameterMgrFullConnector::getValidateSchemasOnStart() const
+{
+ return _pParameterMgr->getValidateSchemasOnStart();
+}
+
+bool CParameterMgrFullConnector::setTuningMode(bool bOn, string& strError)
+{
+ return _pParameterMgr->setTuningMode(bOn, strError);
+}
+
+bool CParameterMgrFullConnector::isTuningModeOn() const
+{
+ return _pParameterMgr->tuningModeOn();
+}
+
+void CParameterMgrFullConnector::setValueSpace(bool bIsRaw)
+{
+ return _pParameterMgr->setValueSpace(bIsRaw);
+}
+
+bool CParameterMgrFullConnector::isValueSpaceRaw() const
+{
+ return _pParameterMgr->valueSpaceIsRaw();
+}
+
+void CParameterMgrFullConnector::setOutputRawFormat(bool bIsHex)
+{
+ return _pParameterMgr->setOutputRawFormat(bIsHex);
+}
+
+bool CParameterMgrFullConnector::isOutputRawFormatHex() const
+{
+ return _pParameterMgr->outputRawFormatIsHex();
+}
+
+bool CParameterMgrFullConnector::setAutoSync(bool bAutoSyncOn, string& strError)
+{
+ return _pParameterMgr->setAutoSync(bAutoSyncOn, strError);
+}
+
+bool CParameterMgrFullConnector::isAutoSyncOn() const
+{
+ return _pParameterMgr->autoSyncOn();
+}
+
+bool CParameterMgrFullConnector::sync(string& strError)
+{
+ return _pParameterMgr->sync(strError);
+}
+
+bool CParameterMgrFullConnector::accessParameterValue(const string& strPath, string& strValue,
+ bool bSet, string& strError)
+{
+ return _pParameterMgr->accessParameterValue(strPath, strValue, bSet, strError);
+}
+
+bool CParameterMgrFullConnector::accessConfigurationValue(const string &strDomain,
+ const string &strConfiguration,
+ const string& strPath, string& strValue,
+ bool bSet, string& strError)
+{
+ return _pParameterMgr->accessConfigurationValue(strDomain, strConfiguration, strPath, strValue,
+ bSet, strError);
+}
+
+bool CParameterMgrFullConnector::getParameterMapping(const string& strPath, string& strValue) const
+{
+ return _pParameterMgr->getParameterMapping(strPath, strValue);
+}
+
+bool CParameterMgrFullConnector::createDomain(const string& strName, string& strError)
+{
+ return _pParameterMgr->createDomain(strName, strError);
+}
+
+bool CParameterMgrFullConnector::deleteDomain(const string& strName, string& strError)
+{
+ return _pParameterMgr->deleteDomain(strName, strError);
+}
+
+bool CParameterMgrFullConnector::renameDomain(const string& strName, const string& strNewName,
+ string& strError)
+{
+ return _pParameterMgr->renameDomain(strName, strNewName, strError);
+}
+
+bool CParameterMgrFullConnector::deleteAllDomains(string& strError)
+{
+ return _pParameterMgr->deleteAllDomains(strError);
+}
+
+bool CParameterMgrFullConnector::createConfiguration(const string& strDomain,
+ const string& strConfiguration,
+ string& strError)
+{
+ return _pParameterMgr->createConfiguration(strDomain, strConfiguration, strError);
+}
+
+bool CParameterMgrFullConnector::deleteConfiguration(const string& strDomain,
+ const string& strConfiguration,
+ string& strError)
+{
+ return _pParameterMgr->deleteConfiguration(strDomain, strConfiguration, strError);
+}
+
+bool CParameterMgrFullConnector::renameConfiguration(const string& strDomain,
+ const string& strConfiguration,
+ const string& strNewConfiguration,
+ string& strError)
+{
+ return _pParameterMgr->renameConfiguration(strDomain, strConfiguration, strNewConfiguration,
+ strError);
+}
+
+bool CParameterMgrFullConnector::saveConfiguration(const string& strDomain,
+ const string& strConfiguration, string& strError)
+{
+ return _pParameterMgr->saveConfiguration(strDomain, strConfiguration, strError);
+}
+
+bool CParameterMgrFullConnector::restoreConfiguration(const string& strDomain,
+ const string& strConfiguration,
+ std::list<string>& lstrError)
+{
+ return _pParameterMgr->restoreConfiguration(strDomain, strConfiguration, lstrError);
+}
+
+bool CParameterMgrFullConnector::setSequenceAwareness(const string& strName, bool bSequenceAware,
+ string& strResult)
+{
+ return _pParameterMgr->setSequenceAwareness(strName, bSequenceAware, strResult);
+}
+
+bool CParameterMgrFullConnector::getSequenceAwareness(const string& strName, bool& bSequenceAware,
+ string& strResult)
+{
+ return _pParameterMgr->getSequenceAwareness(strName, bSequenceAware, strResult);
+}
+
+bool CParameterMgrFullConnector::addConfigurableElementToDomain(const string& strDomain,
+ const string& strConfigurableElementPath, string& strError)
+{
+ return _pParameterMgr->addConfigurableElementToDomain(strDomain, strConfigurableElementPath,
+ strError);
+}
+
+bool CParameterMgrFullConnector::removeConfigurableElementFromDomain(const string& strDomain,
+ const string& strConfigurableElementPath, string& strError)
+{
+ return _pParameterMgr->removeConfigurableElementFromDomain(strDomain,
+ strConfigurableElementPath, strError);
+}
+
+bool CParameterMgrFullConnector::split(const string& strDomain,
+ const string& strConfigurableElementPath, string& strError)
+{
+ return _pParameterMgr->split(strDomain, strConfigurableElementPath, strError);
+}
+
+bool CParameterMgrFullConnector::setElementSequence(const string& strDomain,
+ const string& strConfiguration,
+ const std::vector<string>& astrNewElementSequence,
+ string& strError)
+{
+ return _pParameterMgr->setElementSequence(strDomain, strConfiguration, astrNewElementSequence,
+ strError);
+}
+
+bool CParameterMgrFullConnector::setApplicationRule(const string& strDomain,
+ const string& strConfiguration,
+ const string& strApplicationRule,
+ string& strError)
+{
+ return _pParameterMgr->setApplicationRule(strDomain, strConfiguration, strApplicationRule,
+ strError);
+}
+
+
+bool CParameterMgrFullConnector::getApplicationRule(const string& strDomain,
+ const string& strConfiguration,
+ string& strResult)
+{
+ return _pParameterMgr->getApplicationRule(strDomain, strConfiguration, strResult);
+}
+bool CParameterMgrFullConnector::clearApplicationRule(const string& strDomain,
+ const string& strConfiguration,
+ string& strError)
+{
+ return _pParameterMgr->clearApplicationRule(strDomain, strConfiguration, strError);
+}
+
+
+bool CParameterMgrFullConnector::importDomainsXml(const string& strXmlSource, bool bWithSettings,
+ bool bFromFile, string& strError)
+{
+ return _pParameterMgr->importDomainsXml(strXmlSource, bWithSettings, bFromFile, strError);
+}
+
+bool CParameterMgrFullConnector::exportDomainsXml(string& strXmlDest, bool bWithSettings,
+ bool bToFile, string& strError) const
+{
+ return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError);
+}
+
+bool CParameterMgrFullConnector::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
+ string& strError)
+{
+ return _pParameterMgr->importSingleDomainXml(strXmlSource, bOverwrite, strError);
+}
+
+bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest,
+ const string& strDomainName,
+ bool bWithSettings, bool bToFile,
+ string& strError) const
+{
+ return _pParameterMgr->exportSingleDomainXml(strXmlDest, strDomainName, bWithSettings, bToFile,
+ strError);
+}
+
+bool CParameterMgrFullConnector::getSystemClassXMLString(string& strResult)
+{
+ return _pParameterMgr->getSystemClassXMLString(strResult);
+}
diff --git a/parameter/ParameterMgrLogger.h b/parameter/ParameterMgrLogger.h
index 5a8dd9d..0e42d8a 100644
--- a/parameter/ParameterMgrLogger.h
+++ b/parameter/ParameterMgrLogger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -29,22 +29,29 @@
*/
#pragma once
+#include "ParameterMgrLoggerForward.h"
#include "ParameterMgr.h"
#include <string>
-class CParameterMgrPlatformConnector;
-
+/* Wrap a class to expose its logging [log(bool, string&)] capabilities
+ * through ILogger. */
+template<class T>
class CParameterMgrLogger : public CParameterMgr::ILogger
{
public:
- CParameterMgrLogger(CParameterMgrPlatformConnector* pParameterMgrPlatformConnector);
+ CParameterMgrLogger(T& parameterMgrConnector) :
+ _parameterMgrConnector(parameterMgrConnector)
+ {
+ }
- // Logging
- virtual void log(bool bIsWarning, const std::string& strLog);
+ virtual void log(bool bIsWarning, const std::string& strLog)
+ {
+ _parameterMgrConnector.doLog(bIsWarning, strLog);
+ }
private:
// Log destination
- CParameterMgrPlatformConnector* _pParameterMgrPlatformConnector;
+ T& _parameterMgrConnector;
};
diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp
index b98692c..f29c8a8 100644
--- a/parameter/ParameterMgrPlatformConnector.cpp
+++ b/parameter/ParameterMgrPlatformConnector.cpp
@@ -40,7 +40,7 @@ CParameterMgrPlatformConnector::CParameterMgrPlatformConnector(
_pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _bStarted(false), _pLogger(NULL)
{
// Logging
- _pParameterMgrLogger = new CParameterMgrLogger(this);
+ _pParameterMgrLogger = new CParameterMgrLogger<CParameterMgrPlatformConnector>(*this);
_pParameterMgr->setLogger(_pParameterMgrLogger);
}
@@ -93,6 +93,16 @@ void CParameterMgrPlatformConnector::setLogger(CParameterMgrPlatformConnector::I
_pLogger = pLogger;
}
+bool CParameterMgrPlatformConnector::getForceNoRemoteInterface() const
+{
+ return _pParameterMgr->getForceNoRemoteInterface();
+}
+
+void CParameterMgrPlatformConnector::setForceNoRemoteInterface(bool bForceNoRemoteInterface)
+{
+ _pParameterMgr->setForceNoRemoteInterface(bForceNoRemoteInterface);
+}
+
bool CParameterMgrPlatformConnector::setFailureOnMissingSubsystem(bool bFail, string &strError)
{
if (_bStarted) {
@@ -128,6 +138,16 @@ bool CParameterMgrPlatformConnector::getFailureOnFailedSettingsLoad()
return _pParameterMgr->getFailureOnFailedSettingsLoad();
}
+const string& CParameterMgrPlatformConnector::getSchemaFolderLocation() const
+{
+ return _pParameterMgr->getSchemaFolderLocation();
+}
+
+void CParameterMgrPlatformConnector::setSchemaFolderLocation(const string& strSchemaFolderLocation)
+{
+ _pParameterMgr->setSchemaFolderLocation(strSchemaFolderLocation);
+}
+
bool CParameterMgrPlatformConnector::setValidateSchemasOnStart(
bool bValidate, std::string& strError)
{
diff --git a/parameter/SelectionCriterionRule.cpp b/parameter/SelectionCriterionRule.cpp
index e03e3a0..c376bb3 100644
--- a/parameter/SelectionCriterionRule.cpp
+++ b/parameter/SelectionCriterionRule.cpp
@@ -30,6 +30,7 @@
#include "SelectionCriterionRule.h"
#include "SelectionCriterion.h"
#include "XmlDomainSerializingContext.h"
+#include "XmlDomainImportContext.h"
#include "SelectionCriteriaDefinition.h"
#include "SelectionCriterionTypeInterface.h"
#include "RuleParser.h"
@@ -153,17 +154,17 @@ bool CSelectionCriterionRule::matches() const
bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
// Retrieve actual context
- CXmlDomainSerializingContext& xmlDomainSerializingContext = static_cast<CXmlDomainSerializingContext&>(serializingContext);
+ CXmlDomainImportContext& xmlDomainImportContext = static_cast<CXmlDomainImportContext&>(serializingContext);
// Get selection criterion
string strSelectionCriterion = xmlElement.getAttributeString("SelectionCriterion");
- _pSelectionCriterion = xmlDomainSerializingContext.getSelectionCriteriaDefinition()->getSelectionCriterion(strSelectionCriterion);
+ _pSelectionCriterion = xmlDomainImportContext.getSelectionCriteriaDefinition()->getSelectionCriterion(strSelectionCriterion);
// Check existence
if (!_pSelectionCriterion) {
- xmlDomainSerializingContext.setError("Couldn't find selection criterion " + strSelectionCriterion + " in " + getKind() + " " + xmlElement.getPath());
+ xmlDomainImportContext.setError("Couldn't find selection criterion " + strSelectionCriterion + " in " + getKind() + " " + xmlElement.getPath());
return false;
}
@@ -174,7 +175,7 @@ bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSeriali
if (!setMatchesWhen(strMatchesWhen, strError)) {
- xmlDomainSerializingContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath() + ": " + strError);
+ xmlDomainImportContext.setError("Wrong MatchesWhen attribute " + strMatchesWhen + " in " + getKind() + " " + xmlElement.getPath() + ": " + strError);
return false;
}
@@ -184,7 +185,7 @@ bool CSelectionCriterionRule::fromXml(const CXmlElement& xmlElement, CXmlSeriali
if (!_pSelectionCriterion->getCriterionType()->getNumericalValue(strValue, _iMatchValue)) {
- xmlDomainSerializingContext.setError("Wrong Value attribute value " + strValue + " in " + getKind() + " " + xmlElement.getPath());
+ xmlDomainImportContext.setError("Wrong Value attribute value " + strValue + " in " + getKind() + " " + xmlElement.getPath());
return false;
}
diff --git a/parameter/XmlDomainExportContext.h b/parameter/XmlDomainExportContext.h
new file mode 100644
index 0000000..6a95d97
--- /dev/null
+++ b/parameter/XmlDomainExportContext.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "XmlDomainSerializingContext.h"
+#include <string>
+
+class CXmlDomainExportContext : public CXmlDomainSerializingContext
+{
+public:
+ CXmlDomainExportContext(std::string& strError, bool bWithSettings):
+ base(strError, bWithSettings) {}
+
+ // Value interpretation as Real or Raw
+ void setValueSpaceRaw(bool bIsRaw)
+ {
+ _bValueSpaceIsRaw = bIsRaw;
+ }
+
+ bool valueSpaceIsRaw() const
+ {
+ return _bValueSpaceIsRaw;
+ }
+
+ // Output Raw Format for user get value interpretation
+ void setOutputRawFormat(bool bIsHex)
+ {
+ _bOutputRawFormatIsHex = bIsHex;
+ }
+
+ bool outputRawFormatIsHex() const
+ {
+ return _bOutputRawFormatIsHex;
+ }
+
+private:
+ typedef CXmlDomainSerializingContext base;
+
+ // Value Space
+ bool _bValueSpaceIsRaw;
+
+ // Output Raw Format
+ bool _bOutputRawFormatIsHex;
+
+};
diff --git a/parameter/XmlDomainImportContext.h b/parameter/XmlDomainImportContext.h
new file mode 100644
index 0000000..11090b0
--- /dev/null
+++ b/parameter/XmlDomainImportContext.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "XmlDomainSerializingContext.h"
+#include "SelectionCriteriaDefinition.h"
+#include "SystemClass.h"
+
+#include <string>
+
+class CXmlDomainImportContext : public CXmlDomainSerializingContext
+{
+public:
+ CXmlDomainImportContext(std::string& strError, bool bWithSettings, CSystemClass& systemClass):
+ base(strError, bWithSettings), _systemClass(systemClass), _bAutoValidationRequired(true) {}
+
+ // System Class
+ CSystemClass& getSystemClass() const
+ {
+ return _systemClass;
+ }
+
+ // Criteria defintion
+ void setSelectionCriteriaDefinition(
+ const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition)
+ {
+ _pSelectionCriteriaDefinition = pSelectionCriteriaDefinition;
+ }
+
+ const CSelectionCriteriaDefinition* getSelectionCriteriaDefinition() const
+ {
+ return _pSelectionCriteriaDefinition;
+ }
+
+ // Auto validation of configurations
+ void setAutoValidationRequired(bool bAutoValidationRequired)
+ {
+ _bAutoValidationRequired = bAutoValidationRequired;
+ }
+
+ bool autoValidationRequired() const
+ {
+ return _bAutoValidationRequired;
+ }
+
+private:
+ typedef CXmlDomainSerializingContext base;
+
+ // System Class
+ CSystemClass& _systemClass;
+
+ // Criteria defintion
+ const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;
+
+ // Auto validation of configurations
+ bool _bAutoValidationRequired;
+};
+
diff --git a/parameter/XmlDomainSerializingContext.cpp b/parameter/XmlDomainSerializingContext.cpp
deleted file mode 100644
index c159fbf..0000000
--- a/parameter/XmlDomainSerializingContext.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011-2014, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "XmlDomainSerializingContext.h"
-
-#define base CXmlElementSerializingContext
-
-using std::string;
-
-CXmlDomainSerializingContext::CXmlDomainSerializingContext(string& strError, bool bWithSettings)
- : base(strError), _bWithSettings(bWithSettings), _bValueSpaceIsRaw(false), _bOutputRawFormatIsHex(false), _pSelectionCriteriaDefinition(NULL), _bAutoValidationRequired(true)
-{
-}
-
-// Settings to be loaded or not
-bool CXmlDomainSerializingContext::withSettings() const
-{
- return _bWithSettings;
-}
-
-// Value Space
-void CXmlDomainSerializingContext::setValueSpaceRaw(bool bIsRaw)
-{
- _bValueSpaceIsRaw = bIsRaw;
-}
-
-bool CXmlDomainSerializingContext::valueSpaceIsRaw() const
-{
- return _bValueSpaceIsRaw;
-}
-
-// Output Raw Format for user get value interpretation
-void CXmlDomainSerializingContext::setOutputRawFormat(bool bIsHex)
-{
- _bOutputRawFormatIsHex = bIsHex;
-}
-
-bool CXmlDomainSerializingContext::outputRawFormatIsHex()
-{
- return _bOutputRawFormatIsHex;
-}
-
-// Criteria defintion
-void CXmlDomainSerializingContext::setSelectionCriteriaDefinition(const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition)
-{
- _pSelectionCriteriaDefinition = pSelectionCriteriaDefinition;
-}
-
-const CSelectionCriteriaDefinition* CXmlDomainSerializingContext::getSelectionCriteriaDefinition() const
-{
- return _pSelectionCriteriaDefinition;
-}
-
-// Auto validation of configurations
-void CXmlDomainSerializingContext::setAutoValidationRequired(bool bAutoValidationRequired)
-{
- _bAutoValidationRequired = bAutoValidationRequired;
-}
-
-bool CXmlDomainSerializingContext::autoValidationRequired() const
-{
- return _bAutoValidationRequired;
-}
diff --git a/parameter/XmlDomainSerializingContext.h b/parameter/XmlDomainSerializingContext.h
index 88d2b5f..955d939 100644
--- a/parameter/XmlDomainSerializingContext.h
+++ b/parameter/XmlDomainSerializingContext.h
@@ -33,41 +33,21 @@
#include <string>
-class CParameterBlackboard;
-class CSelectionCriteriaDefinition;
-
class CXmlDomainSerializingContext : public CXmlElementSerializingContext
{
public:
- CXmlDomainSerializingContext(std::string& strError, bool bWithSettings);
+ CXmlDomainSerializingContext(std::string& strError, bool bWithSettings):
+ base(strError), _bWithSettings(bWithSettings) {}
// Settings to be serialized or not
- bool withSettings() const;
-
- // Value interpretation as Real or Raw
- void setValueSpaceRaw(bool bIsRaw);
- bool valueSpaceIsRaw() const;
-
- // Output Raw Format for user get value interpretation
- void setOutputRawFormat(bool bIsHex);
- bool outputRawFormatIsHex();
+ bool withSettings() const
+ {
+ return _bWithSettings;
+ }
- // Criteria defintion
- void setSelectionCriteriaDefinition(const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition);
- const CSelectionCriteriaDefinition* getSelectionCriteriaDefinition() const;
-
- // Auto validation of configurations
- void setAutoValidationRequired(bool bAutoValidationRequired);
- bool autoValidationRequired() const;
private:
+ typedef CXmlElementSerializingContext base;
+
// Indicate wheter or not to import settings
bool _bWithSettings;
- // Value Space
- bool _bValueSpaceIsRaw;
- // Output Raw Format
- bool _bOutputRawFormatIsHex;
- // Criteria defintion
- const CSelectionCriteriaDefinition* _pSelectionCriteriaDefinition;
- // Auto validation of configurations
- bool _bAutoValidationRequired;
};
diff --git a/parameter/include/ParameterMgrFullConnector.h b/parameter/include/ParameterMgrFullConnector.h
new file mode 100644
index 0000000..8ef7bb7
--- /dev/null
+++ b/parameter/include/ParameterMgrFullConnector.h
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2015, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#pragma once
+
+#include "SelectionCriterionTypeInterface.h"
+#include "SelectionCriterionInterface.h"
+#include "ParameterHandle.h"
+#include "ParameterMgrLoggerForward.h"
+
+#include <string>
+#include <list>
+#include <memory>
+#include <stdint.h>
+
+class CParameterMgr;
+
+class CParameterMgrFullConnector
+{
+ friend class CParameterMgrLogger<CParameterMgrFullConnector>;
+
+public:
+ CParameterMgrFullConnector(const std::string& strConfigurationFilePath);
+ ~CParameterMgrFullConnector();
+
+ class ILogger
+ {
+ public:
+ virtual void log(bool bIsWarning, const std::string& strLog) = 0;
+ protected:
+ virtual ~ILogger() {}
+ };
+ // Logging
+ /** Should be called before start */
+ void setLogger(ILogger* pLogger);
+
+
+ bool start(std::string& strError);
+
+ // Dynamic parameter handling
+ CParameterHandle* createParameterHandle(const std::string& strPath, std::string& strError);
+
+ ISelectionCriterionTypeInterface* createSelectionCriterionType(bool bIsInclusive);
+ ISelectionCriterionInterface* createSelectionCriterion(const std::string& strName,
+ const ISelectionCriterionTypeInterface* pSelectionCriterionType);
+ ISelectionCriterionInterface* getSelectionCriterion(const std::string& strName);
+
+ /** Is the remote interface forcefully disabled ?
+ */
+ bool getForceNoRemoteInterface() const;
+
+ /**
+ * Forcefully disable the remote interface or cancel this policy.
+ *
+ * Has no effect if called after calling start().
+ *
+ * @param[in] bForceNoRemoteInterface disable the remote interface if true.
+ */
+ void setForceNoRemoteInterface(bool bForceNoRemoteInterface);
+
+ void applyConfigurations();
+
+ /** Should start fail in case of missing subsystems.
+ *
+ * @param[in] bFail: If set to true, parameterMgr start will fail on missing subsystems.
+ * If set to false, missing subsystems will fallback on virtual subsystem.
+ */
+ void setFailureOnMissingSubsystem(bool bFail);
+
+ /** Would start fail in case of missing subsystems.
+ *
+ * @return true if the subsystem will fail on missing subsystem, false otherwise.
+ */
+ bool getFailureOnMissingSubsystem() const;
+
+ /** Should start fail in failed settings load.
+ *
+ * @param[in] bFail: If set to true, parameterMgr start will fail on failed settings load.
+ * If set to false, failed settings load will be ignored.
+ */
+ void setFailureOnFailedSettingsLoad(bool bFail);
+ /** Would start fail in case of failed settings load.
+ *
+ * @return failure on failed settings load policy state.
+ */
+ bool getFailureOnFailedSettingsLoad();
+
+ /** Get the path to the directory containing the XML Schemas
+ *
+ * @returns the directory containing the XML Schemas
+ */
+ const std::string& getSchemaFolderLocation() const;
+
+ /** Override the directory containing the XML Schemas
+ *
+ * @param[in] strSchemaFolderLocation directory containing the XML Schemas
+ */
+ void setSchemaFolderLocation(const std::string& strSchemaFolderLocation);
+
+ /** Should .xml files be validated on start ?
+ *
+ * @param[in] bValidate:
+ * If set to true, parameterMgr will report an error
+ * when being unable to validate .xml files
+ * If set to false, no .xml/xsd validation will happen
+ * (default behaviour)
+ *
+ * @return false if unable to set, true otherwise.
+ */
+ void setValidateSchemasOnStart(bool bValidate);
+
+ /** Would .xml files be validated on start?
+ *
+ * @return areSchemasValidated
+ */
+ bool getValidateSchemasOnStart() const;
+ //////////// Tuning /////////////
+ // Tuning mode
+ bool setTuningMode(bool bOn, std::string& strError);
+ bool isTuningModeOn() const;
+
+ // Current value space for user set/get value interpretation
+ void setValueSpace(bool bIsRaw);
+ bool isValueSpaceRaw() const;
+
+ // Current Output Raw Format for user get value interpretation
+ void setOutputRawFormat(bool bIsHex);
+ bool isOutputRawFormatHex() const;
+ // Automatic hardware synchronization control (during tuning session)
+ bool setAutoSync(bool bAutoSyncOn, std::string& strError);
+ bool isAutoSyncOn() const;
+ bool sync(std::string& strError);
+
+ // User set/get parameters
+ bool accessParameterValue(const std::string& strPath, std::string& strValue, bool bSet, std::string& strError);
+ bool accessConfigurationValue(const std::string &strDomain, const std::string &strConfiguration, const std::string& strPath, std::string& strValue, bool bSet, std::string& strError);
+
+ /**
+ * Returns the element mapping corresponding to the path given in parameter.
+ *
+ * @param[in] strPath Path of an element
+ * @param[out] strValue A sting containing the mapping
+ *
+ * @return true if a mapping was found for this element
+ */
+ bool getParameterMapping(const std::string& strPath, std::string& strValue) const;
+ ////////// Configuration/Domains handling //////////////
+ // Creation/Deletion
+ bool createDomain(const std::string& strName, std::string& strError);
+ bool deleteDomain(const std::string& strName, std::string& strError);
+ bool renameDomain(const std::string& strName, const std::string& strNewName, std::string& strError);
+ bool deleteAllDomains(std::string& strError);
+ bool setSequenceAwareness(const std::string& strName, bool bSequenceAware, std::string& strResult);
+ bool getSequenceAwareness(const std::string& strName, bool& bSequenceAware, std::string& strResult);
+ bool createConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
+ bool deleteConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
+ bool renameConfiguration(const std::string& strDomain, const std::string& strConfiguration, const std::string& strNewConfiguration, std::string& strError);
+
+ // Save/Restore
+ bool restoreConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::list<std::string>& strError);
+ bool saveConfiguration(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
+
+ // Configurable element - domain association
+ bool addConfigurableElementToDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
+ bool removeConfigurableElementFromDomain(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
+ bool split(const std::string& strDomain, const std::string& strConfigurableElementPath, std::string& strError);
+ bool setElementSequence(const std::string& strDomain, const std::string& strConfiguration, const std::vector<std::string>& astrNewElementSequence, std::string& strError);
+
+ bool setApplicationRule(const std::string& strDomain, const std::string& strConfiguration,
+ const std::string& strApplicationRule, std::string& strError);
+ bool getApplicationRule(const std::string& strDomain, const std::string& strConfiguration,
+ std::string& strResult);
+ bool clearApplicationRule(const std::string& strDomain, const std::string& strConfiguration, std::string& strError);
+
+ /**
+ * Method that imports Configurable Domains from an Xml source.
+ *
+ * @param[in] strXmlSource a string containing an xml description or a path to an xml file
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bFromFile a boolean that determines if the source is an xml description in
+ * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occures
+ */
+ bool importDomainsXml(const std::string& strXmlSource, bool bWithSettings, bool bFromFile,
+ std::string& strError);
+ /**
+ * Method that imports a single Configurable Domain from an Xml source.
+ *
+ * @param[in] strXmlSource a string containing an xml description or a path to an xml file
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bFromFile a boolean that determines if the source is an xml description in
+ * strXmlSource or contained in a file. In that case strXmlSource is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
+ std::string& strError);
+
+
+ /**
+ * Method that exports Configurable Domains to an Xml destination.
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occures, true otherwise.
+ */
+ bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile,
+ std::string& strError) const;
+
+ /**
+ * Method that exports a given Configurable Domain to an Xml destination.
+ *
+ * @param[in,out] strXmlDest a string containing an xml description or a path to an xml file
+ * @param[in] strDomainName the name of the domain to be exported
+ * @param[in] bWithSettings a boolean that determines if the settings should be used in the
+ * xml description
+ * @param[in] bToFile a boolean that determines if the destination is an xml description in
+ * strXmlDest or contained in a file. In that case strXmlDest is just the file path.
+ * @param[out] strError is used as the error output
+ *
+ * @return false if any error occurs, true otherwise.
+ */
+ bool exportSingleDomainXml(std::string& strXmlDest, const std::string& strDomainName, bool bWithSettings,
+ bool bToFile, std::string& strError) const;
+
+ /**
+ * Method that creates an Xml description of the instanciated parameter structure contained
+ * in SystemClass.
+ *
+ * @param[out] strResult contains the xml description of SystemClass or the errors if any
+ *
+ * @return false if any error occures during the creation of the xml description
+ */
+ bool getSystemClassXMLString(std::string& strResult);
+
+private:
+ // disallow copying because this class manages raw pointers' lifecycle
+ CParameterMgrFullConnector(const CParameterMgrFullConnector&);
+ CParameterMgrFullConnector& operator=(const CParameterMgrFullConnector&);
+
+ void doLog(bool bIsWarning, const std::string& strLog);
+
+ CParameterMgr* _pParameterMgr;
+
+ ILogger* _pLogger;
+ // Log wrapper
+ CParameterMgrLogger<CParameterMgrFullConnector>* _pParameterMgrLogger;
+};
diff --git a/parameter/ParameterMgrLogger.cpp b/parameter/include/ParameterMgrLoggerForward.h
index ddd81ef..28b26db 100644
--- a/parameter/ParameterMgrLogger.cpp
+++ b/parameter/include/ParameterMgrLoggerForward.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -27,18 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ParameterMgrLogger.h"
-#include "ParameterMgrPlatformConnector.h"
+#pragma once
-
-using std::string;
-
-CParameterMgrLogger::CParameterMgrLogger(CParameterMgrPlatformConnector *pParameterMgrPlatformConnector) :
- _pParameterMgrPlatformConnector(pParameterMgrPlatformConnector)
-{
-}
-
-void CParameterMgrLogger::log(bool bIsWarning, const string &strLog)
-{
- _pParameterMgrPlatformConnector->doLog(bIsWarning, strLog);
-}
+// Shared forward declaration, to ensure declaration alignment
+template<class T> class CParameterMgrLogger;
diff --git a/parameter/include/ParameterMgrPlatformConnector.h b/parameter/include/ParameterMgrPlatformConnector.h
index d489545..cd99215 100644
--- a/parameter/include/ParameterMgrPlatformConnector.h
+++ b/parameter/include/ParameterMgrPlatformConnector.h
@@ -32,13 +32,13 @@
#include "SelectionCriterionTypeInterface.h"
#include "SelectionCriterionInterface.h"
#include "ParameterHandle.h"
+#include "ParameterMgrLoggerForward.h"
class CParameterMgr;
-class CParameterMgrLogger;
class CParameterMgrPlatformConnector
{
- friend class CParameterMgrLogger;
+ friend class CParameterMgrLogger<CParameterMgrPlatformConnector>;
public:
// Logger interface
class ILogger
@@ -78,6 +78,19 @@ public:
// Must be cassed after successfull start
CParameterHandle* createParameterHandle(const std::string& strPath, std::string& strError) const;
+ /** Is the remote interface forcefully disabled ?
+ */
+ bool getForceNoRemoteInterface() const;
+
+ /**
+ * Forcefully disable the remote interface or cancel this policy.
+ *
+ * Has no effect if called after calling start().
+ *
+ * @param[in] bForceNoRemoteInterface disable the remote interface if true.
+ */
+ void setForceNoRemoteInterface(bool bForceNoRemoteInterface);
+
/** Should start fail in case of missing subsystems.
*
* Will fail if called on started instance.
@@ -114,6 +127,18 @@ public:
*/
bool getFailureOnFailedSettingsLoad();
+ /** Get the path to the directory containing the XML Schemas
+ *
+ * @returns the directory containing the XML Schemas
+ */
+ const std::string& getSchemaFolderLocation() const;
+
+ /** Override the directory containing the XML Schemas
+ *
+ * @param[in] strSchemaFolderLocation directory containing the XML Schemas
+ */
+ void setSchemaFolderLocation(const std::string& strSchemaFolderLocation);
+
/** Should .xml files be validated on start ?
*
* @param[in] bValidate:
@@ -144,5 +169,5 @@ private:
// Logging
ILogger* _pLogger;
// Private logging
- CParameterMgrLogger* _pParameterMgrLogger;
+ CParameterMgrLogger<CParameterMgrPlatformConnector>* _pParameterMgrLogger;
};