Skip to content

Commit

Permalink
Initial commit, will change
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrowland committed Aug 2, 2018
1 parent 294056c commit 812e61d
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 327 deletions.
2 changes: 1 addition & 1 deletion configuration/config2/SchemaValue.cpp
Expand Up @@ -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<std::shared_ptr<SchemaValue>> m_mirrorToSchemaValues;
Expand Down
6 changes: 3 additions & 3 deletions configuration/config2/SchemaValue.hpp
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down
13 changes: 12 additions & 1 deletion configuration/config2/XSDSchemaParser.cpp
Expand Up @@ -197,10 +197,11 @@ void XSDSchemaParser::parseSimpleType(const pt::ptree &typeTree)
}


void XSDSchemaParser::parseAttribute(const pt::ptree &attr)
std::shared_ptr<SchemaValue> XSDSchemaParser::parseAttribute(const pt::ptree &attr)
{
std::shared_ptr<SchemaValue> pCfgValue = getSchemaValue(attr);
m_pSchemaItem->addAttribute(pCfgValue);
return pCfgValue;
}


Expand All @@ -215,6 +216,8 @@ void XSDSchemaParser::parseAttributeGroup(const pt::ptree &attributeTree)
{
std::shared_ptr<SchemaItem> pValueSet = std::make_shared<SchemaItem>(groupName, "valueset", m_pSchemaItem);
std::shared_ptr<XSDValueSetParser> pXSDValueSetParaser = std::make_shared<XSDValueSetParser>(pValueSet);
std::string groupByName = getXSDAttributeValue(attributeTree, "<xmlattr>.groupByName", false, "");
pXSDValueSetParaser->setGroupByName(groupByName);
pXSDValueSetParaser->parseXSD(attributeTree.get_child("", pt::ptree()));
m_pSchemaItem->addSchemaType(pValueSet, groupName);
}
Expand All @@ -231,6 +234,14 @@ void XSDSchemaParser::parseAttributeGroup(const pt::ptree &attributeTree)
{
std::vector<std::shared_ptr<SchemaValue>> attributes;
pValueSet->getAttributes(attributes);
std::string groupByName = getXSDAttributeValue(attributeTree, "<xmlattr>.groupByName", false, "");
if (!groupByName.empty())
{
for (auto &attr: attributes)
{
attr->setGroupByName(groupByName);
}
}
m_pSchemaItem->addAttribute(attributes);

//
Expand Down
2 changes: 1 addition & 1 deletion configuration/config2/XSDSchemaParser.hpp
Expand Up @@ -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<SchemaValue> parseAttribute(const pt::ptree &attr);

virtual void parseSimpleType(const pt::ptree &typeTree);
virtual void parseComplexType(const pt::ptree &typeTree);
Expand Down
24 changes: 3 additions & 21 deletions configuration/config2/XSDValueSetParser.cpp
Expand Up @@ -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, "<xmlattr>.ref");
std::shared_ptr<SchemaItem> pValueSet = m_pSchemaItem->getSchemaType(groupRefName, true);
if (pValueSet)
{
std::vector<std::shared_ptr<SchemaValue>> attributes;
pValueSet->getAttributes(attributes);
m_pSchemaItem->addAttribute(attributes);
}
}
6 changes: 6 additions & 0 deletions configuration/config2/XSDValueSetParser.hpp
Expand Up @@ -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;
};


Expand Down
2 changes: 1 addition & 1 deletion esp/services/ws_config2/ws_config2Service.cpp
Expand Up @@ -804,7 +804,7 @@ void Cws_config2Ex::getAttributes(const std::shared_ptr<EnvironmentNode> &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());

