Bläddra i källkod

HPCC-20577 Initial BackupNodes XSD

Add BackupNodes XSD in new format

Signed-off-by: Ken Rowland <kenneth.rowland@lexisnexisrisk.com>
Ken Rowland 6 år sedan
förälder
incheckning
b4cbc85c3c

+ 11 - 1
configuration/config2/XSDSchemaParser.cpp

@@ -359,7 +359,17 @@ void XSDSchemaParser::parseElement(const pt::ptree &elemTree)
     std::string insertLimitData = elemTree.get("<xmlattr>.hpcc:insertLimitData", "");
     unsigned minOccurs = elemTree.get<unsigned>("<xmlattr>.minOccurs", 1);
     std::string maxOccursStr = elemTree.get("<xmlattr>.maxOccurs", "1");
-    unsigned maxOccurs = (maxOccursStr != "unbounded") ? stoi(maxOccursStr) : UINT_MAX;
+    unsigned maxOccurs;
+
+    try
+    {
+        maxOccurs = (maxOccursStr != "unbounded") ? stoi(maxOccursStr) : UINT_MAX;
+    }
+    catch(...)
+    {
+        std::string msg = "Invalid maxOccurs value: '" + maxOccursStr + "', Unable to convert to a number in element = '" + elementName;
+        throw(ParseException(msg));
+    }
 
     if (category == "root")
     {

+ 48 - 0
initfiles/componentfiles/configschema/xsd/backupnode.xsd

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+################################################################################
+#    HPCC SYSTEMS software Copyright (C) 2018 HPCC Systems®.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+################################################################################
+-->
+
+<xs:schema
+        xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"
+        xmlns:hpcc="someuri">
+    <xs:include schemaLocation="types.xsd"/>
+    <hpcc:insert hpcc:schemaPath="/Environment/Software">
+        <xs:element name="BackupNodeProcess" hpcc:displayName="Backup Node Process" hpcc:itemType="backupnode" minOccurs="0" maxOccurs="unbounded" hpcc:class="component">
+            <xs:complexType>
+                <xs:sequence>
+                    <xs:element name="Instance" maxOccurs="unbounded" hpcc:class="elementSet" hpcc:displayName="Instances" hpcc:requiredInstanceComponents="/Evnironment/Software/[#itemType='dafilesrv']">
+                        <xs:complexType>
+                            <xs:attributeGroup ref="computerNodeReference"/>
+                            <xs:attribute name="directory" type="xs:string" use="optional" hpcc:presetValue="c$\backupnode" hpcc:hidden="true"/>
+                        </xs:complexType>
+                    </xs:element>
+                    <xs:element name="NodeGroup" hpcc:displayName="Thor Node Groups" hpcc:class="elementSet" maxOccurs="unbounded">
+                        <xs:complexType>
+                            <xs:attribute name="name" hpcc:displayName="nodeGroup" type="xs:string" use="required"  hpcc:sourceKey="thornode_name" hpcc:tooltip="Thor node group to backup"/>
+                            <xs:attribute name="interval" hpcc:displayName="Interval (hrs)" type="xs:nonNegativeInteger" hpcc:presetValue="24" hpcc:tooltip="Interval in hours for backup to be run"/>
+                        </xs:complexType>
+                    </xs:element>
+                </xs:sequence>
+                <xs:attributeGroup ref="buildInfo"/>
+                <xs:attribute name="name" type="xs:string" use="required" hpcc:displayName="Name" hpcc:autoGenerateType="prefix_" hpcc:autoGenerateValue="mybackupnode"
+                              hpcc:uniqueKey="backupnodeprocess_name" hpcc:tooltip="Name for this backup node process"/>
+                <xs:attribute name="description" type="xs:string" hpcc:displayName="Description" hpcc:presetValue="BackupNode process" hpcc:tooltip="Description for this process"/>
+            </xs:complexType>
+        </xs:element>
+    </hpcc:insert>
+</xs:schema>

+ 34 - 0
initfiles/componentfiles/configschema/xsd/thor.xsd

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+#    HPCC SYSTEMS software Copyright (C) 2018 HPCC Systems®.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+-->
+
+<xs:schema
+        xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"
+        xmlns:hpcc="someuri">
+    <xs:include schemaLocation="types.xsd"/>
+    <hpcc:insert hpcc:schemaPath="/Environment/Software">
+        <xs:element name="ThorCluster" hpcc:displayName="Thor Cluster" hpcc:itemType="" minOccurs="0" maxOccurs="unbounded" hpcc:class="component">
+            <xs:complexType>
+                <xs:sequence>
+                </xs:sequence>
+                <xs:attributeGroup ref="buildInfo"/>
+                <xs:attribute name="name" type="xs:string" use="required" hpcc:displayName="Name" hpcc:autoGenerateType="prefix_" hpcc:autoGenerateValue="mythor"
+                              hpcc:uniqueKey="thornode_name" hpcc:tooltip="Name for this thor node process"/>
+                <xs:attribute name="description" type="xs:string" hpcc:displayName="Description" hpcc:presetValue="Thor process" hpcc:tooltip="Description for this process"/>
+            </xs:complexType>
+        </xs:element>
+    </hpcc:insert>
+</xs:schema>