org.modeshape.sequencer.ddl

## Interface DdlParser

- All Known Implementing Classes:
    DerbyDdlParser, MySqlDdlParser, OracleDdlParser, PostgresDdlParser, StandardDdlParser, TeiidDdlParser

      public interface DdlParser

  Interface for parsing DDL files.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getId()` Get the identifier for this parser.
    `void` | `parse(String ddl, AstNode rootNode, Object scoreReturnObject)` Parses a DDL string, adding child `AstNode`s and properties to the supplied root.
    `void` | `postProcess(AstNode rootNode)` Allows parsers to post process the `AstNode` tree given the supplied root.
    `Object` | `score(String ddl, String fileName, DdlParserScorer scorer)` Determine this parser's score for the given DDL string.

- - ### Method Detail

    - #### score

          Object score(String ddl,
                     String fileName,
                     DdlParserScorer scorer)
                       throws ParsingException

      Determine this parser's score for the given DDL string. This method is called to determine how well this parser handles the supplied DDL, and is often called before the `parse(String, AstNode, Object)` method.
      Parameters:
        `ddl` - the input string to parse; may not be null
        `fileName` - the name of the DDL content, which may be used to improve the score; may be null if not known
        `scorer` - the scorer that should be used to record the score; may not be null
      Returns:
        an object that will be passed to the `parse(String, AstNode,Object)` method
      Throws:
        `ParsingException` - if there is an error parsing the supplied DDL content

    - #### parse

          void parse(String ddl,
                   AstNode rootNode,
                   Object scoreReturnObject)
                     throws ParsingException

      Parses a DDL string, adding child `AstNode`s and properties to the supplied root. This method instantiates the tokenizer, calls a method to allow subclasses to register keywords and statement start phrases with the tokenizer and finally performs the tokenizing (i.e. tokens.start()) before calling the actual parse method.
      Parameters:
        `ddl` - the input string to parse; may not be null
        `rootNode` - the top level `AstNode`; may not be null
        `scoreReturnObject` - the object returned from `score(String, String, DdlParserScorer)` for the same DDL content; may be null if the `score(String, String, DdlParserScorer)` method was not called
      Throws:
        `ParsingException` - if there is an error parsing the supplied DDL content

    - #### getId

          String getId()

      Get the identifier for this parser.
      Returns:
        the parser's identifier; never null

    - #### postProcess

          void postProcess(AstNode rootNode)

      Allows parsers to post process the `AstNode` tree given the supplied root. Initial use-case would be to allow a second pass through the tree to resolve any table references (FK's) that were defined out of order in the DDL
      Parameters:
        `rootNode` - the top level `AstNode`; may not be null

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.