summaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2015-07-15 15:37:57 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2015-07-15 17:09:51 -0700
commita9be2d378b7ad84e679a48efa81f42fb54f85d9a (patch)
tree587d34728dac3517a213d6d2a9a6ebdecd4e7531 /parameter
parentc99720d29f2ee618cc74c9336d2cd2a26544c020 (diff)
downloadexternal_parameter-framework-a9be2d378b7ad84e679a48efa81f42fb54f85d9a.zip
external_parameter-framework-a9be2d378b7ad84e679a48efa81f42fb54f85d9a.tar.gz
external_parameter-framework-a9be2d378b7ad84e679a48efa81f42fb54f85d9a.tar.bz2
Drop release v2.6.0+no-stlport
Bug 246391 Change-Id: I662b7b0f90c97cb169978e1b64ad1fe32c440cf5 Signed-off-by: Jean-Michel Trivi <jmtrivi@google.com>
Diffstat (limited to 'parameter')
-rw-r--r--parameter/Android.mk20
-rw-r--r--parameter/ArrayParameter.cpp8
-rw-r--r--parameter/BitParameter.cpp4
-rw-r--r--parameter/BitParameter.h2
-rw-r--r--parameter/BitParameterBlockType.cpp5
-rw-r--r--parameter/BitParameterType.cpp17
-rw-r--r--parameter/BitParameterType.h2
-rw-r--r--parameter/ConfigurableDomain.cpp2
-rw-r--r--parameter/ConfigurableDomains.cpp4
-rw-r--r--parameter/ConfigurableElement.cpp5
-rw-r--r--parameter/Element.cpp80
-rw-r--r--parameter/Element.h38
-rw-r--r--parameter/EnumParameterType.cpp5
-rw-r--r--parameter/EnumValuePair.cpp5
-rw-r--r--parameter/FixedPointParameterType.cpp13
-rw-r--r--parameter/InstanceConfigurableElement.cpp7
-rw-r--r--parameter/InstanceConfigurableElement.h3
-rw-r--r--parameter/IntegerParameterType.cpp17
-rw-r--r--parameter/LinearParameterAdaptation.cpp5
-rw-r--r--parameter/LogarithmicParameterAdaptation.cpp5
-rw-r--r--parameter/ParameterAdaptation.cpp3
-rw-r--r--parameter/ParameterBlockType.cpp4
-rw-r--r--parameter/ParameterMgr.cpp662
-rw-r--r--parameter/ParameterMgr.h320
-rw-r--r--parameter/ParameterMgrFullConnector.cpp11
-rw-r--r--parameter/ParameterType.cpp36
-rw-r--r--parameter/ParameterType.h8
-rw-r--r--parameter/SelectionCriterion.cpp3
-rw-r--r--parameter/StringParameterType.cpp3
-rw-r--r--parameter/Subsystem.cpp8
-rw-r--r--parameter/SubsystemObject.cpp14
-rw-r--r--parameter/SubsystemObject.h8
-rw-r--r--parameter/TypeElement.cpp7
-rw-r--r--parameter/XmlDomainExportContext.h10
-rw-r--r--parameter/XmlFileIncluderElement.cpp25
-rw-r--r--parameter/include/ParameterMgrFullConnector.h23
36 files changed, 799 insertions, 593 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 4ce29f1..2f4b483 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -126,16 +126,13 @@ common_cflags := \
-Werror \
-Wextra \
-Wno-unused-parameter \
- -Wno-maybe-uninitialized \
+ -Wno-maybe-uninitialized
common_c_includes := \
$(LOCAL_PATH)/include/ \
$(LOCAL_PATH)/../utility/ \
- $(LOCAL_PATH)/../xmlserializer/ \
$(LOCAL_PATH)/../remote-processor/
-common_shared_libraries := libicuuc
-
#############################
# Target build
@@ -144,6 +141,8 @@ include $(CLEAR_VARS)
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_CFLAGS := $(common_cflags)
LOCAL_SRC_FILES := $(common_src_files)
@@ -154,12 +153,11 @@ LOCAL_MODULE_TAGS := $(common_module_tags)
LOCAL_C_INCLUDES := $(common_c_includes)
-LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libdl
-LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility libxml2
+LOCAL_SHARED_LIBRARIES := libxmlserializer libdl
+LOCAL_STATIC_LIBRARIES := libpfw_utility
LOCAL_REQUIRED_MODULES := libremote-processor
-LOCAL_CLANG := false
include $(BUILD_SHARED_LIBRARY)
##############################
@@ -170,6 +168,8 @@ include $(CLEAR_VARS)
LOCAL_COPY_HEADERS_TO := $(common_copy_headers_to)
LOCAL_COPY_HEADERS := $(common_copy_headers)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
LOCAL_CFLAGS := $(common_cflags) -O0 -ggdb
LOCAL_SRC_FILES := $(common_src_files)
@@ -181,11 +181,9 @@ LOCAL_MODULE_TAGS := $(common_module_tags)
LOCAL_C_INCLUDES += \
$(common_c_includes)
-LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)-host
-LOCAL_STATIC_LIBRARIES := libxmlserializer_host libpfw_utility_host libxml2
+LOCAL_SHARED_LIBRARIES := libxmlserializer_host
+LOCAL_STATIC_LIBRARIES := libpfw_utility_host libxml2
LOCAL_LDLIBS += -ldl
-LOCAL_CLANG := false
include $(BUILD_HOST_SHARED_LIBRARY)
-
diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp
index 8561410..291b6a1 100644
--- a/parameter/ArrayParameter.cpp
+++ b/parameter/ArrayParameter.cpp
@@ -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,
@@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
+#include "Utility.h"
#include <assert.h>
#define base CParameter
@@ -62,7 +63,7 @@ void CArrayParameter::showProperties(string& strResult) const
// Array length
strResult += "Array length: ";
- strResult += toString(getArrayLength());
+ strResult += CUtility::toString(getArrayLength());
strResult += "\n";
}
@@ -281,7 +282,8 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterAccessContext)) {
// Append parameter path to error
- parameterAccessContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
+ parameterAccessContext.appendToError(" " + getPath() + "/" +
+ CUtility::toString(uiValueIndex + uiStartIndex));
return false;
}
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp
index fb853e4..2a53afd 100644
--- a/parameter/BitParameter.cpp
+++ b/parameter/BitParameter.cpp
@@ -87,7 +87,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon
}
// Rely on integer access
- uint64_t uiValue;
+ uint32_t uiValue;
if (bSet) {
@@ -108,7 +108,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon
}
// Integer Access
-bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
+bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
{
uint32_t uiOffset = getOffset();
diff --git a/parameter/BitParameter.h b/parameter/BitParameter.h
index 436f321..f9e2b9d 100644
--- a/parameter/BitParameter.h
+++ b/parameter/BitParameter.h
@@ -49,7 +49,7 @@ public:
virtual bool accessAsBoolean(bool& bValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
// Integer Access
- virtual bool accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
+ virtual bool accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
// AreaConfiguration creation
virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const;
diff --git a/parameter/BitParameterBlockType.cpp b/parameter/BitParameterBlockType.cpp
index 2016b3b..0d344f2 100644
--- a/parameter/BitParameterBlockType.cpp
+++ b/parameter/BitParameterBlockType.cpp
@@ -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,6 +29,7 @@
*/
#include "BitParameterBlockType.h"
#include "BitParameterBlock.h"
+#include "Utility.h"
#define base CTypeElement
@@ -74,7 +75,7 @@ CInstanceConfigurableElement* CBitParameterBlockType::doInstantiate() const
void CBitParameterBlockType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(_uiSize * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(_uiSize * 8));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp
index 2a400d4..14fe901 100644
--- a/parameter/BitParameterType.cpp
+++ b/parameter/BitParameterType.cpp
@@ -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,
@@ -33,6 +33,7 @@
#include <sstream>
#include "ParameterAccessContext.h"
#include "BitParameterBlockType.h"
+#include "Utility.h"
#define base CTypeElement
@@ -55,17 +56,17 @@ void CBitParameterType::showProperties(string& strResult) const
// Bit Pos
strResult += "Bit pos: ";
- strResult += toString(_uiBitPos);
+ strResult += CUtility::toString(_uiBitPos);
strResult += "\n";
// Bit size
strResult += "Bit size: ";
- strResult += toString(_uiBitSize);
+ strResult += CUtility::toString(_uiBitSize);
strResult += "\n";
// Max
strResult += "Max: ";
- strResult += toString(_uiMax);
+ strResult += CUtility::toString(_uiMax);
strResult += "\n";
}
@@ -191,7 +192,7 @@ bool CBitParameterType::toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CP
return true;
}
-void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
+void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const
{
(void)parameterAccessContext;
@@ -245,13 +246,13 @@ bool CBitParameterType::isEncodable(uint64_t uiData) const
void CBitParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Position
- xmlElement.setAttributeString("Pos", toString(_uiBitPos));
+ xmlElement.setAttributeString("Pos", CUtility::toString(_uiBitPos));
// Size
- xmlElement.setAttributeString("Size", toString(_uiBitSize));
+ xmlElement.setAttributeString("Size", CUtility::toString(_uiBitSize));
// Maximum
- xmlElement.setAttributeString("Max", toString(_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));
base::toXml(xmlElement, serializingContext);
diff --git a/parameter/BitParameterType.h b/parameter/BitParameterType.h
index 8f147e6..4c91a1a 100644
--- a/parameter/BitParameterType.h
+++ b/parameter/BitParameterType.h
@@ -53,7 +53,7 @@ public:
void fromBlackboard(std::string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
// Integer
bool toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const;
- void fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
+ void fromBlackboard(uint32_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const;
// Access from area configuration
uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const;
diff --git a/parameter/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index aa9da51..346b1f9 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -847,7 +847,7 @@ void CConfigurableDomain::validate(const CParameterBlackboard* pMainBlackboard)
// Ensure validity on areas related to configurable element
void CConfigurableDomain::validateAreas(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard)
{
- log_info("Validating domain \"" + getName() + "\" against main blackboard for configurable element \"" + pConfigurableElement->getPath() + "\"");
+ log_info("Validating domain \"%s\" against main blackboard for configurable element \"%s\"", getName().c_str(), pConfigurableElement->getPath().c_str());
// Propagate
size_t uiNbConfigurations = getNbChildren();
diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index 844ade7..bfa9271 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -145,7 +145,7 @@ bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrit
deleteDomain(*pExistingDomain);
}
- log_info("Adding configurable domain \"" + strDomainName + "\"");
+ log_info("Adding configurable domain \"%s\"", strDomainName.c_str());
addChild(&domain);
@@ -154,7 +154,7 @@ bool CConfigurableDomains::addDomain(CConfigurableDomain& domain, bool bOverwrit
void CConfigurableDomains::deleteDomain(CConfigurableDomain& configurableDomain)
{
- log_info("Deleting configurable domain \"" + configurableDomain.getName() + "\"");
+ log_info("Deleting configurable domain \"%s\"", configurableDomain.getName().c_str() );
removeChild(&configurableDomain);
diff --git a/parameter/ConfigurableElement.cpp b/parameter/ConfigurableElement.cpp
index 754f207..08a0122 100644
--- a/parameter/ConfigurableElement.cpp
+++ b/parameter/ConfigurableElement.cpp
@@ -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,
@@ -34,6 +34,7 @@
#include "ConfigurationAccessContext.h"
#include "ConfigurableElementAggregator.h"
#include "AreaConfiguration.h"
+#include "Utility.h"
#include <assert.h>
#define base CElement
@@ -360,7 +361,7 @@ bool CConfigurableElement::isRogue() const
std::string CConfigurableElement::getFootprintAsString() const
{
// Get size as string
- return toString(getFootPrint()) + " byte(s)";
+ return CUtility::toString(getFootPrint()) + " byte(s)";
}
// Matching check for no domain association
diff --git a/parameter/Element.cpp b/parameter/Element.cpp
index cacf49b..afd1f33 100644
--- a/parameter/Element.cpp
+++ b/parameter/Element.cpp
@@ -35,10 +35,11 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <sstream>
using std::string;
+const std::string CElement::gDescriptionPropertyName = "Description";
+
CElement::CElement(const string& strName) : _strName(strName), _pParent(NULL)
{
}
@@ -49,14 +50,14 @@ CElement::~CElement()
}
// Logging
-void CElement::log_info(const string& strMessage, ...) const
+void CElement::log_info(const char* strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage, listPointer);
va_end(listPointer);
@@ -67,14 +68,14 @@ void CElement::log_info(const string& strMessage, ...) const
free(pacBuffer);
}
-void CElement::log_warning(const string& strMessage, ...) const
+void CElement::log_warning(const char* strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage, listPointer);
va_end(listPointer);
@@ -200,43 +201,14 @@ void CElement::showProperties(string& strResult) const
{
strResult = "\n";
strResult += "Kind: " + getKind() + "\n";
+ showDescriptionProperty(strResult);
}
-// Conversion utilities
-string CElement::toString(uint32_t uiValue)
+void CElement::showDescriptionProperty(std::string &strResult) const
{
- std::ostringstream ostr;
-
- ostr << uiValue;
-
- return ostr.str();
-}
-
-string CElement::toString(uint64_t uiValue)
-{
- std::ostringstream ostr;
-
- ostr << uiValue;
-
- return ostr.str();
-}
-
-string CElement::toString(int32_t iValue)
-{
- std::ostringstream ostr;
-
- ostr << iValue;
-
- return ostr.str();
-}
-
-string CElement::toString(double dValue)
-{
- std::ostringstream ostr;
-
- ostr << dValue;
-
- return ostr.str();
+ if (!getDescription().empty()) {
+ strResult += gDescriptionPropertyName + ": " + getDescription() + "\n";
+ }
}
// Content dumping
@@ -249,6 +221,8 @@ void CElement::logValue(string& strValue, CErrorContext& errorContext) const
// From IXmlSink
bool CElement::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
+ setDescription(getXmlDescriptionAttribute(xmlElement));
+
// Propagate through children
CXmlElement::CChildIterator childIterator(xmlElement);
@@ -316,9 +290,23 @@ void CElement::childrenToXml(CXmlElement& xmlElement,
void CElement::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
setXmlNameAttribute(xmlElement);
+ setXmlDescriptionAttribute(xmlElement);
childrenToXml(xmlElement, serializingContext);
}
+void CElement::setXmlDescriptionAttribute(CXmlElement& xmlElement) const
+{
+ const string &description = getDescription();
+ if (!description.empty()) {
+ xmlElement.setAttributeString(gDescriptionPropertyName, description);
+ }
+}
+
+string CElement::getXmlDescriptionAttribute(const CXmlElement& xmlElement) const
+{
+ return xmlElement.getAttributeString(gDescriptionPropertyName);
+}
+
void CElement::setXmlNameAttribute(CXmlElement& xmlElement) const
{
// By default, set Name attribute if any
@@ -712,17 +700,3 @@ uint8_t CElement::computeStructureChecksum() const
return uiChecksum;
}
-
-// Utility to underline
-void CElement::appendTitle(string& strTo, const string& strTitle)
-{
- strTo += "\n" + strTitle + "\n";
-
- string::size_type uiLength = strTitle.size();
-
- while (uiLength--) {
-
- strTo += "=";
- }
- strTo += "\n";
-}
diff --git a/parameter/Element.h b/parameter/Element.h
index 8423e32..d3844e6 100644
--- a/parameter/Element.h
+++ b/parameter/Element.h
@@ -49,8 +49,8 @@ public:
virtual ~CElement();
// Logging
- void log_info(const std::string& strMessage, ...) const;
- void log_warning(const std::string& strMessage, ...) const;
+ void log_info(const char* strMessage, ...) const;
+ void log_warning(const char* strMessage, ...) const;
void log_table(bool bIsWarning, const std::list<std::string> lstrMessage) const;
// Description
@@ -133,22 +133,38 @@ public:
// Element properties
virtual void showProperties(std::string& strResult) const;
- // Conversion utilities
- static std::string toString(uint32_t uiValue);
- static std::string toString(uint64_t uiValue);
- static std::string toString(int32_t iValue);
- static std::string toString(double dValue);
-
// Checksum for integrity checks
uint8_t computeStructureChecksum() const;
// Class kind
virtual std::string getKind() const = 0;
+
+ /**
+ * Fill the Description field of the Xml Element during XML composing.
+ *
+ * @param[in,out] xmlElement to fill with the description
+ */
+ void setXmlDescriptionAttribute(CXmlElement& xmlElement) const;
+
+ /**
+ * Extract the Description field from the Xml Element during XML decomposing.
+ *
+ * @param[in] xmlElement to extract the description from.
+ *
+ * @return description represented as a string, empty if not found
+ */
+ std::string getXmlDescriptionAttribute(const CXmlElement &xmlElement) const;
+
+ /**
+ * Appends if found human readable description property.
+ *
+ * @param[out] strResult in which the description is wished to be appended.
+ */
+ void showDescriptionProperty(std::string &strResult) const;
+
protected:
// Content dumping
virtual void logValue(std::string& strValue, CErrorContext& errorContext) const;
- // Utility to underline
- static void appendTitle(std::string& strTo, const std::string& strTitle);
// Hierarchy
CElement* getParent();
@@ -193,4 +209,6 @@ private:
std::vector<CElement*> _childArray;
// Parent
CElement* _pParent;
+
+ static const std::string gDescriptionPropertyName;
};
diff --git a/parameter/EnumParameterType.cpp b/parameter/EnumParameterType.cpp
index 8cca7d7..147ee95 100644
--- a/parameter/EnumParameterType.cpp
+++ b/parameter/EnumParameterType.cpp
@@ -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,
@@ -35,6 +35,7 @@
#include <assert.h>
#include "ParameterAccessContext.h"
#include "EnumValuePair.h"
+#include "Utility.h"
#include <errno.h>
#define base CParameterType
@@ -344,7 +345,7 @@ bool CEnumParameterType::isValid(int iNumerical, CParameterAccessContext& parame
void CEnumParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/EnumValuePair.cpp b/parameter/EnumValuePair.cpp
index 81febdd..35f4cd2 100644
--- a/parameter/EnumValuePair.cpp
+++ b/parameter/EnumValuePair.cpp
@@ -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,
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "EnumValuePair.h"
+#include "Utility.h"
#define base CElement
@@ -51,7 +52,7 @@ int32_t CEnumValuePair::getNumerical() const
string CEnumValuePair::getNumericalAsString() const
{
- return toString(_iNumerical);
+ return CUtility::toString(_iNumerical);
}
// From IXmlSink
diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp
index e7779a9..5189a07 100644
--- a/parameter/FixedPointParameterType.cpp
+++ b/parameter/FixedPointParameterType.cpp
@@ -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,
@@ -36,6 +36,7 @@
#include "Parameter.h"
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
+#include "Utility.h"
#include <errno.h>
#include <convert.hpp>
@@ -59,9 +60,9 @@ void CFixedPointParameterType::showProperties(string& strResult) const
// Notation
strResult += "Notation: Q";
- strResult += toString(_uiIntegral);
+ strResult += CUtility::toString(_uiIntegral);
strResult += ".";
- strResult += toString(_uiFractional);
+ strResult += CUtility::toString(_uiFractional);
strResult += "\n";
}
@@ -363,13 +364,13 @@ double CFixedPointParameterType::binaryQnmToDouble(int32_t iValue) const
void CFixedPointParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
// Integral
- xmlElement.setAttributeString("Integral", toString(_uiIntegral));
+ xmlElement.setAttributeString("Integral", CUtility::toString(_uiIntegral));
// Fractional
- xmlElement.setAttributeString("Fractional", toString(_uiFractional));
+ xmlElement.setAttributeString("Fractional", CUtility::toString(_uiFractional));
base::toXml(xmlElement, serializingContext);
}
diff --git a/parameter/InstanceConfigurableElement.cpp b/parameter/InstanceConfigurableElement.cpp
index 89e9266..b59cffd 100644
--- a/parameter/InstanceConfigurableElement.cpp
+++ b/parameter/InstanceConfigurableElement.cpp
@@ -216,3 +216,10 @@ bool CInstanceConfigurableElement::checkPathExhausted(CPathNavigator& pathNaviga
}
return true;
}
+
+void CInstanceConfigurableElement::toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const
+{
+ base::toXml(xmlElement, serializingContext);
+ // Since Description belongs to the Type of Element, delegate it to the type element.
+ getTypeElement()->setXmlDescriptionAttribute(xmlElement);
+}
diff --git a/parameter/InstanceConfigurableElement.h b/parameter/InstanceConfigurableElement.h
index b3cdf62..eea3df6 100644
--- a/parameter/InstanceConfigurableElement.h
+++ b/parameter/InstanceConfigurableElement.h
@@ -102,6 +102,9 @@ public:
*/
virtual void getListOfElementsWithMapping(std::list<const CConfigurableElement*>&
configurableElementPath) const;
+
+ virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const;
+
protected:
// Syncer
virtual ISyncer* getSyncer() const;
diff --git a/parameter/IntegerParameterType.cpp b/parameter/IntegerParameterType.cpp
index edc3d46..2d48d53 100644
--- a/parameter/IntegerParameterType.cpp
+++ b/parameter/IntegerParameterType.cpp
@@ -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,
@@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include <assert.h>
#include "ParameterAdaptation.h"
+#include "Utility.h"
#include <errno.h>
#define base CParameterType
@@ -69,12 +70,12 @@ void CIntegerParameterType::showProperties(string& strResult) const
// Min
strResult += "Min: ";
- strResult += _bSigned ? toString((int32_t)_uiMin) : toString(_uiMin);
+ strResult += _bSigned ? CUtility::toString((int32_t)_uiMin) : CUtility::toString(_uiMin);
strResult += "\n";
// Max
strResult += "Max: ";
- strResult += _bSigned ? toString((int32_t)_uiMax) : toString(_uiMax);
+ strResult += _bSigned ? CUtility::toString((int32_t)_uiMax) : CUtility::toString(_uiMax);
strResult += "\n";
// Check if there's an adaptation object available
@@ -439,22 +440,22 @@ void CIntegerParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContex
if (_bSigned) {
// Mininmum
- xmlElement.setAttributeString("Min", toString((int32_t)_uiMin));
+ xmlElement.setAttributeString("Min", CUtility::toString((int32_t)_uiMin));
// Maximum
- xmlElement.setAttributeString("Max", toString((int32_t)_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString((int32_t)_uiMax));
} else {
// Minimum
- xmlElement.setAttributeString("Min", toString(_uiMin));
+ xmlElement.setAttributeString("Min", CUtility::toString(_uiMin));
// Maximum
- xmlElement.setAttributeString("Max", toString(_uiMax));
+ xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));
}
// Size
- xmlElement.setAttributeString("Size", toString(getSize() * 8));
+ xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));
base::toXml(xmlElement, serializingContext);
diff --git a/parameter/LinearParameterAdaptation.cpp b/parameter/LinearParameterAdaptation.cpp
index ea833b3..ae925a7 100644
--- a/parameter/LinearParameterAdaptation.cpp
+++ b/parameter/LinearParameterAdaptation.cpp
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "LinearParameterAdaptation.h"
+#include "Utility.h"
#define base CParameterAdaptation
@@ -49,12 +50,12 @@ void CLinearParameterAdaptation::showProperties(string& strResult) const
// SlopeNumerator
strResult += " - SlopeNumerator: ";
- strResult += toString(_dSlopeNumerator);
+ strResult += CUtility::toString(_dSlopeNumerator);
strResult += "\n";
// SlopeDenominator
strResult += " - SlopeDenominator: ";
- strResult += toString(_dSlopeDenominator);
+ strResult += CUtility::toString(_dSlopeDenominator);
strResult += "\n";
}
diff --git a/parameter/LogarithmicParameterAdaptation.cpp b/parameter/LogarithmicParameterAdaptation.cpp
index 688527d..bca4948 100644
--- a/parameter/LogarithmicParameterAdaptation.cpp
+++ b/parameter/LogarithmicParameterAdaptation.cpp
@@ -29,6 +29,7 @@
*/
#include "LogarithmicParameterAdaptation.h"
+#include "Utility.h"
#include <math.h>
#define base CLinearParameterAdaptation
@@ -45,10 +46,10 @@ void CLogarithmicParameterAdaptation::showProperties(std::string& strResult) con
base::showProperties(strResult);
strResult += " - LogarithmBase: ";
- strResult += toString(_dLogarithmBase);
+ strResult += CUtility::toString(_dLogarithmBase);
strResult += "\n";
strResult += " - FloorValue: ";
- strResult += toString(_dFloorValue);
+ strResult += CUtility::toString(_dFloorValue);
strResult += "\n";
}
diff --git a/parameter/ParameterAdaptation.cpp b/parameter/ParameterAdaptation.cpp
index f1e73c1..99955f1 100644
--- a/parameter/ParameterAdaptation.cpp
+++ b/parameter/ParameterAdaptation.cpp
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ParameterAdaptation.h"
+#include "Utility.h"
#define base CElement
@@ -58,7 +59,7 @@ void CParameterAdaptation::showProperties(string& strResult) const
// Offset
strResult += " - Offset: ";
- strResult += toString(_iOffset);
+ strResult += CUtility::toString(_iOffset);
strResult += "\n";
}
diff --git a/parameter/ParameterBlockType.cpp b/parameter/ParameterBlockType.cpp
index aafa7ca..ad94888 100644
--- a/parameter/ParameterBlockType.cpp
+++ b/parameter/ParameterBlockType.cpp
@@ -29,6 +29,7 @@
*/
#include "ParameterBlockType.h"
#include "ParameterBlock.h"
+#include "Utility.h"
#define base CTypeElement
@@ -62,7 +63,8 @@ void CParameterBlockType::populate(CElement* pElement) const
for (uiChild = 0; uiChild < uiArrayLength; uiChild++) {
- CParameterBlock* pChildParameterBlock = new CParameterBlock(toString(uiChild), this);
+ CParameterBlock* pChildParameterBlock = new CParameterBlock(CUtility::toString(uiChild),
+ this);
pElement->addChild(pChildParameterBlock);
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index 45f1ac2..b42c7de 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -82,15 +82,14 @@
#include "LogarithmicParameterAdaptation.h"
#include "EnumValuePair.h"
#include "Subsystem.h"
-#include "XmlFileDocSink.h"
-#include "XmlFileDocSource.h"
-#include "XmlStringDocSink.h"
-#include "XmlStringDocSource.h"
+#include "XmlStreamDocSink.h"
#include "XmlMemoryDocSink.h"
+#include "XmlDocSource.h"
#include "XmlMemoryDocSource.h"
#include "SelectionCriteriaDefinition.h"
#include "Utility.h"
#include <sstream>
+#include <fstream>
#include <algorithm>
#include <ctype.h>
#include <memory>
@@ -110,6 +109,8 @@ using std::string;
using std::list;
using std::vector;
using std::ostringstream;
+using std::ofstream;
+using std::ifstream;
// Used for remote processor server creation
typedef IRemoteProcessorServerInterface* (*CreateRemoteProcessorServer)(uint16_t uiPort, IRemoteCommandHandler* pCommandHandler);
@@ -146,157 +147,173 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gastRemoteCommandPa
"Show current status" },
/// Tuning Mode
- { "setTuningMode", &CParameterMgr::setTuningModeCommmandProcess, 1,
+ { "setTuningMode", &CParameterMgr::setTuningModeCommandProcess, 1,
"on|off*", "Turn on or off Tuning Mode" },
- { "getTuningMode", &CParameterMgr::getTuningModeCommmandProcess, 0,
+ { "getTuningMode", &CParameterMgr::getTuningModeCommandProcess, 0,
"", "Show Tuning Mode" },
/// Value Space
- { "setValueSpace", &CParameterMgr::setValueSpaceCommmandProcess, 1,
+ { "setValueSpace", &CParameterMgr::setValueSpaceCommandProcess, 1,
"raw|real*", "Assigns Value Space used for parameter value interpretation" },
- { "getValueSpace", &CParameterMgr::getValueSpaceCommmandProcess, 0,
+ { "getValueSpace", &CParameterMgr::getValueSpaceCommandProcess, 0,
"", "Show Value Space" },
/// Output Raw Format
- { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommmandProcess, 1,
+ { "setOutputRawFormat", &CParameterMgr::setOutputRawFormatCommandProcess, 1,
"dec*|hex", "Assigns format used to output parameter values when in raw Value Space" },
- { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommmandProcess, 0,
+ { "getOutputRawFormat", &CParameterMgr::getOutputRawFormatCommandProcess, 0,
"", "Show Output Raw Format" },
/// Sync
- { "setAutoSync", &CParameterMgr::setAutoSyncCommmandProcess, 1,
+ { "setAutoSync", &CParameterMgr::setAutoSyncCommandProcess, 1,
"on*|off", "Turn on or off automatic synchronization to hardware while in Tuning Mode" },
- { "getAutoSync", &CParameterMgr::getAutoSyncCommmandProcess, 0,
+ { "getAutoSync", &CParameterMgr::getAutoSyncCommandProcess, 0,
"", "Show Auto Sync state" },
- { "sync", &CParameterMgr::syncCommmandProcess, 0,
+ { "sync", &CParameterMgr::syncCommandProcess, 0,
"", "Synchronize current settings to hardware while in Tuning Mode and Auto Sync off" },
/// Criteria
- { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0,
+ { "listCriteria", &CParameterMgr::listCriteriaCommandProcess, 0,
"[CSV|XML]", "List selection criteria" },
/// Domains
- { "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0,
+ { "listDomains", &CParameterMgr::listDomainsCommandProcess, 0,
"", "List configurable domains" },
- { "dumpDomains", &CParameterMgr::dumpDomainsCommmandProcess, 0,
+ { "dumpDomains", &CParameterMgr::dumpDomainsCommandProcess, 0,
"", "Show all domains and configurations, including applicability conditions" },
- { "createDomain", &CParameterMgr::createDomainCommmandProcess, 1,
+ { "createDomain", &CParameterMgr::createDomainCommandProcess, 1,
"<domain>", "Create new configurable domain" },
- { "deleteDomain", &CParameterMgr::deleteDomainCommmandProcess, 1,
+ { "deleteDomain", &CParameterMgr::deleteDomainCommandProcess, 1,
"<domain>", "Delete configurable domain" },
- { "deleteAllDomains", &CParameterMgr::deleteAllDomainsCommmandProcess, 0,
+ { "deleteAllDomains", &CParameterMgr::deleteAllDomainsCommandProcess, 0,
"", "Delete all configurable domains" },
- { "renameDomain", &CParameterMgr::renameDomainCommmandProcess, 2,
+ { "renameDomain", &CParameterMgr::renameDomainCommandProcess, 2,
"<domain> <new name>", "Rename configurable domain" },
- { "setSequenceAwareness", &CParameterMgr::setSequenceAwarenessCommmandProcess, 1,
+ { "setSequenceAwareness", &CParameterMgr::setSequenceAwarenessCommandProcess, 1,
"<domain> true|false*", "Set configurable domain sequence awareness" },
- { "getSequenceAwareness", &CParameterMgr::getSequenceAwarenessCommmandProcess, 1,
+ { "getSequenceAwareness", &CParameterMgr::getSequenceAwarenessCommandProcess, 1,
"<domain>", "Get configurable domain sequence awareness" },
- { "listDomainElements", &CParameterMgr::listDomainElementsCommmandProcess, 1,
+ { "listDomainElements", &CParameterMgr::listDomainElementsCommandProcess, 1,
"<domain>", "List elements associated to configurable domain" },
- { "addElement", &CParameterMgr::addElementCommmandProcess, 2,
+ { "addElement", &CParameterMgr::addElementCommandProcess, 2,
"<domain> <elem path>", "Associate element at given path to configurable domain" },
- { "removeElement", &CParameterMgr::removeElementCommmandProcess, 2,
+ { "removeElement", &CParameterMgr::removeElementCommandProcess, 2,
"<domain> <elem path>", "Dissociate element at given path from configurable domain" },
- { "splitDomain", &CParameterMgr::splitDomainCommmandProcess, 2,
+ { "splitDomain", &CParameterMgr::splitDomainCommandProcess, 2,
"<domain> <elem path>", "Split configurable domain at given associated element path" },
/// Configurations
- { "listConfigurations", &CParameterMgr::listConfigurationsCommmandProcess, 1,
+ { "listConfigurations", &CParameterMgr::listConfigurationsCommandProcess, 1,
"<domain>", "List domain configurations" },
- { "createConfiguration", &CParameterMgr::createConfigurationCommmandProcess, 2,
+ { "createConfiguration", &CParameterMgr::createConfigurationCommandProcess, 2,
"<domain> <configuration>", "Create new domain configuration" },
- { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommmandProcess, 2,
+ { "deleteConfiguration", &CParameterMgr::deleteConfigurationCommandProcess, 2,
"<domain> <configuration>", "Delete domain configuration" },
- { "renameConfiguration", &CParameterMgr::renameConfigurationCommmandProcess, 3,
+ { "renameConfiguration", &CParameterMgr::renameConfigurationCommandProcess, 3,
"<domain> <configuration> <new name>", "Rename domain configuration" },
- { "saveConfiguration", &CParameterMgr::saveConfigurationCommmandProcess, 2,
+ { "saveConfiguration", &CParameterMgr::saveConfigurationCommandProcess, 2,
"<domain> <configuration>", "Save current settings into configuration" },
- { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommmandProcess, 2,
+ { "restoreConfiguration", &CParameterMgr::restoreConfigurationCommandProcess, 2,
"<domain> <configuration>", "Restore current settings from configuration" },
- { "setElementSequence", &CParameterMgr::setElementSequenceCommmandProcess, 3,
+ { "setElementSequence", &CParameterMgr::setElementSequenceCommandProcess, 3,
"<domain> <configuration> <elem path list>",
"Set element application order for configuration" },
- { "getElementSequence", &CParameterMgr::getElementSequenceCommmandProcess, 2,
+ { "getElementSequence", &CParameterMgr::getElementSequenceCommandProcess, 2,
"<domain> <configuration>", "Get element application order for configuration" },
- { "setRule", &CParameterMgr::setRuleCommmandProcess, 3,
+ { "setRule", &CParameterMgr::setRuleCommandProcess, 3,
"<domain> <configuration> <rule>", "Set configuration application rule" },
- { "clearRule", &CParameterMgr::clearRuleCommmandProcess, 2,
+ { "clearRule", &CParameterMgr::clearRuleCommandProcess, 2,
"<domain> <configuration>", "Clear configuration application rule" },
- { "getRule", &CParameterMgr::getRuleCommmandProcess, 2,
+ { "getRule", &CParameterMgr::getRuleCommandProcess, 2,
"<domain> <configuration>", "Get configuration application rule" },
/// Elements/Parameters
- { "listElements", &CParameterMgr::listElementsCommmandProcess, 1,
+ { "listElements", &CParameterMgr::listElementsCommandProcess, 1,
"<elem path>|/", "List elements under element at given path or root" },
- { "listParameters", &CParameterMgr::listParametersCommmandProcess, 1,
+ { "listParameters", &CParameterMgr::listParametersCommandProcess, 1,
"<elem path>|/", "List parameters under element at given path or root" },
- { "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1,
+ { "dumpElement", &CParameterMgr::dumpElementCommandProcess, 1,
"<elem path>", "Dump structure and content of element at given path" },
- { "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1,
+ { "getElementSize", &CParameterMgr::getElementSizeCommandProcess, 1,
"<elem path>", "Show size of element at given path" },
- { "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1,
+ { "showProperties", &CParameterMgr::showPropertiesCommandProcess, 1,
"<elem path>", "Show properties of element at given path" },
- { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1,
+ { "getParameter", &CParameterMgr::getParameterCommandProcess, 1,
"<param path>", "Get value for parameter at given path" },
- { "setParameter", &CParameterMgr::setParameterCommmandProcess, 2,
+ { "setParameter", &CParameterMgr::setParameterCommandProcess, 2,
"<param path> <value>", "Set value for parameter at given path" },
- { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1,
+ { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommandProcess, 1,
"<elem path>", "List domain(s) element at given path belongs to" },
- { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1,
+ { "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommandProcess, 1,
"<elem path>", "List domain(s) element at given path is associated to" },
- { "getConfigurationParameter", &CParameterMgr::getConfigurationParameterCommmandProcess, 3,
+ { "getConfigurationParameter", &CParameterMgr::getConfigurationParameterCommandProcess, 3,
"<domain> <configuration> <param path>",
"Get value for parameter at given path from configuration" },
- { "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommmandProcess, 4,
+ { "setConfigurationParameter", &CParameterMgr::setConfigurationParameterCommandProcess, 4,
"<domain> <configuration> <param path> <value>",
"Set value for parameter at given path to configuration" },
- { "showMapping", &CParameterMgr::showMappingCommmandProcess, 1,
+ { "showMapping", &CParameterMgr::showMappingCommandProcess, 1,
"<elem path>", "Show mapping for an element at given path" },
/// Browse
- { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0,
+ { "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommandProcess, 0,
"", "List element sub-trees associated to at least one configurable domain" },
- { "listConflictingElements", &CParameterMgr::listConflictingElementsCommmandProcess, 0,
+ { "listConflictingElements", &CParameterMgr::listConflictingElementsCommandProcess, 0,
"", "List element sub-trees contained in more than one configurable domain" },
- { "listRogueElements", &CParameterMgr::listRogueElementsCommmandProcess, 0,
+ { "listRogueElements", &CParameterMgr::listRogueElementsCommandProcess, 0,
"", "List element sub-trees owned by no configurable domain" },
/// Settings Import/Export
- { "exportDomainsXML", &CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess, 1,
- "<file path> ", "Export domains to XML file" },
- { "importDomainsXML", &CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess, 1,
- "<file path>", "Import domains from XML file" },
+ { "exportDomainsXML", &CParameterMgr::exportDomainsXMLCommandProcess, 1,
+ "<file path> ", "Export domains to an XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "importDomainsXML", &CParameterMgr::importDomainsXMLCommandProcess, 1,
+ "<file path>", "Import domains from an XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "exportDomainsWithSettingsXML",
- &CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess, 1,
- "<file path> ", "Export domains including settings to XML file" },
+ &CParameterMgr::exportDomainsWithSettingsXMLCommandProcess, 1,
+ "<file path> ", "Export domains including settings to XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "exportDomainWithSettingsXML",
+ &CParameterMgr::exportDomainWithSettingsXMLCommandProcess, 2,
+ "<domain> <file path> ", "Export a single given domain including settings to XML file"
+ " (provide an absolute path or relative to the client's"
+ " working directory)" },
{ "importDomainsWithSettingsXML",
- &CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess, 1,
- "<file path>", "Import domains including settings from XML file" },
+ &CParameterMgr::importDomainsWithSettingsXMLCommandProcess, 1,
+ "<file path>", "Import domains including settings from XML file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "importDomainWithSettingsXML",
- &CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess, 1,
+ &CParameterMgr::importDomainWithSettingsXMLCommandProcess, 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,
- "<file path>", "Import settings from binary file" },
+ " argument. Provide an absolute path or relative to the client's working directory)" },
+ { "exportSettings", &CParameterMgr::exportSettingsCommandProcess, 1,
+ "<file path>", "Export settings to binary file (provide an absolute path or relative"
+ "to the client's working directory)" },
+ { "importSettings", &CParameterMgr::importSettingsCommandProcess, 1,
+ "<file path>", "Import settings from binary file (provide an absolute path or relative"
+ "to the client's working directory)" },
{ "getDomainsWithSettingsXML",
- &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
+ &CParameterMgr::getDomainsWithSettingsXMLCommandProcess, 0,
"", "Print domains including settings as XML" },
{ "getDomainWithSettingsXML",
- &CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess, 1,
+ &CParameterMgr::getDomainWithSettingsXMLCommandProcess, 1,
"<domain>", "Print the given domain including settings as XML" },
{ "setDomainsWithSettingsXML",
- &CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess, 1,
+ &CParameterMgr::setDomainsWithSettingsXMLCommandProcess, 1,
"<xml configurable domains>", "Import domains including settings from XML string" },
+ { "setDomainWithSettingsXML",
+ &CParameterMgr::setDomainWithSettingsXMLCommandProcess, 1,
+ "<xml configurable domain> [overwrite]", "Import domains including settings from XML"
+ " string. Does not overwrite an existing domain unless 'overwrite' is passed as second"
+ " argument" },
/// Structure Export
- { "getSystemClassXML", &CParameterMgr::getSystemClassXMLCommmandProcess, 0 ,
+ { "getSystemClassXML", &CParameterMgr::getSystemClassXMLCommandProcess, 0 ,
"", "Print parameter structure as XML" },
/// Deprecated Commands
{ "getDomainsXML",
- &CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess, 0,
+ &CParameterMgr::getDomainsWithSettingsXMLCommandProcess, 0,
"", "DEPRECATED COMMAND, please use getDomainsWithSettingsXML" },
};
@@ -430,11 +447,11 @@ string CParameterMgr::getVersion() const
string strVersion;
// Major
- strVersion = toString(guiEditionMajor) + ".";
+ strVersion = CUtility::toString(guiEditionMajor) + ".";
// Minor
- strVersion += toString(guiEditionMinor) + ".";
+ strVersion += CUtility::toString(guiEditionMinor) + ".";
// Revision
- strVersion += toString(guiRevision);
+ strVersion += CUtility::toString(guiRevision);
return strVersion;
}
@@ -519,7 +536,13 @@ bool CParameterMgr::loadFrameworkConfiguration(string& strError)
// Parse Structure XML file
CXmlElementSerializingContext elementSerializingContext(strError);
- if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), _strXmlConfigurationFilePath, _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(_strXmlConfigurationFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(elementSerializingContext, getFrameworkConfiguration(), doc,
+ _strXmlConfigurationFolderPath, EFrameworkConfigurationLibrary)) {
return false;
}
@@ -548,7 +571,7 @@ bool CParameterMgr::loadStructure(string& strError)
// Retrieve system to load structure to
CSystemClass* pSystemClass = getSystemClass();
- log_info("Loading " + pSystemClass->getName() + " system class structure");
+ log_info("Loading %s system class structure", pSystemClass->getName().c_str());
// Get structure description element
const CFrameworkConfigurationLocation* pStructureDescriptionFileLocation = static_cast<const CFrameworkConfigurationLocation*>(getConstFrameworkConfiguration()->findChildOfKind("StructureDescriptionFileLocation"));
@@ -571,7 +594,12 @@ bool CParameterMgr::loadStructure(string& strError)
CAutoLog autolog(pSystemClass, "Importing system structure from file " + strXmlStructureFilePath);
- if (!xmlParse(parameterBuildContext, pSystemClass, strXmlStructureFilePath, strXmlStructureFolder, EParameterCreationLibrary)) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strXmlStructureFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(parameterBuildContext, pSystemClass, doc, strXmlStructureFolder, EParameterCreationLibrary)) {
return false;
}
@@ -592,7 +620,7 @@ bool CParameterMgr::loadSettings(string& strError)
if (!success && !_bFailOnFailedSettingsLoad) {
// Load can not fail, ie continue but log the load errors
- log_info(strLoadError);
+ log_info("%s", strLoadError.c_str());
log_info("Failed to load settings, continue without domains.");
success = true;
}
@@ -660,8 +688,12 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError)
log_info("Importing configurable domains from file %s %s settings", strXmlConfigurationDomainsFilePath.c_str(), pBinarySettingsFileLocation ? "without" : "with");
- // Do parse
- if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, strXmlConfigurationDomainsFilePath, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strXmlConfigurationDomainsFilePath, true, true, strError);
+ if (doc == NULL) {
+ return false;
+ }
+
+ if (!xmlParse(xmlDomainImportContext, pConfigurableDomains, doc, strXmlConfigurationDomainsFolder, EParameterConfigurationLibrary, "SystemClassName")) {
return false;
}
@@ -678,40 +710,12 @@ 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)
+bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext,
+ CElement* pRootElement, _xmlDoc* doc,
+ const string& strXmlFolder,
+ CParameterMgr::ElementLibrary eElementLibrary,
+ const string& strNameAttributeName)
{
// Init serializing context
elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(
@@ -720,25 +724,18 @@ bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingCo
// Get Schema file associated to root element
string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd";
- 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));
- }
+ CXmlDocSource docSource(doc, _bValidateSchemasOnStart,
+ strXmlSchemaFilePath,
+ pRootElement->getKind(),
+ pRootElement->getName(),
+ strNameAttributeName);
// Start clean
pRootElement->clean();
CXmlMemoryDocSink memorySink(pRootElement);
- if (!memorySink.process(*fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(docSource, elementSerializingContext)) {
//Cleanup
pRootElement->clean();
@@ -905,7 +902,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::statusCommandProces
// Show status
/// General section
- appendTitle(strResult, "General:");
+ CUtility::appendTitle(strResult, "General:");
// System class
strResult += "System Class: ";
strResult += pSystemClass->getName();
@@ -932,19 +929,19 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::statusCommandProces
strResult += "\n";
/// Subsystem list
- appendTitle(strResult, "Subsystems:");
+ CUtility::appendTitle(strResult, "Subsystems:");
string strSubsystemList;
pSystemClass->listChildrenPaths(strSubsystemList);
strResult += strSubsystemList;
/// Last applied configurations
- appendTitle(strResult, "Last Applied [Pending] Configurations:");
+ CUtility::appendTitle(strResult, "Last Applied [Pending] Configurations:");
string strLastAppliedConfigurations;
getConfigurableDomains()->listLastAppliedConfigurations(strLastAppliedConfigurations);
strResult += strLastAppliedConfigurations;
/// Criteria states
- appendTitle(strResult, "Selection Criteria:");
+ CUtility::appendTitle(strResult, "Selection Criteria:");
list<string> lstrSelectionCriteria;
getSelectionCriteria()->listSelectionCriteria(lstrSelectionCriteria, false, true);
// Concatenate the criterion list as the command result
@@ -956,7 +953,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::statusCommandProces
}
/// Tuning Mode
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgument(0) == "on") {
@@ -977,7 +974,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setTuningModeCommma
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -987,7 +984,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getTuningModeCommma
}
/// Value Space
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)strResult;
@@ -1010,7 +1007,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setValueSpaceCommma
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1020,7 +1017,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getValueSpaceCommma
}
/// Output Raw Format
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)strResult;
@@ -1043,7 +1040,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setOutputRawFormatC
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1053,7 +1050,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getOutputRawFormatC
}
/// Sync
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgument(0) == "on") {
@@ -1074,7 +1071,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setAutoSyncCommmand
return CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1083,7 +1080,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getAutoSyncCommmand
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1091,7 +1088,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::syncCommmandProcess
}
/// Criteria
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
if (remoteCommand.getArgumentCount() > 1) {
@@ -1143,7 +1140,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listCriteriaCommman
}
/// Domains
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1152,30 +1149,30 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainsCommmand
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return createDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return deleteDomain(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteAllDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
return deleteAllDomains(strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return renameDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ?
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Set property
bool bSequenceAware;
@@ -1197,7 +1194,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setSequenceAwarenes
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get property
bool bSequenceAware;
@@ -1212,33 +1209,33 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getSequenceAwarenes
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listDomainElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return getConfigurableDomains()->listDomainElements(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::addElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::addElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return addConfigurableElementToDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::removeElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::removeElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return removeConfigurableElementFromDomain(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::splitDomainCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return split(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
/// Configurations
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return getConstConfigurableDomains()->listConfigurations(remoteCommand.getArgument(0), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1252,29 +1249,29 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpDomainsCommmand
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::createConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return createConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::deleteConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return deleteConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::renameConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
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)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::saveConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return saveConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfigurationCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
list<string> lstrResult;
if (!restoreConfiguration(remoteCommand.getArgument(0), remoteCommand.getArgument(1), lstrResult)) {
@@ -1286,7 +1283,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::restoreConfiguratio
return CCommandHandler::EDone;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Build configurable element path list
std::vector<string> astrNewElementSequence;
@@ -1304,13 +1301,13 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setElementSequenceC
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return getConfigurableDomains()->getElementSequence(remoteCommand.getArgument(0), remoteCommand.getArgument(1), strResult) ? CCommandHandler::ESucceeded : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return setApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1318,7 +1315,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setRuleCommmandProc
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return clearApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1326,7 +1323,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::clearRuleCommmandPr
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Delegate to configurable domains
return getApplicationRule(remoteCommand.getArgument(0), remoteCommand.getArgument(1),
@@ -1335,7 +1332,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getRuleCommmandProc
}
/// Elements/Parameters
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass(), false);
@@ -1363,7 +1360,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listElementsCommman
}
/// Elements/Parameters
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass(), false);
@@ -1390,7 +1387,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listParametersCommm
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1411,7 +1408,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::dumpElementCommmand
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1431,7 +1428,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getElementSizeCommm
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1451,7 +1448,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showPropertiesCommm
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
string strValue;
@@ -1465,7 +1462,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getParameterCommman
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get value to set
string strValue = remoteCommand.packArguments(1, remoteCommand.getArgumentCount() - 1);
@@ -1473,7 +1470,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setParameterCommman
return accessParameterValue(remoteCommand.getArgument(0), strValue, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1493,7 +1490,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listBelongingDomain
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomainsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
CElementLocator elementLocator(getSystemClass());
@@ -1513,7 +1510,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedDomai
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1522,7 +1519,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listAssociatedEleme
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1531,7 +1528,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listConflictingElem
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1540,7 +1537,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::listRogueElementsCo
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
string strOutputValue;
string strError;
@@ -1556,7 +1553,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::getConfigurationPar
return CCommandHandler::ESucceeded;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
// Get value to set
string strValue = remoteCommand.packArguments(3, remoteCommand.getArgumentCount() - 3);
@@ -1569,7 +1566,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::setConfigurationPar
return bSuccess ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommmandProcess(
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommandProcess(
const IRemoteCommand& remoteCommand,
string& strResult)
{
@@ -1583,7 +1580,7 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::showMappingCommmand
/// Settings Import/Export
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::exportConfigurableDomainsToXMLCommmandProcess(
+ CParameterMgr::exportDomainsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strFileName = remoteCommand.getArgument(0);
@@ -1592,7 +1589,7 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::importConfigurableDomainsFromXMLCommmandProcess(
+ CParameterMgr::importDomainsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), false, true, strResult) ?
@@ -1600,7 +1597,7 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::exportConfigurableDomainsWithSettingsToXMLCommmandProcess(
+ CParameterMgr::exportDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strFileName = remoteCommand.getArgument(0);
@@ -1608,12 +1605,22 @@ CParameterMgr::CCommandHandler::CommandStatus
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainsWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::exportDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, string& result)
+{
+ string domainName = remoteCommand.getArgument(0);
+ string fileName = remoteCommand.getArgument(1);
+ return exportSingleDomainXml(fileName, domainName, true, true, result) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), true, true, strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableDomainWithSettingsFromXMLCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
bool bOverwrite = false;
@@ -1629,22 +1636,22 @@ CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importConfigurableD
}
}
- return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, strResult) ?
+ return importSingleDomainXml(remoteCommand.getArgument(0), bOverwrite, true, true, strResult) ?
CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::exportSettingsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return exportDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
-CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importSettingsCommmandProcess(const IRemoteCommand& remoteCommand, string& strResult)
+CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::importSettingsCommandProcess(const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsBinary(remoteCommand.getArgument(0), strResult) ? CCommandHandler::EDone : CCommandHandler::EFailed;
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CParameterMgr::getDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -1658,7 +1665,7 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getConfigurableDomainWithSettingsXMLCommmandProcess(
+ CParameterMgr::getDomainWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
string strDomainName = remoteCommand.getArgument(0);
@@ -1668,7 +1675,7 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::setConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CParameterMgr::setDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
return importDomainsXml(remoteCommand.getArgument(0), true, false, strResult) ?
@@ -1676,7 +1683,28 @@ CParameterMgr::CCommandHandler::CommandStatus
}
CParameterMgr::CCommandHandler::CommandStatus
- CParameterMgr::getSystemClassXMLCommmandProcess(
+ CParameterMgr::setDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, string& result)
+{
+ bool overwrite = false;
+
+ if (remoteCommand.getArgumentCount() > 1) {
+
+ if (remoteCommand.getArgument(1) == "overwrite") {
+
+ overwrite = true;
+ } else {
+ // Show usage
+ return CCommandHandler::EShowUsage;
+ }
+ }
+
+ return importSingleDomainXml(remoteCommand.getArgument(0), overwrite, true, false, result) ?
+ CCommandHandler::EDone : CCommandHandler::EFailed;
+}
+
+CParameterMgr::CCommandHandler::CommandStatus
+ CParameterMgr::getSystemClassXMLCommandProcess(
const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
@@ -2181,184 +2209,178 @@ bool CParameterMgr::clearApplicationRule(const string& strDomain, const string&
return getConfigurableDomains()->clearApplicationRule(strDomain, strConfiguration, strError);
}
-bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSettings,
- bool bFromFile, string& strError)
+bool CParameterMgr::importDomainsXml(const string& xmlSource, bool withSettings,
+ bool fromFile, string& errorMsg)
{
// Check tuning mode
- if (!checkTuningModeOn(strError)) {
+ if (!checkTuningModeOn(errorMsg)) {
return false;
}
- // check path is absolute
- if (bFromFile && strXmlSource[0] != '/') {
-
- strError = "Please provide absolute path";
+ CAutoLog autoLog(this, string("Importing domains from ") +
+ (fromFile ? ("\"" + xmlSource + "\"") : "a user-provided buffer"));
- return false;
- }
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
- // Context
- CXmlDomainImportContext xmlDomainImportContext(strError, bWithSettings, *getSystemClass());
-
- // Selection criteria definition for rule creation
- xmlDomainImportContext.setSelectionCriteriaDefinition(
- getConstSelectionCriteria()->getSelectionCriteriaDefinition());
-
- // Init serializing context
- xmlDomainImportContext.set(
- _pElementLibrarySet->getElementLibrary(EParameterConfigurationLibrary),
- "", _strSchemaFolderLocation);
-
- // Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
- pConfigurableDomains->getKind() + ".xsd";
+ bool importSuccess = wrapLegacyXmlImport(xmlSource, fromFile, withSettings,
+ *pConfigurableDomains, "SystemClassName", errorMsg);
- // Xml Source
- CXmlDocSource* pSource;
-
- if (bFromFile) {
-
- // when importing from a file strXmlSource is the file name
- pSource = new CXmlFileDocSource(strXmlSource, strXmlSchemaFilePath,
- pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName",
- _bValidateSchemasOnStart);
-
- } else {
-
- // when importing from an xml string, strXmlSource contains the string
- pSource = new CXmlStringDocSource(strXmlSource, strXmlSchemaFilePath,
- pConfigurableDomains->getKind(),
- pConfigurableDomains->getName(), "SystemClassName",
- _bValidateSchemasOnStart);
-
- }
- // Start clean
- pConfigurableDomains->clean();
-
- // Use a doc sink that instantiate Configurable Domains from the given doc source
- CXmlMemoryDocSink memorySink(pConfigurableDomains);
-
- bool bProcessSuccess = memorySink.process(*pSource, xmlDomainImportContext);
-
- if (!bProcessSuccess) {
-
- //Cleanup
- pConfigurableDomains->clean();
-
- } else {
+ if (importSuccess) {
// Validate domains after XML import
pConfigurableDomains->validate(_pMainParameterBlackboard);
-
}
- delete pSource;
-
- return bProcessSuccess;
+ return importSuccess;
}
-bool CParameterMgr::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
- string& strError)
+bool CParameterMgr::importSingleDomainXml(const string& xmlSource, bool overwrite,
+ bool withSettings, bool fromFile, string& errorMsg)
{
- if (!checkTuningModeOn(strError)) {
+ if (!checkTuningModeOn(errorMsg)) {
return false;
}
- // check path is absolute
- if (strXmlSource[0] != '/') {
+ CAutoLog autoLog(this, string("Importing a single domain from ") +
+ (fromFile ? ("\"" + xmlSource + "\"") : "a user-provided buffer"));
- strError = "Please provide absolute path";
+ // 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());
+ if (!wrapLegacyXmlImport(xmlSource, fromFile, withSettings, *standaloneDomain, "", errorMsg)) {
return false;
}
- return importDomainFromFile(strXmlSource, bOverwrite, strError);
+ if (!getConfigurableDomains()->addDomain(*standaloneDomain, overwrite, errorMsg)) {
+ return false;
+ }
+
+ // ownership has been transfered to the ConfigurableDomains object
+ standaloneDomain.release();
+ return true;
}
-bool CParameterMgr::serializeElement(string& strXmlDest,
- CXmlSerializingContext& xmlSerializingContext, bool bToFile,
- const CElement& element, string& strError) const
+bool CParameterMgr::wrapLegacyXmlImport(const string& xmlSource, bool fromFile,
+ bool withSettings, CElement& element,
+ const string& nameAttributeName, string& errorMsg)
{
- // check path is absolute
- if (bToFile && strXmlDest[0] != '/') {
+ CXmlDomainImportContext xmlDomainImportContext(errorMsg, withSettings, *getSystemClass());
- strError = "Please provide absolute path";
+ // Selection criteria definition for rule creation
+ xmlDomainImportContext.setSelectionCriteriaDefinition(
+ getConstSelectionCriteria()->getSelectionCriteriaDefinition());
+ // It doesn't make sense to resolve XIncludes on an imported file because
+ // we can't reliably decide of a "base url"
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(xmlSource, fromFile, false, errorMsg);
+ if (doc == NULL) {
+ return false;
+ }
+
+ return xmlParse(xmlDomainImportContext, &element, doc, "", EParameterConfigurationLibrary, nameAttributeName);
+}
+
+bool CParameterMgr::serializeElement(std::ostream& output,
+ CXmlSerializingContext& xmlSerializingContext,
+ const CElement& element) const
+{
+ if (!output.good()) {
+ xmlSerializingContext.setError("Can't write XML: the output is in a bad state.");
return false;
}
// Get Schema file associated to root element
- string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" +
+ string xmlSchemaFilePath = _strSchemaFolderLocation + "/" +
element.getKind() + ".xsd";
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(&element, element.getKind(),
- strXmlSchemaFilePath, "parameter-framework",
- getVersion(), _bValidateSchemasOnStart);
-
- // Xml Sink
- CXmlDocSink* pSink;
+ CXmlMemoryDocSource memorySource(&element, _bValidateSchemasOnStart,
+ element.getKind(),
+ xmlSchemaFilePath,
+ "parameter-framework",
+ getVersion());
- if (bToFile) {
+ // Use a doc sink to write the doc data in a stream
+ CXmlStreamDocSink sink(output);
- // Use a doc sink to write the doc data in a file
- pSink = new CXmlFileDocSink(strXmlDest);
+ bool processSuccess = sink.process(memorySource, xmlSerializingContext);
- } else {
+ return processSuccess;
+}
- // 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 CParameterMgr::exportDomainsXml(string& xmlDest, bool withSettings, bool toFile,
+ string& errorMsg) const
+{
+ CAutoLog autoLog(this, string("Exporting domains to ") +
+ (toFile ? ("\"" + xmlDest + "\"") : " a user-provided buffer"));
- bool bProcessSuccess = pSink->process(memorySource, xmlSerializingContext);
+ const CConfigurableDomains* configurableDomains = getConstConfigurableDomains();
- delete pSink;
- return bProcessSuccess;
+ return wrapLegacyXmlExport(xmlDest, toFile, withSettings, *configurableDomains, errorMsg);
}
-bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, bool bToFile,
- string& strError) const
+bool CParameterMgr::exportSingleDomainXml(string& xmlDest, const string& domainName,
+ bool withSettings, bool toFile, string& errorMsg) const
{
- const CConfigurableDomains* pConfigurableDomains = getConstConfigurableDomains();
+ CAutoLog autoLog(this, string("Exporting single domain '") + domainName + "' to " +
+ (toFile ? ("\"" + xmlDest + "\"") : " a user-provided buffer"));
- CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+ // Element to be serialized
+ const CConfigurableDomain* requestedDomain =
+ getConstConfigurableDomains()->findConfigurableDomain(domainName, errorMsg);
- xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+ if (requestedDomain == NULL) {
+ return false;
+ }
- xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ return wrapLegacyXmlExport(xmlDest, toFile, withSettings, *requestedDomain, errorMsg);
+}
+bool CParameterMgr::wrapLegacyXmlExport(string& xmlDest, bool toFile, bool withSettings,
+ const CElement& element, string& errorMsg) const
+{
+ CXmlDomainExportContext context(errorMsg, withSettings, _bValueSpaceIsRaw,
+ _bOutputRawFormatIsHex);
- return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
- *pConfigurableDomains, strError);
+ if (toFile) {
+ return wrapLegacyXmlExportToFile(xmlDest, element, context);
+ } else {
+ return wrapLegacyXmlExportToString(xmlDest, element, context);
+ }
}
-bool CParameterMgr::exportSingleDomainXml(string& strXmlDest, const string& strDomainName,
- bool bWithSettings, bool bToFile, string& strError) const
+bool CParameterMgr::wrapLegacyXmlExportToFile(string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const
{
- const CConfigurableDomains* pAllDomains = getConstConfigurableDomains();
-
- // Element to be serialized
- const CConfigurableDomain* pRequestedDomain =
- pAllDomains->findConfigurableDomain(strDomainName, strError);
+ std::ofstream output(xmlDest.c_str());
- if (!pRequestedDomain) {
+ if (output.fail()) {
+ context.setError("Failed to open \"" + xmlDest + "\" for writing.");
return false;
}
- CXmlDomainExportContext xmlDomainExportContext(strError, bWithSettings);
+ return serializeElement(output, context, element);
- xmlDomainExportContext.setValueSpaceRaw(_bValueSpaceIsRaw);
+}
+
+bool CParameterMgr::wrapLegacyXmlExportToString(string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const
+{
+ std::ostringstream output;
- xmlDomainExportContext.setOutputRawFormat(_bOutputRawFormatIsHex);
+ if (!serializeElement(output, context, element)) {
+ return false;
+ }
- return serializeElement(strXmlDest, xmlDomainExportContext, bToFile,
- *pRequestedDomain, strError);
+ xmlDest = output.str();
+
+ return true;
}
// Binary Import/Export
@@ -2369,13 +2391,8 @@ bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strEr
return false;
}
- // check path is absolute
- if (strFileName[0] != '/') {
- strError = "Please provide absolute path";
-
- return false;
- }
+ CAutoLog autoLog(this, string("Importing domains from binary file \"") + strFileName + "\"");
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
@@ -2385,14 +2402,7 @@ bool CParameterMgr::importDomainsBinary(const string& strFileName, string& strEr
bool CParameterMgr::exportDomainsBinary(const string& strFileName, string& strError)
{
- // check path is absolute
- if (strFileName[0] != '/') {
-
- strError = "Please provide absolute path";
-
- return false;
- }
-
+ CAutoLog autoLog(this, string("Exporting domains to binary file \"") + strFileName + "\"");
// Root element
CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
@@ -2531,12 +2541,12 @@ bool CParameterMgr::handleRemoteProcessingInterface(string& strError)
log_info("Starting remote processor server on port %d", getConstFrameworkConfiguration()->getServerPort());
// Start
- if (!_pRemoteProcessorServer->start()) {
+ if (!_pRemoteProcessorServer->start(strError)) {
ostringstream oss;
oss << "ParameterMgr: Unable to start remote processor server on port "
<< getConstFrameworkConfiguration()->getServerPort();
- strError = oss.str();
+ strError = oss.str() + ": " + strError;
return false;
}
@@ -2617,16 +2627,18 @@ bool CParameterMgr::exportElementToXMLString(const IXmlSource* pXmlSource,
CXmlSerializingContext xmlSerializingContext(strError);
// Use a doc source by loading data from instantiated Configurable Domains
- CXmlMemoryDocSource memorySource(pXmlSource, strRootElementType, false);
+ CXmlMemoryDocSource memorySource(pXmlSource, false, strRootElementType);
// Use a doc sink that write the doc data in a string
- CXmlStringDocSink stringSink(strResult);
+ ostringstream output;
+ CXmlStreamDocSink streamSink(output);
// Do the export
- bool bProcessSuccess = stringSink.process(memorySource, xmlSerializingContext);
-
- if (!bProcessSuccess) {
+ bool bProcessSuccess = streamSink.process(memorySource, xmlSerializingContext);
+ if (bProcessSuccess) {
+ strResult = output.str();
+ } else {
strResult = strError;
}
diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h
index ef834eb..cd2f664 100644
--- a/parameter/ParameterMgr.h
+++ b/parameter/ParameterMgr.h
@@ -40,8 +40,11 @@
#include "Element.h"
#include "XmlDocSink.h"
#include "XmlDocSource.h"
+#include "XmlDomainExportContext.h"
#include <string>
+#include <ostream>
+#include <istream>
class CElementLibrarySet;
class CSubsystemLibrary;
@@ -86,9 +89,9 @@ class CParameterMgr : private CElement
const char* _pcDescription;
};
// Version
- static const uint32_t guiEditionMajor = 0x2;
- static const uint32_t guiEditionMinor = 0x4;
- static const uint32_t guiRevision = 0x3;
+ static const uint32_t guiEditionMajor = 2;
+ static const uint32_t guiEditionMinor = 6;
+ static const uint32_t guiRevision = 0;
// Parameter handle friendship
friend class CParameterHandle;
@@ -275,63 +278,65 @@ public:
/**
* Method that imports Configurable Domains from an Xml source.
*
- * @param[in] strXmlSource a std::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
+ * @param[in] xmlSource a std::string containing an xml description or a path to an xml file
+ * @param[in] withSettings 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
+ * @param[in] fromFile a boolean that determines if the source is an xml description in
+ * xmlSource or contained in a file. In that case xmlSource is just the file path.
+ * @param[out] errorMsg 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);
+ bool importDomainsXml(const std::string& xmlSource, bool withSettings, bool fromFile,
+ std::string& errorMsg);
/**
* 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
+ * @param[in] xmlSource a string containing an xml description or a path to an xml file
+ * @param[in] overwrite when importing an existing domain, allow
+ * overwriting or return an error
+ * @param[in] withSettings 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
+ * @param[in] fromFile a boolean that determines if the source is an xml description in
+ * xmlSource or contained in a file. In that case xmlSource is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occurs
*/
- bool importSingleDomainXml(const std::string& strXmlSource, bool bOverwrite,
- std::string& strError);
+ bool importSingleDomainXml(const std::string& xmlSource, bool overwrite, bool withSettings,
+ bool fromFile, std::string& errorMsg);
/**
* 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
+ * @param[in,out] xmlDest a string containing an xml description or a path to an xml file
+ * @param[in] withSettings 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
+ * @param[in] toFile a boolean that determines if the destination is an xml description in
+ * xmlDest or contained in a file. In that case xmlDest is just the file path.
+ * @param[out] errorMsg is used as the error output
*
* @return false if any error occurs, true otherwise.
*/
- bool exportDomainsXml(std::string& strXmlDest, bool bWithSettings, bool bToFile,
- std::string& strError) const;
+ bool exportDomainsXml(std::string& xmlDest, bool withSettings, bool toFile,
+ std::string& errorMsg) 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
+ * @param[in,out] xmlDest a string containing an xml description or a path to an xml file
+ * @param[in] domainName the name of the domain to be exported
+ * @param[in] withSettings 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
+ * @param[in] toFile a boolean that determines if the destination is an xml description in
+ * xmlDest or contained in a file. In that case xmlDest is just the file path.
+ * @param[out] errorMsg 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;
+ bool exportSingleDomainXml(std::string& xmlDest, const std::string& domainName,
+ bool withSettings, bool toFile, std::string& errorMsg) const;
// Binary Import/Export
bool importDomainsBinary(const std::string& strFileName, std::string& strError);
@@ -374,74 +379,84 @@ private:
/// Status
CCommandHandler::CommandStatus statusCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Tuning Mode
- CCommandHandler::CommandStatus setTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getTuningModeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setTuningModeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getTuningModeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Value Space
- CCommandHandler::CommandStatus setValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getValueSpaceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getValueSpaceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Output Raw Format
- CCommandHandler::CommandStatus setOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getOutputRawFormatCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getOutputRawFormatCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Sync
- CCommandHandler::CommandStatus setAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getAutoSyncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus syncCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getAutoSyncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus syncCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Criteria
- CCommandHandler::CommandStatus listCriteriaCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listCriteriaCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Domains
- CCommandHandler::CommandStatus listDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus createDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteAllDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus renameDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getSequenceAwarenessCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listDomainElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus addElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus removeElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus splitDomainCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus createDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteAllDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus renameDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getSequenceAwarenessCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listDomainElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus addElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus removeElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus splitDomainCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Configurations
- CCommandHandler::CommandStatus listConfigurationsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus dumpDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus createConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus deleteConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus renameConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus saveConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus restoreConfigurationCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getElementSequenceCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus clearRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getRuleCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listConfigurationsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus dumpDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus createConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus deleteConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus renameConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus saveConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus restoreConfigurationCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getElementSequenceCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus clearRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getRuleCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Elements/Parameters
- CCommandHandler::CommandStatus listElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listParametersCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus dumpElementCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getElementSizeCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus showPropertiesCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus getConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus setConfigurationParameterCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listBelongingDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listAssociatedDomainsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus showMappingCommmandProcess(const IRemoteCommand& remoteCommand,
+ CCommandHandler::CommandStatus listElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listParametersCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus dumpElementCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getElementSizeCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus showPropertiesCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus getConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus setConfigurationParameterCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listBelongingDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listAssociatedDomainsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus showMappingCommandProcess(const IRemoteCommand& remoteCommand,
std::string& strResult);
/// Browse
- CCommandHandler::CommandStatus listAssociatedElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listConflictingElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- CCommandHandler::CommandStatus listRogueElementsCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listAssociatedElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listConflictingElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus listRogueElementsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/// Settings Import/Export
- CCommandHandler::CommandStatus exportConfigurableDomainsToXMLCommmandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
- 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);
+ CCommandHandler::CommandStatus exportDomainsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importDomainsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus exportDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importDomainsWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ /**
+ * Command handler method for exportDomainWithSettingsXML command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] result a std::string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus exportDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& result);
+ CCommandHandler::CommandStatus importDomainWithSettingsXMLCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus exportSettingsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
+ CCommandHandler::CommandStatus importSettingsCommandProcess(const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainsWithSettings command.
+ * Command handler method for getDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -449,11 +464,11 @@ private:
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus getDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for getConfigurableDomainWithSettings command.
+ * Command handler method for getDomainWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a string containing the result of the command
@@ -461,11 +476,11 @@ private:
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getConfigurableDomainWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus getDomainWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
- * Command handler method for setConfigurableDomainWithSettings command.
+ * Command handler method for setDomainsWithSettings command.
*
* @param[in] remoteCommand contains the arguments of the received command.
* @param[out] strResult a std::string containing the result of the command
@@ -473,10 +488,22 @@ private:
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus setConfigurableDomainsWithSettingsXMLCommmandProcess(
+ CCommandHandler::CommandStatus setDomainsWithSettingsXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
/**
+ * Command handler method for setDomainWithSettings command.
+ *
+ * @param[in] remoteCommand contains the arguments of the received command.
+ * @param[out] result a std::string containing the result of the command
+ *
+ * @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
+ * in the other case
+ */
+ CCommandHandler::CommandStatus setDomainWithSettingsXMLCommandProcess(
+ const IRemoteCommand& remoteCommand, std::string& result);
+
+ /**
* Command handler method for getSystemClass command.
*
* @param[in] remoteCommand contains the arguments of the received command.
@@ -485,7 +512,7 @@ private:
* @return CCommandHandler::ESucceeded if command succeeded or CCommandHandler::EFailed
* in the other case
*/
- CCommandHandler::CommandStatus getSystemClassXMLCommmandProcess(
+ CCommandHandler::CommandStatus getSystemClassXMLCommandProcess(
const IRemoteCommand& remoteCommand, std::string& strResult);
// Max command usage length, use for formatting
@@ -515,35 +542,104 @@ private:
bool loadSettings(std::string& strError);
bool loadSettingsFromConfigFile(std::string& strError);
- // 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");
+ /** Parse an XML stream into an element
+ *
+ * @param[in] elementSerializingContext serializing context
+ * @param[out] pRootElement the receiving element
+ * @param[in] input the input XML stream
+ * @param[in] strXmlFolder the folder containing the XML input file (if applicable) or ""
+ * @param[in] eElementLibrary which element library to be used
+ * @param[in] strNameAttributeName the name of the element's XML "name" attribute
+ *
+ * @returns true if parsing succeeded, false otherwise
+ */
+ bool xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement,
+ _xmlDoc* doc, const std::string& strXmlFolder,
+ ElementLibrary eElementLibrary, const std::string& strNameAttributeName = "Name");
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * Public APIs have a string argument that can either contain:
+ * - a path to an XML file or;
+ * - an actual XML document.
+ * They also have a boolean argument specifying which of the two cases it
+ * is.
+ *
+ * Instead, the internal APIs only take an std::istream argument. This
+ * method opens the file as a stream if applicable or simply wrap the
+ * string in a stream. It then passes the stream to the internal methods.
+ *
+ * @param[in] xmlSource the XML source (either a path or an actual xml
+ * document)
+ * @param[in] fromFile specifies whether xmlSource is a path or an
+ * actual XML document
+ * @param[in] withSettings if false, only import the configurations
+ * applicability rules; if true, also import their settings
+ * @param[out] element the receiving element
+ * @param[in] nameAttributeName the name of the element's XML "name"
+ * attribute
+ * @param[out] errorMsg string used as output for any error message
+ *
+ * @returns true if the import succeeded, false otherwise
+ */
+ bool wrapLegacyXmlImport(const std::string& xmlSource, bool fromFile, bool withSettings,
+ CElement& element, const std::string& nameAttributeName,
+ std::string& errorMsg);
/**
* 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[out] output the stream to output the XML to
* @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;
+ bool serializeElement(std::ostream& output, CXmlSerializingContext& xmlSerializingContext,
+ const CElement& element) 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);
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * Public APIs have a string argument that can either:
+ * - contain a path to an XML file or;
+ * - receive an actual XML document.
+ * They also have a boolean argument specifying which of the two cases it
+ * is.
+ *
+ * Instead, the internal APIs only take an std::ostream argument. This
+ * method opens the file as a stream if applicable or simply wrap the
+ * string in a stream. It then passes the stream to the internal methods.
+ *
+ * @param[in] xmlDest the XML sink (either a path or any string that
+ * will be filled)
+ * @param[in] toFile specifies whether xmlSource is a path or a
+ * string that will receive an actual XML document
+ * @param[in] withSettings if false, only export the configurations
+ * applicability rules; if true, also export their settings
+ * @param[out] element the element to be exported
+ * @param[out] errorMsg string used as output for any error message
+ *
+ * @returns true if the export succeeded, false otherwise
+ */
+ bool wrapLegacyXmlExport(std::string& xmlDest, bool toFile, bool withSettings,
+ const CElement& element, std::string& errorMsg) const;
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * @see wrapLegacyXmlExport
+ */
+ bool wrapLegacyXmlExportToFile(std::string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const;
+
+ /** Wrapper for converting public APIs semantics to internal API
+ *
+ * @see wrapLegacyXmlExport
+ */
+ bool wrapLegacyXmlExportToString(std::string& xmlDest,
+ const CElement& element,
+ CXmlDomainExportContext &context) const;
// Framework Configuration
diff --git a/parameter/ParameterMgrFullConnector.cpp b/parameter/ParameterMgrFullConnector.cpp
index 0991475..30d2780 100644
--- a/parameter/ParameterMgrFullConnector.cpp
+++ b/parameter/ParameterMgrFullConnector.cpp
@@ -349,10 +349,19 @@ bool CParameterMgrFullConnector::exportDomainsXml(string& strXmlDest, bool bWith
return _pParameterMgr->exportDomainsXml(strXmlDest, bWithSettings, bToFile, strError);
}
+// deprecated, use the other version of importSingleDomainXml instead
bool CParameterMgrFullConnector::importSingleDomainXml(const string& strXmlSource, bool bOverwrite,
string& strError)
{
- return _pParameterMgr->importSingleDomainXml(strXmlSource, bOverwrite, strError);
+ return importSingleDomainXml(strXmlSource, bOverwrite, true, false, strError);
+}
+
+bool CParameterMgrFullConnector::importSingleDomainXml(const string& xmlSource, bool overwrite,
+ bool withSettings, bool fromFile,
+ string& errorMsg)
+{
+ return _pParameterMgr->importSingleDomainXml(xmlSource, overwrite, withSettings, fromFile,
+ errorMsg);
}
bool CParameterMgrFullConnector::exportSingleDomainXml(string& strXmlDest,
diff --git a/parameter/ParameterType.cpp b/parameter/ParameterType.cpp
index 01d94aa..eb9fd3d 100644
--- a/parameter/ParameterType.cpp
+++ b/parameter/ParameterType.cpp
@@ -31,11 +31,14 @@
#include "Parameter.h"
#include "ArrayParameter.h"
#include "ParameterAccessContext.h"
+#include "Utility.h"
#define base CTypeElement
using std::string;
+const std::string CParameterType::gUnitPropertyName = "Unit";
+
CParameterType::CParameterType(const string& strName) : base(strName), _uiSize(0)
{
}
@@ -68,15 +71,33 @@ string CParameterType::getUnit() const
return _strUnit;
}
+void CParameterType::setUnit(const std::string& strUnit)
+{
+ _strUnit = strUnit;
+}
+
// From IXmlSink
bool CParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
- // Unit
- _strUnit = xmlElement.getAttributeString("Unit");
-
+ setUnit(xmlElement.getAttributeString(gUnitPropertyName));
return base::fromXml(xmlElement, serializingContext);
}
+// From IXmlSource
+void CParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
+{
+ base::toXml(xmlElement, serializingContext);
+ setXmlUnitAttribute(xmlElement);
+}
+
+void CParameterType::setXmlUnitAttribute(CXmlElement& xmlElement) const
+{
+ const string& unit = getUnit();
+ if (!unit.empty()) {
+ xmlElement.setAttributeString(gUnitPropertyName, unit);
+ }
+}
+
// XML Serialization value space handling
// Value space handling for configuration import/export
void CParameterType::handleValueSpaceAttribute(CXmlElement& xmlConfigurableElementSettingsElement, CConfigurationAccessContext& configurationAccessContext) const
@@ -91,14 +112,13 @@ void CParameterType::showProperties(string& strResult) const
{
base::showProperties(strResult);
- // Unit
- if (!_strUnit.empty()) {
-
- strResult += "Unit: " + _strUnit + "\n";
+ // Add Unit property if found
+ if (!getUnit().empty()) {
+ strResult += gUnitPropertyName + ": " + getUnit() + "\n";
}
// Scalar size
- strResult += "Scalar size: " + toString(getSize()) + " byte(s) \n";
+ strResult += "Scalar size: " + CUtility::toString(getSize()) + " byte(s) \n";
}
// Default value handling (simulation only)
diff --git a/parameter/ParameterType.h b/parameter/ParameterType.h
index 7d7caf7..cf58f7b 100644
--- a/parameter/ParameterType.h
+++ b/parameter/ParameterType.h
@@ -50,10 +50,14 @@ public:
// Unit
std::string getUnit() const;
+ void setUnit(const std::string& strUnit);
// From IXmlSink
virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext);
+ // From IXmlSource
+ virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const;
+
/// Conversions
// String
virtual bool toBlackboard(const std::string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const = 0;
@@ -118,6 +122,8 @@ protected:
}
private:
+ void setXmlUnitAttribute(CXmlElement& xmlElement) const;
+
// Instantiation
virtual CInstanceConfigurableElement* doInstantiate() const;
// Generic Access
@@ -130,4 +136,6 @@ private:
uint32_t _uiSize;
// Unit
std::string _strUnit;
+
+ static const std::string gUnitPropertyName;
};
diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp
index 7818924..e45c993 100644
--- a/parameter/SelectionCriterion.cpp
+++ b/parameter/SelectionCriterion.cpp
@@ -30,6 +30,7 @@
#include "SelectionCriterion.h"
#include "AutoLog.h"
+#include "Utility.h"
#define base CElement
@@ -125,7 +126,7 @@ std::string CSelectionCriterion::getFormattedDescription(bool bWithTypeInfo, boo
if (bWithTypeInfo) {
// Display type info
- appendTitle(strFormattedDescription, getName() + ":");
+ CUtility::appendTitle(strFormattedDescription, getName() + ":");
// States
strFormattedDescription += "Possible states ";
diff --git a/parameter/StringParameterType.cpp b/parameter/StringParameterType.cpp
index d47895d..321dc97 100644
--- a/parameter/StringParameterType.cpp
+++ b/parameter/StringParameterType.cpp
@@ -29,6 +29,7 @@
*/
#include "StringParameterType.h"
#include "StringParameter.h"
+#include "Utility.h"
#define base CTypeElement
@@ -51,7 +52,7 @@ void CStringParameterType::showProperties(string& strResult) const
// Max length
strResult += "Max length: ";
- strResult += toString(_uiMaxLength);
+ strResult += CUtility::toString(_uiMaxLength);
strResult += "\n";
}
diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp
index 5dbe3a0..6b0264b 100644
--- a/parameter/Subsystem.cpp
+++ b/parameter/Subsystem.cpp
@@ -35,6 +35,7 @@
#include "ConfigurationAccessContext.h"
#include "SubsystemObjectCreator.h"
#include "MappingData.h"
+#include "Utility.h"
#include <assert.h>
#include <sstream>
@@ -104,6 +105,10 @@ bool CSubsystem::needResync(bool bClear)
// From IXmlSink
bool CSubsystem::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
{
+ // Subsystem class does not rely on generic fromXml algorithm of Element class.
+ // So, setting here the description if found as XML attribute.
+ setDescription(getXmlDescriptionAttribute(xmlElement));
+
// Context
CXmlParameterSerializingContext& parameterBuildContext = static_cast<CXmlParameterSerializingContext&>(serializingContext);
@@ -440,7 +445,8 @@ bool CSubsystem::handleSubsystemObjectCreation(
pSubsystemObjectCreator->getMaxConfigurableElementSize()) {
string strSizeError = "Size should not exceed " +
- toString(pSubsystemObjectCreator->getMaxConfigurableElementSize());
+ CUtility::toString(
+ pSubsystemObjectCreator->getMaxConfigurableElementSize());
strError = getMappingError(strKey, strSizeError, pInstanceConfigurableElement);
diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp
index 76b9549..e6b7b44 100644
--- a/parameter/SubsystemObject.cpp
+++ b/parameter/SubsystemObject.cpp
@@ -149,7 +149,7 @@ bool CSubsystemObject::sync(CParameterBlackboard& parameterBlackboard, bool bBac
strError = string("Unable to ") + (bBack ? "back" : "forward") + " synchronize configurable element " +
_pInstanceConfigurableElement->getPath() + ": " + strError;
- log_warning(strError);
+ log_warning("%s", strError.c_str());
// Fall back to parameter default initialization
if (bBack) {
@@ -213,37 +213,37 @@ void CSubsystemObject::blackboardWrite(const void* pvData, uint32_t uiSize)
}
// Logging
-void CSubsystemObject::log_info(const string& strMessage, ...) const
+void CSubsystemObject::log_info(std::string strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
va_end(listPointer);
if (pacBuffer != NULL) {
- _pInstanceConfigurableElement->log_info(pacBuffer);
+ _pInstanceConfigurableElement->log_info("%s", pacBuffer);
}
free(pacBuffer);
}
-void CSubsystemObject::log_warning(const string& strMessage, ...) const
+void CSubsystemObject::log_warning(std::string strMessage, ...) const
{
char *pacBuffer;
va_list listPointer;
va_start(listPointer, strMessage);
- vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
+ vasprintf(&pacBuffer, strMessage.c_str(), listPointer);
va_end(listPointer);
if (pacBuffer != NULL) {
- _pInstanceConfigurableElement->log_warning(pacBuffer);
+ _pInstanceConfigurableElement->log_warning("%s", pacBuffer);
}
free(pacBuffer);
diff --git a/parameter/SubsystemObject.h b/parameter/SubsystemObject.h
index ab085bc..2ba2123 100644
--- a/parameter/SubsystemObject.h
+++ b/parameter/SubsystemObject.h
@@ -83,8 +83,12 @@ protected:
void blackboardRead(void* pvData, uint32_t uiSize);
void blackboardWrite(const void* pvData, uint32_t uiSize);
// Logging
- void log_info(const std::string& strMessage, ...) const;
- void log_warning(const std::string& strMessage, ...) const;
+ // Copy the string format because:
+ // - passing char * would break compatibility
+ // - passing a const std::string & in forbiden by the c++ standard
+ // as va_start second argument must not be a reference.
+ void log_info(std::string strMessage, ...) const;
+ void log_warning(std::string strMessage, ...) const;
// Belonging Subsystem retrieval
const CSubsystem* getSubsystem() const;
diff --git a/parameter/TypeElement.cpp b/parameter/TypeElement.cpp
index 37228d7..01b7137 100644
--- a/parameter/TypeElement.cpp
+++ b/parameter/TypeElement.cpp
@@ -76,8 +76,11 @@ bool CTypeElement::hasMappingData() const
// Element properties
void CTypeElement::showProperties(std::string& strResult) const
{
- (void)strResult;
- // Prevent base from being called in that context!
+ // The description attribute may be found in the type and not from instance.
+ showDescriptionProperty(strResult);
+ // Prevent base from being called from the Parameter Type context as
+ // it would lead to duplicate the name attribute (duplicated in the type and instance
+ // which have a common base Element)
}
void CTypeElement::populate(CElement* pElement) const
diff --git a/parameter/XmlDomainExportContext.h b/parameter/XmlDomainExportContext.h
index 6a95d97..22ad995 100644
--- a/parameter/XmlDomainExportContext.h
+++ b/parameter/XmlDomainExportContext.h
@@ -35,8 +35,14 @@
class CXmlDomainExportContext : public CXmlDomainSerializingContext
{
public:
- CXmlDomainExportContext(std::string& strError, bool bWithSettings):
- base(strError, bWithSettings) {}
+ CXmlDomainExportContext(std::string& strError,
+ bool bWithSettings = true,
+ bool bValueSpaceIsRaw = true,
+ bool bOutputRawFormatIsHex = true):
+ base(strError, bWithSettings),
+ _bValueSpaceIsRaw(bValueSpaceIsRaw),
+ _bOutputRawFormatIsHex(bOutputRawFormatIsHex)
+ {}
// Value interpretation as Real or Raw
void setValueSpaceRaw(bool bIsRaw)
diff --git a/parameter/XmlFileIncluderElement.cpp b/parameter/XmlFileIncluderElement.cpp
index 674a331..d20a624 100644
--- a/parameter/XmlFileIncluderElement.cpp
+++ b/parameter/XmlFileIncluderElement.cpp
@@ -28,12 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "XmlFileIncluderElement.h"
-#include "XmlFileDocSource.h"
+#include "XmlDocSource.h"
#include "XmlMemoryDocSink.h"
#include "XmlElementSerializingContext.h"
#include "ElementLibrary.h"
#include "AutoLog.h"
#include <assert.h>
+#include <fstream>
#define base CKindElement
CXmlFileIncluderElement::CXmlFileIncluderElement(const std::string& strName,
@@ -68,12 +69,20 @@ bool CXmlFileIncluderElement::fromXml(const CXmlElement& xmlElement, CXmlSeriali
std::string strPathToXsdFile = elementSerializingContext.getXmlSchemaPathFolder() + "/" +
strIncludedElementType + ".xsd";
- CXmlFileDocSource fileDocSource(strPath,
- strPathToXsdFile,
- strIncludedElementType,
- _bValidateSchemasOnStart);
+ std::string xmlErrorMsg;
+ _xmlDoc *doc = CXmlDocSource::mkXmlDoc(strPath, true, true, xmlErrorMsg);
+ if (doc == NULL) {
+ elementSerializingContext.setError(xmlErrorMsg);
+ return false;
+ }
+
+ CXmlDocSource docSource(doc, _bValidateSchemasOnStart,
+ strPathToXsdFile,
+ strIncludedElementType);
+
+ if (!docSource.isParsable()) {
- if (!fileDocSource.isParsable(elementSerializingContext)) {
+ elementSerializingContext.setError("Could not parse document \"" + strPath + "\"");
return false;
}
@@ -81,7 +90,7 @@ bool CXmlFileIncluderElement::fromXml(const CXmlElement& xmlElement, CXmlSeriali
// Get top level element
CXmlElement childElement;
- fileDocSource.getRootElement(childElement);
+ docSource.getRootElement(childElement);
// Create child element
CElement* pChild = elementSerializingContext.getElementLibrary()->createElement(childElement);
@@ -100,7 +109,7 @@ bool CXmlFileIncluderElement::fromXml(const CXmlElement& xmlElement, CXmlSeriali
// Use a doc sink that instantiate the structure from the doc source
CXmlMemoryDocSink memorySink(pChild);
- if (!memorySink.process(fileDocSource, elementSerializingContext)) {
+ if (!memorySink.process(docSource, elementSerializingContext)) {
return false;
}
diff --git a/parameter/include/ParameterMgrFullConnector.h b/parameter/include/ParameterMgrFullConnector.h
index 31022a6..4ee3b4f 100644
--- a/parameter/include/ParameterMgrFullConnector.h
+++ b/parameter/include/ParameterMgrFullConnector.h
@@ -215,11 +215,28 @@ public:
/**
* 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
+ * @param[in] xmlSource a string containing an xml description or a path to an xml file
+ * @param[in] overwrite when importing an existing domain, allow overwriting or return an
+ * error
+ * @param[in] withSettings 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
+ * @param[in] fromFile 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] errorMsg is used as the error output
+ *
+ * @return false if any error occurs
+ */
+ bool importSingleDomainXml(const std::string& xmlSource, bool overwrite, bool withSettings,
+ bool toFile, std::string& errorMsg);
+ /**
+ * Method that imports a single Configurable Domain from an string
+ * describing an Xml source.
+ *
+ * @deprecated use the other versions of importSingleDomainXml instead
+ *
+ * @param[in] strXmlSource a string containing an xml description
+ * @param[in] bOverwrite when importing an existing domain, allow overwriting or return an
+ * error
* @param[out] strError is used as the error output
*
* @return false if any error occurs