pirk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eawilli...@apache.org
Subject incubator-pirk git commit: PIRK-16 -- Define XML schema definition files for Pirk's data and query schemas - closes apache/incubator-pirk#17
Date Thu, 21 Jul 2016 19:22:00 GMT
Repository: incubator-pirk
Updated Branches:
  refs/heads/master 371e53903 -> c312d1f26


PIRK-16 -- Define XML schema definition files for Pirk's data and query schemas - closes apache/incubator-pirk#17


Project: http://git-wip-us.apache.org/repos/asf/incubator-pirk/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-pirk/commit/c312d1f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-pirk/tree/c312d1f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-pirk/diff/c312d1f2

Branch: refs/heads/master
Commit: c312d1f26e629371993dc682a6da1dd07dc63f72
Parents: 371e539
Author: tellison <tellison@apache.org>
Authored: Thu Jul 21 15:21:47 2016 -0400
Committer: eawilliams <eawilliams@apache.org>
Committed: Thu Jul 21 15:21:47 2016 -0400

----------------------------------------------------------------------
 .../pirk/schema/data/LoadDataSchemas.java       | 10 +++-
 .../org/apache/pirk/test/utils/TestUtils.java   |  7 +--
 src/main/resources/data-schema.xsd              | 42 ++++++++++++++++
 src/main/resources/query-schema.xsd             | 50 ++++++++++++++++++++
 4 files changed, 105 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/c312d1f2/src/main/java/org/apache/pirk/schema/data/LoadDataSchemas.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pirk/schema/data/LoadDataSchemas.java b/src/main/java/org/apache/pirk/schema/data/LoadDataSchemas.java
index 8e4c402..5bbe754 100644
--- a/src/main/java/org/apache/pirk/schema/data/LoadDataSchemas.java
+++ b/src/main/java/org/apache/pirk/schema/data/LoadDataSchemas.java
@@ -179,7 +179,15 @@ public class LoadDataSchemas
         // Pull out the attributes
         String name = eElement.getElementsByTagName("name").item(0).getTextContent().trim().toLowerCase();
         String type = eElement.getElementsByTagName("type").item(0).getTextContent().trim();
-        String isArray = eElement.getElementsByTagName("isArray").item(0).getTextContent().trim().toLowerCase();
+
+        // An absent isArray means false, and an empty isArray means true, otherwise take
the value. 
+        String isArray = "false";
+        Node isArrayNode = eElement.getElementsByTagName("isArray").item(0);
+        if (isArrayNode != null)
+        {
+          String isArrayValue = isArrayNode.getTextContent().trim().toLowerCase();
+          isArray = isArrayValue.isEmpty() ? "true" : isArrayValue;
+        }
 
         // Pull and check the partitioner class -- if the partitioner tag doesn't exist,
then
         // it defaults to the PrimitiveTypePartitioner

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/c312d1f2/src/main/java/org/apache/pirk/test/utils/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/pirk/test/utils/TestUtils.java b/src/main/java/org/apache/pirk/test/utils/TestUtils.java
index 26c8fe6..11348cb 100644
--- a/src/main/java/org/apache/pirk/test/utils/TestUtils.java
+++ b/src/main/java/org/apache/pirk/test/utils/TestUtils.java
@@ -111,9 +111,10 @@ public class TestUtils
     type.appendChild(doc.createTextNode(typeIn));
     element.appendChild(type);
 
-    Element isArray = doc.createElement("isArray");
-    isArray.appendChild(doc.createTextNode(isArrayIn));
-    element.appendChild(isArray);
+    if (isArrayIn.equals("true"))
+    {
+      element.appendChild(doc.createElement("isArray"));
+    }
 
     if (partitionerIn != null)
     {

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/c312d1f2/src/main/resources/data-schema.xsd
----------------------------------------------------------------------
diff --git a/src/main/resources/data-schema.xsd b/src/main/resources/data-schema.xsd
new file mode 100644
index 0000000..d49e54e
--- /dev/null
+++ b/src/main/resources/data-schema.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements.  See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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"
+    targetNamespace="http://pirk.apache.org" xmlns="http://pirk.apache.org"
+    elementFormDefault="qualified">
+
+    <xs:element name="schema">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="schemaName" type="xs:string" />
+                <xs:element name="element" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="name" type="xs:string" />
+                            <xs:element name="type" type="xs:string" />
+                            <xs:element name="isArray" type="xs:boolean"
+                                default="true" minOccurs="0" />
+                            <xs:element name="partitioner"
+                                type="xs:string" minOccurs="0" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-pirk/blob/c312d1f2/src/main/resources/query-schema.xsd
----------------------------------------------------------------------
diff --git a/src/main/resources/query-schema.xsd b/src/main/resources/query-schema.xsd
new file mode 100644
index 0000000..a0657e4
--- /dev/null
+++ b/src/main/resources/query-schema.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements.  See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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"
+    targetNamespace="http://pirk.apache.org" xmlns="http://pirk.apache.org"
+    elementFormDefault="qualified">
+
+    <xs:element name="schema">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="schemaName" type="xs:string" />
+                <xs:element name="dataSchemaName" type="xs:string" />
+                <xs:element name="selectorName" type="xs:string" />
+                <xs:element name="elements">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="name" type="xs:string"
+                                maxOccurs="unbounded" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element name="filter" type="xs:string"
+                    minOccurs="0" />
+                <xs:element name="filterNames" minOccurs="0"
+                    maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="name" type="xs:string" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</xs:schema>


Mime
View raw message