From 812e61d30283f2d7b82e0c676d366a71d0b09351 Mon Sep 17 00:00:00 2001 From: Ken Rowland Date: Thu, 2 Aug 2018 14:57:00 -0400 Subject: [PATCH] Initial commit, will change --- configuration/config2/SchemaValue.cpp | 2 +- configuration/config2/SchemaValue.hpp | 6 +- configuration/config2/XSDSchemaParser.cpp | 13 +- configuration/config2/XSDSchemaParser.hpp | 2 +- configuration/config2/XSDValueSetParser.cpp | 24 +- configuration/config2/XSDValueSetParser.hpp | 6 + esp/services/ws_config2/ws_config2Service.cpp | 2 +- .../configschema/xsd/dafilesrv.xsd | 2 +- .../configschema/xsd/eclagent.xsd | 26 +- .../componentfiles/configschema/xsd/esp.xsd | 52 +-- .../configschema/xsd/esp_service_smc.xsd | 16 +- .../configschema/xsd/hardware.xsd | 71 ++- .../componentfiles/configschema/xsd/roxie.xsd | 408 +++++++++--------- .../componentfiles/configschema/xsd/types.xsd | 26 +- 14 files changed, 329 insertions(+), 327 deletions(-) diff --git a/configuration/config2/SchemaValue.cpp b/configuration/config2/SchemaValue.cpp index f291e65eeab..1fa366d118d 100644 --- a/configuration/config2/SchemaValue.cpp +++ b/configuration/config2/SchemaValue.cpp @@ -52,7 +52,7 @@ SchemaValue::SchemaValue(const SchemaValue &value) m_valueLimitRuleType = value.m_valueLimitRuleType; m_valueLimitRuleData = value.m_valueLimitRuleData; m_requiredIf = value.m_requiredIf; - m_group = value.m_group; + m_groupByName = value.m_groupByName; // special processing? Maybe after inserting? std::vector> m_mirrorToSchemaValues; diff --git a/configuration/config2/SchemaValue.hpp b/configuration/config2/SchemaValue.hpp index 01da43fb346..650c9b6ac1d 100644 --- a/configuration/config2/SchemaValue.hpp +++ b/configuration/config2/SchemaValue.hpp @@ -86,8 +86,8 @@ class DECL_EXPORT SchemaValue const std::string &getValueLimitRuleData() { return m_valueLimitRuleData; } void setRequiredIf(const std::string &reqIf) { m_requiredIf = reqIf; } const std::string &getRequiredIf() const { return m_requiredIf; } - void setGroup(const std::string &group) { m_group = group; } - const std::string &getGroup() const { return m_group; } + void setGroupByName(const std::string &group) { m_groupByName = group; } + const std::string &getGroupByName() const { return m_groupByName; } protected: @@ -104,7 +104,7 @@ class DECL_EXPORT SchemaValue std::string m_valueLimitRuleType; std::string m_valueLimitRuleData; std::string m_requiredIf; - std::string m_group; + std::string m_groupByName; // DON'T FORGET IF DATA ADDED, IT MAY MAY TO BE COPIED IN THE COPY CONSTRUCTOR!! struct { diff --git a/configuration/config2/XSDSchemaParser.cpp b/configuration/config2/XSDSchemaParser.cpp index f0d03afc4ed..191bd8558ce 100644 --- a/configuration/config2/XSDSchemaParser.cpp +++ b/configuration/config2/XSDSchemaParser.cpp @@ -197,10 +197,11 @@ void XSDSchemaParser::parseSimpleType(const pt::ptree &typeTree) } -void XSDSchemaParser::parseAttribute(const pt::ptree &attr) +std::shared_ptr XSDSchemaParser::parseAttribute(const pt::ptree &attr) { std::shared_ptr pCfgValue = getSchemaValue(attr); m_pSchemaItem->addAttribute(pCfgValue); + return pCfgValue; } @@ -215,6 +216,8 @@ void XSDSchemaParser::parseAttributeGroup(const pt::ptree &attributeTree) { std::shared_ptr pValueSet = std::make_shared(groupName, "valueset", m_pSchemaItem); std::shared_ptr pXSDValueSetParaser = std::make_shared(pValueSet); + std::string groupByName = getXSDAttributeValue(attributeTree, ".groupByName", false, ""); + pXSDValueSetParaser->setGroupByName(groupByName); pXSDValueSetParaser->parseXSD(attributeTree.get_child("", pt::ptree())); m_pSchemaItem->addSchemaType(pValueSet, groupName); } @@ -231,6 +234,14 @@ void XSDSchemaParser::parseAttributeGroup(const pt::ptree &attributeTree) { std::vector> attributes; pValueSet->getAttributes(attributes); + std::string groupByName = getXSDAttributeValue(attributeTree, ".groupByName", false, ""); + if (!groupByName.empty()) + { + for (auto &attr: attributes) + { + attr->setGroupByName(groupByName); + } + } m_pSchemaItem->addAttribute(attributes); // diff --git a/configuration/config2/XSDSchemaParser.hpp b/configuration/config2/XSDSchemaParser.hpp index f93326093ba..2d74c7e0d7a 100644 --- a/configuration/config2/XSDSchemaParser.hpp +++ b/configuration/config2/XSDSchemaParser.hpp @@ -48,7 +48,7 @@ class XSDSchemaParser : public SchemaParser virtual void parseXSD(const std::string &filename); virtual std::string getXSDAttributeValue(const pt::ptree &tree, const std::string &attriName, bool throwIfNotPresent=true, const std::string &defaultVal = (std::string(""))) const; virtual void parseAttributeGroup(const pt::ptree &attributeTree); - virtual void parseAttribute(const pt::ptree &attr); + virtual std::shared_ptr parseAttribute(const pt::ptree &attr); virtual void parseSimpleType(const pt::ptree &typeTree); virtual void parseComplexType(const pt::ptree &typeTree); diff --git a/configuration/config2/XSDValueSetParser.cpp b/configuration/config2/XSDValueSetParser.cpp index b94faa3796b..0258308a1db 100644 --- a/configuration/config2/XSDValueSetParser.cpp +++ b/configuration/config2/XSDValueSetParser.cpp @@ -25,28 +25,10 @@ void XSDValueSetParser::parseXSD(const pt::ptree &valueSetTree) for (auto it = valueSetTree.begin(); it != valueSetTree.end(); ++it) { // - // Element parent (a type in realilty) and the element name help figure out how to process the XSD schema element - std::string elemType = it->first; - if (it->first == "xs:attributeGroup") + // Only handle attributes + if (it->first == "xs:attribute") { - parseAttributeGroup(it->second); + parseAttribute(it->second)->setGroupByName(m_groupByName); } - else if (it->first == "xs:attribute") - { - parseAttribute(it->second); - } - } -} - - -void XSDValueSetParser::parseAttributeGroup(const pt::ptree &attributeTree) -{ - std::string groupRefName = getXSDAttributeValue(attributeTree, ".ref"); - std::shared_ptr pValueSet = m_pSchemaItem->getSchemaType(groupRefName, true); - if (pValueSet) - { - std::vector> attributes; - pValueSet->getAttributes(attributes); - m_pSchemaItem->addAttribute(attributes); } } diff --git a/configuration/config2/XSDValueSetParser.hpp b/configuration/config2/XSDValueSetParser.hpp index 1407b1572cb..9af3ea1cfbd 100644 --- a/configuration/config2/XSDValueSetParser.hpp +++ b/configuration/config2/XSDValueSetParser.hpp @@ -37,11 +37,17 @@ class XSDValueSetParser : public XSDSchemaParser virtual ~XSDValueSetParser() { } virtual void parseXSD(const pt::ptree &valueSetTree); void parseAttributeGroup(const pt::ptree &attributeTree); + void setGroupByName(const std::string &name) { m_groupByName = name; } protected: XSDValueSetParser() { } + + + protected: + + std::string m_groupByName; }; diff --git a/esp/services/ws_config2/ws_config2Service.cpp b/esp/services/ws_config2/ws_config2Service.cpp index b13049b195f..1c2cd55e64e 100644 --- a/esp/services/ws_config2/ws_config2Service.cpp +++ b/esp/services/ws_config2/ws_config2Service.cpp @@ -804,7 +804,7 @@ void Cws_config2Ex::getAttributes(const std::shared_ptr &pEnvNo pAttribute->setReadOnly(pSchemaValue->isReadOnly()); pAttribute->setHidden(pSchemaValue->isHidden()); pAttribute->setDeprecated(pSchemaValue->isDeprecated()); - std::string groupName = pSchemaValue->getGroup(); + std::string groupName = pSchemaValue->getGroupByName(); pAttribute->setGroup(groupName.empty() ? "Attributes" : groupName.c_str()); // diff --git a/initfiles/componentfiles/configschema/xsd/dafilesrv.xsd b/initfiles/componentfiles/configschema/xsd/dafilesrv.xsd index 57f9ea20b0c..ad7362ccd40 100644 --- a/initfiles/componentfiles/configschema/xsd/dafilesrv.xsd +++ b/initfiles/componentfiles/configschema/xsd/dafilesrv.xsd @@ -10,7 +10,7 @@ - + Describes an DFUFileSrv installation diff --git a/initfiles/componentfiles/configschema/xsd/eclagent.xsd b/initfiles/componentfiles/configschema/xsd/eclagent.xsd index 48b2238e18e..230a851cec8 100644 --- a/initfiles/componentfiles/configschema/xsd/eclagent.xsd +++ b/initfiles/componentfiles/configschema/xsd/eclagent.xsd @@ -4,23 +4,23 @@ xmlns:hpcc="someuri"> - - - - - - - - - < - Shoud this be an enumerated list, or a range say 0-10 - - + + + + + + + + + < - Shoud this be an enumerated list, or a range say 0-10 + + - + @@ -31,7 +31,7 @@ - + diff --git a/initfiles/componentfiles/configschema/xsd/esp.xsd b/initfiles/componentfiles/configschema/xsd/esp.xsd index 498cd525dac..8780743d989 100644 --- a/initfiles/componentfiles/configschema/xsd/esp.xsd +++ b/initfiles/componentfiles/configschema/xsd/esp.xsd @@ -12,10 +12,10 @@ - + - + @@ -34,7 +34,7 @@ - + @@ -49,13 +49,12 @@ - + - @@ -82,7 +81,7 @@ - + @@ -120,7 +119,7 @@ - + @@ -152,7 +151,15 @@ - + + + + + + + + @@ -180,8 +187,8 @@ - + @@ -192,31 +199,6 @@ - - diff --git a/initfiles/componentfiles/configschema/xsd/esp_service_smc.xsd b/initfiles/componentfiles/configschema/xsd/esp_service_smc.xsd index 6e6248c9ae3..04dc445375a 100644 --- a/initfiles/componentfiles/configschema/xsd/esp_service_smc.xsd +++ b/initfiles/componentfiles/configschema/xsd/esp_service_smc.xsd @@ -5,15 +5,15 @@ - - - - - - + + + + + + - + @@ -155,7 +155,7 @@ - + diff --git a/initfiles/componentfiles/configschema/xsd/hardware.xsd b/initfiles/componentfiles/configschema/xsd/hardware.xsd index 2858952eb3f..13ae9c9b2be 100644 --- a/initfiles/componentfiles/configschema/xsd/hardware.xsd +++ b/initfiles/componentfiles/configschema/xsd/hardware.xsd @@ -1,51 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - + xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" + xmlns:hpcc="someuri"> + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - - - + + + + diff --git a/initfiles/componentfiles/configschema/xsd/roxie.xsd b/initfiles/componentfiles/configschema/xsd/roxie.xsd index 5f59efcca15..d3528a5ce3a 100644 --- a/initfiles/componentfiles/configschema/xsd/roxie.xsd +++ b/initfiles/componentfiles/configschema/xsd/roxie.xsd @@ -21,6 +21,208 @@ xmlns:hpcc="someuri"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /Environment/Software/SiteCertificate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -113,202 +315,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /Environment/Software/SiteCertificate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/initfiles/componentfiles/configschema/xsd/types.xsd b/initfiles/componentfiles/configschema/xsd/types.xsd index 120ea441d25..9fcccd40274 100644 --- a/initfiles/componentfiles/configschema/xsd/types.xsd +++ b/initfiles/componentfiles/configschema/xsd/types.xsd @@ -67,16 +67,16 @@ - - - + @@ -86,12 +86,12 @@ - - + + - + @@ -100,19 +100,19 @@ - - - + + + - + - + @@ -121,7 +121,7 @@ - + @@ -172,7 +172,7 @@ - +