//
Expand Down
2 changes: 1 addition & 1 deletion initfiles/componentfiles/configschema/xsd/dafilesrv.xsd
Expand Up @@ -10,7 +10,7 @@
<xs:attribute name="throttleCPULimit" type="xs:nonNegativeInteger" use="optional" default="75" hpcc:tooltip="if after the initial delay, the CPU % falls below this setting, the transaction will be allowed to continue, i.e. the limit can be exceeded this way. Overrides global settting."/>
</xs:attributeGroup>
<xs:sequence>
<xs:element name="DafilesrvProcess" hpcc:itemTye="dafilesrv" hpcc:class="valueSet" hpcc:docid="daFs.t">
<xs:element name="DafilesrvProcess" hpcc:itemType="dafilesrv" hpcc:class="valueSet" hpcc:docid="daFs.t">
<xs:annotation>
<xs:documentation>Describes an DFUFileSrv installation</xs:documentation>
</xs:annotation>
Expand Down
26 changes: 13 additions & 13 deletions initfiles/componentfiles/configschema/xsd/eclagent.xsd
Expand Up @@ -4,23 +4,23 @@
xmlns:hpcc="someuri">
<xs:include schemaLocation="types.xsd"/>
<xs:complexType name="eclAgent">
<xs:attributeGroup name="Options" hpcc:docid="EA.t2">
<xs:attribute name="allowedPipePrograms" hpcc:displayName="Allowed Pipe Programs" hpcc:group="Options" type="xs:string" use="optional" default="*" hpcc:tab="Eclagent" hpcc:tooltip="Comma separated list of allowed PIPE programs (* for allow all)"/>
<xs:attribute name="daliServers" hpcc:displayName="Dali Servers" hpcc:group="Options" type="xs:string" use="required" hpcc:tooltip="Specifies the dali server to which this eclagent is attached"/>
<xs:attribute name="defaultMemoryLimitMB" hpcc:displayName="Default Memory Limit (MB)" hpcc:group="Options" type="xs:nonNegativeInteger" use="optional" default="300" hpcc:tooltip="Default memory limit in MB for eclagent"/>
<xs:attribute name="heapUseHugePages" hpcc:displayName="Heap Use Huge Pages" hpcc:group="Options" type="xs:boolean" default="false" hpcc:tooltip="Use memory from huge pages if they have been configured"/>
<xs:attribute name="heapUseTransparentHugePages" hpcc:displayName="Heam Use Transparent Huge Pages" hpcc:group="Options" type="xs:boolean" default="true" hpcc:tooltip="Use memory from transparent huge pages"/>
<xs:attribute name="heapRetainMemory" hpcc:displayName="Heap Retain Memory" hpcc:group="Options" type="xs:boolean" default="false" hpcc:tooltip="Retain and do not return unused memory to the operating system"/>
<xs:attribute name="pluginDirectory" hpcc:displayName="Plugin Directory" hpcc:group="Options" type="absolutePath" use="optional" default="/opt/HPCCSystems/plugins/" hpcc:tooltip="Directory where plugins are located"/>
<xs:attribute name="traceLevel" hpcc:displayName="Trace Level" hpcc:group="Options" type="xs:nonNegativeInteger" use="optional" default="0" hpcc:tooltip="Trace level"/> < - Shoud this be an enumerated list, or a range say 0-10
<xs:attribute name="thorConnectTimeout" hpcc:displayName="Thor Connect Timeout" hpcc:group="Options" type="xs:nonNegativeInteger" use="optional" default="600" hpcc:tooltip="Default connection timeout when sending query to Thor"/>
<xs:attribute name="wuQueueName" hpcc:displayName="Workunit Queue Name" hpcc:group="Options" type="xs:string" use="optional" default="" hpcc:tooltip="eclAgent Workunit Execution Queue Name" hpcc:autogenforwizard="true" hpcc:autogensuffix="_queue"/> <!-- is this keyed? do we need new auto name option for suffix -->
<xs:attributeGroup name="options" hpcc:groupByName="Options" hpcc:docid="EA.t2">
<xs:attribute name="allowedPipePrograms" hpcc:displayName="Allowed Pipe Programs" type="xs:string" use="optional" default="*" hpcc:tab="Eclagent" hpcc:tooltip="Comma separated list of allowed PIPE programs (* for allow all)"/>
<xs:attribute name="daliServers" hpcc:displayName="Dali Servers" type="xs:string" use="required" hpcc:tooltip="Specifies the dali server to which this eclagent is attached"/>
<xs:attribute name="defaultMemoryLimitMB" hpcc:displayName="Default Memory Limit (MB)" type="xs:nonNegativeInteger" use="optional" default="300" hpcc:tooltip="Default memory limit in MB for eclagent"/>
<xs:attribute name="heapUseHugePages" hpcc:displayName="Heap Use Huge Pages" type="xs:boolean" default="false" hpcc:tooltip="Use memory from huge pages if they have been configured"/>
<xs:attribute name="heapUseTransparentHugePages" hpcc:displayName="Heam Use Transparent Huge Pages" type="xs:boolean" default="true" hpcc:tooltip="Use memory from transparent huge pages"/>
<xs:attribute name="heapRetainMemory" hpcc:displayName="Heap Retain Memory" type="xs:boolean" default="false" hpcc:tooltip="Retain and do not return unused memory to the operating system"/>
<xs:attribute name="pluginDirectory" hpcc:displayName="Plugin Directory" type="absolutePath" use="optional" default="/opt/HPCCSystems/plugins/" hpcc:tooltip="Directory where plugins are located"/>
<xs:attribute name="traceLevel" hpcc:displayName="Trace Level" type="xs:nonNegativeInteger" use="optional" default="0" hpcc:tooltip="Trace level"/> < - Shoud this be an enumerated list, or a range say 0-10
<xs:attribute name="thorConnectTimeout" hpcc:displayName="Thor Connect Timeout" type="xs:nonNegativeInteger" use="optional" default="600" hpcc:tooltip="Default connection timeout when sending query to Thor"/>
<xs:attribute name="wuQueueName" hpcc:displayName="Workunit Queue Name" type="xs:string" use="optional" default="" hpcc:tooltip="eclAgent Workunit Execution Queue Name" hpcc:autogenforwizard="true" hpcc:autogensuffix="_queue"/> <!-- is this keyed? do we need new auto name option for suffix -->
</xs:attributeGroup>
<xs:sequence>
<xs:element name="EclAgentProcess" hpcc:class="component" hpcc:itemType="eclAgent" hpcc:displayName="ECL Agent Process" maxOccurs="unbounded" hpcc:docid="EA.t1">
<xs:complexType>
<xs:sequence>
<xs:element name="Instance" maxOccurs="unbounded" hpcc:displayName="Bound Computers">
<xs:element name="Instance" hpcc:itemType = "elementSet" maxOccurs="unbounded" hpcc:displayName="Instances">
<xs:complexType>
<xs:attributeGroup ref="computerNodeReference"/>
<xs:attribute name="directory" type="xs:string" use="optional" default="c$\eclagent" hpcc:hidden="true"/> <!-- hidden doesn't make sense -->
Expand All @@ -31,7 +31,7 @@
<xs:attributeGroup ref="buildInfo"/>
<xs:attribute name="name" type="xs:string" use="required" hpcc:displayName="Name" hpcc:uniqueKey="eclagentprocess_name" hpcc:tooltip="Name for this process"/>
<xs:attribute name="description" type="xs:string" use="optional" hpcc:displayName="Description" default="EclAgent process" hpcc:tooltip="Description for this process"/>
<xs:attributeGroup ref="Options"/>
<xs:attributeGroup ref="options"/>
</xs:complexType>

</xs:element>
Expand Down

0 comments on commit 812e61d

Please sign in to comment.