org.modeshape.sequencer.ddl
Interface DdlParser

All Known Implementing Classes:
Db2DdlParser, DerbyDdlParser, MySqlDdlParser, OracleDdlParser, PostgresDdlParser, SqlServerDdlParser, StandardDdlParser, SybaseDdlParser

public interface DdlParser

Interface for parsing DDL files.


Method Summary
 String getId()
          Get the identifier for this parser.
 void parse(String ddl, AstNode rootNode, Object scoreReturnObject)
          Parses a DDL string, adding child AstNodes and properties to 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 AstNodes 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


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