Class DrillXSDSchemaVisitor

java.lang.Object
org.apache.drill.exec.store.xml.xsd.DrillXSDSchemaVisitor
All Implemented Interfaces:
org.apache.ws.commons.schema.walker.XmlSchemaVisitor

public class DrillXSDSchemaVisitor extends Object implements org.apache.ws.commons.schema.walker.XmlSchemaVisitor
This class transforms an XSD schema into a Drill Schema.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a TupleMetadata representation of the schema contained in an XSD file.
    void
    onEndAttributes(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo)
    Called for each element decl once all its attributes have been previously processed by onVisitAttribute.
    void
    onEnterAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll)
     
    void
    onEnterChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice)
     
    void
    onEnterElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b)
    Handles global elements establishing a map for the child elements and attributes (if any).
    void
    onEnterSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence)
     
    void
    onEnterSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement)
     
    void
    onExitAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll)
     
    void
    onExitChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice)
     
    void
    onExitElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b)
     
    void
    onExitSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence)
     
    void
    onExitSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement)
     
    void
    onVisitAny(org.apache.ws.commons.schema.XmlSchemaAny xmlSchemaAny)
     
    void
    onVisitAnyAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.XmlSchemaAnyAttribute xmlSchemaAnyAttribute)
     
    void
    onVisitAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaAttrInfo xmlSchemaAttrInfo)
    This method just gathers the elements up into a table.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DrillXSDSchemaVisitor

      public DrillXSDSchemaVisitor(SchemaBuilder builder)
  • Method Details

    • getDrillSchema

      public TupleMetadata getDrillSchema()
      Returns a TupleMetadata representation of the schema contained in an XSD file. This method should only be called after the walk method of XmlSchemaWalker has been called.
      Returns:
      A TupleMetadata representation of the XSD schema.
    • onEnterElement

      public void onEnterElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b)
      Handles global elements establishing a map for the child elements and attributes (if any).

      TBD: Does not handle case where multiple elements have the same name as in:

      
       <element name="a" .../>
       <element name="b" .../>
       <element name="a" .../>
       
      There is also the case where they are ambiguous unless namespaces are used:
      
       <element name="a" .../>
       <element ref="pre:a" .../> <!-- without namespace, ambiguous with prior "a" -->
       
      Specified by:
      onEnterElement in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onExitElement

      public void onExitElement(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo, boolean b)
      Specified by:
      onExitElement in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onVisitAttribute

      public void onVisitAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaAttrInfo xmlSchemaAttrInfo)
      This method just gathers the elements up into a table.
      Specified by:
      onVisitAttribute in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onEndAttributes

      public void onEndAttributes(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.walker.XmlSchemaTypeInfo xmlSchemaTypeInfo)
      Called for each element decl once all its attributes have been previously processed by onVisitAttribute. Constructs the map for the special attributes child element of each element. Note: does not construct an attribute child map if there are no attributes. Only supports attributes with no-namespace on their qnames. Or rather, ignores namespaces. Only deals with local names. TBD: needs to check for attributes with namespaced names and at minimum reject them.
      Specified by:
      onEndAttributes in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onEnterSubstitutionGroup

      public void onEnterSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement)
      Specified by:
      onEnterSubstitutionGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onExitSubstitutionGroup

      public void onExitSubstitutionGroup(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement)
      Specified by:
      onExitSubstitutionGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onEnterAllGroup

      public void onEnterAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll)
      Specified by:
      onEnterAllGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onExitAllGroup

      public void onExitAllGroup(org.apache.ws.commons.schema.XmlSchemaAll xmlSchemaAll)
      Specified by:
      onExitAllGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onEnterChoiceGroup

      public void onEnterChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice)
      Specified by:
      onEnterChoiceGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onExitChoiceGroup

      public void onExitChoiceGroup(org.apache.ws.commons.schema.XmlSchemaChoice xmlSchemaChoice)
      Specified by:
      onExitChoiceGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onEnterSequenceGroup

      public void onEnterSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence)
      Specified by:
      onEnterSequenceGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onExitSequenceGroup

      public void onExitSequenceGroup(org.apache.ws.commons.schema.XmlSchemaSequence xmlSchemaSequence)
      Specified by:
      onExitSequenceGroup in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onVisitAny

      public void onVisitAny(org.apache.ws.commons.schema.XmlSchemaAny xmlSchemaAny)
      Specified by:
      onVisitAny in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor
    • onVisitAnyAttribute

      public void onVisitAnyAttribute(org.apache.ws.commons.schema.XmlSchemaElement xmlSchemaElement, org.apache.ws.commons.schema.XmlSchemaAnyAttribute xmlSchemaAnyAttribute)
      Specified by:
      onVisitAnyAttribute in interface org.apache.ws.commons.schema.walker.XmlSchemaVisitor