pirk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIRK-78) Create a new QuerySchema builder to separate from representation
Date Mon, 24 Oct 2016 19:30:58 GMT

    [ https://issues.apache.org/jira/browse/PIRK-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15602959#comment-15602959
] 

ASF GitHub Bot commented on PIRK-78:
------------------------------------

Github user smarthi commented on a diff in the pull request:

    https://github.com/apache/incubator-pirk/pull/112#discussion_r84764924
  
    --- Diff: src/test/java/org/apache/pirk/schema/query/LoadQuerySchemaTest.java ---
    @@ -389,49 +320,42 @@ private void createDataSchema(String schemaFile) throws IOException
         SystemConfiguration.setProperty("data.schemas", file.toString());
     
         // Write to the file
    -    try
    -    {
    -      DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    -      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
    -      Document doc = dBuilder.newDocument();
    -
    -      // root element
    -      Element rootElement = doc.createElement("schema");
    -      doc.appendChild(rootElement);
    -
    -      // Add the schemaName
    -      Element schemaNameElement = doc.createElement("schemaName");
    -      schemaNameElement.appendChild(doc.createTextNode(dataSchemaName));
    -      rootElement.appendChild(schemaNameElement);
    -
    -      // Add the elements
    -      // element1 -- single String
    -      TestUtils.addElement(doc, rootElement, element1, PrimitiveTypePartitioner.STRING,
"false", PrimitiveTypePartitioner.class.getName());
    -
    -      // element2 - -- array of Integers
    -      TestUtils.addElement(doc, rootElement, element2, PrimitiveTypePartitioner.INT,
"true", PrimitiveTypePartitioner.class.getName());
    -
    -      // element3 -- array of IP addresses
    -      TestUtils.addElement(doc, rootElement, element3, PrimitiveTypePartitioner.STRING,
"true", IPDataPartitioner.class.getName());
    -
    -      // element4 -- single byte type
    -      TestUtils.addElement(doc, rootElement, element4, PrimitiveTypePartitioner.BYTE,
"false", PrimitiveTypePartitioner.class.getName());
    -
    -      // Write to a xml file
    -      TransformerFactory transformerFactory = TransformerFactory.newInstance();
    -      Transformer transformer = transformerFactory.newTransformer();
    -      DOMSource source = new DOMSource(doc);
    -      StreamResult result = new StreamResult(file);
    -      transformer.transform(source, result);
    -
    -      // Output for testing
    -      StreamResult consoleResult = new StreamResult(System.out);
    -      transformer.transform(source, consoleResult);
    -      System.out.println();
    -
    -    } catch (Exception e)
    -    {
    -      e.printStackTrace();
    -    }
    +    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
    +    DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
    +    Document doc = dBuilder.newDocument();
    +
    +    // root element
    +    Element rootElement = doc.createElement("schema");
    +    doc.appendChild(rootElement);
    +
    +    // Add the schemaName
    +    Element schemaNameElement = doc.createElement("schemaName");
    +    schemaNameElement.appendChild(doc.createTextNode(dataSchemaName));
    +    rootElement.appendChild(schemaNameElement);
    +
    +    // Add the elements
    +    // element1 -- single String
    +    TestUtils.addElement(doc, rootElement, element1, PrimitiveTypePartitioner.STRING,
"false", PrimitiveTypePartitioner.class.getName());
    +
    +    // element2 - -- array of Integers
    +    TestUtils.addElement(doc, rootElement, element2, PrimitiveTypePartitioner.INT, "true",
PrimitiveTypePartitioner.class.getName());
    +
    +    // element3 -- array of IP addresses
    +    TestUtils.addElement(doc, rootElement, element3, PrimitiveTypePartitioner.STRING,
"true", IPDataPartitioner.class.getName());
    +
    +    // element4 -- single byte type
    +    TestUtils.addElement(doc, rootElement, element4, PrimitiveTypePartitioner.BYTE, "false",
PrimitiveTypePartitioner.class.getName());
    +
    +    // Write to a xml file
    +    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    +    Transformer transformer = transformerFactory.newTransformer();
    +    DOMSource source = new DOMSource(doc);
    +    StreamResult result = new StreamResult(file);
    +    transformer.transform(source, result);
    +
    +    // Output for testing
    +    StreamResult consoleResult = new StreamResult(System.out);
    +    transformer.transform(source, consoleResult);
    +    System.out.println();
    --- End diff --
    
    How about use a Log.Info here instead of System.out.println() ?


> Create a new QuerySchema builder to separate from representation
> ----------------------------------------------------------------
>
>                 Key: PIRK-78
>                 URL: https://issues.apache.org/jira/browse/PIRK-78
>             Project: PIRK
>          Issue Type: Improvement
>            Reporter: Tim Ellison
>
> Presently, Pirk has a QuerySchemaLoader that reads an XML formatted stream and builds
a new QuerySchema.
> In order to separate the representation of the schema in XML from the logic of assembling
a new schema such as validating the values, a new QuerySchemaBuilder is to be introduced.
 The QuerySchemaLoader will then delegate the creation to the new builder, and other representations
can also use the builder to create a new QuerySchema without having to go via XML.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message