"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const globalConstant_1 = require("../constant/globalConstant");
const mysqlParseService_1 = require("./impl/mysql/mysqlParseService");
const symbolTable_1 = require("../symbols/symbolTable");
const oracleParseService_1 = require("./impl/oracle/oracleParseService");
class ParseServiceFactory {
    /**
     * 根据传入的输入上下文，创建所需的ParseService具体实现
     * @param editorContext
     */
    static createParseService(editorContext) {
        let parseService;
        switch (editorContext.dataSourceName) {
            case globalConstant_1.GlobalConstant.DATASOURCE_MYSQL:
                parseService = ParseServiceFactory.createMySQlParseService(editorContext);
                break;
            case globalConstant_1.GlobalConstant.DATASOURCE_TIDB:
                parseService = ParseServiceFactory.createMySQlParseService(editorContext);
                break;
            case globalConstant_1.GlobalConstant.DATASOURCE_SHARDING:
                parseService = ParseServiceFactory.createMySQlParseService(editorContext);
                break;
            case globalConstant_1.GlobalConstant.DATASOURCE_ORACLE:
                parseService = ParseServiceFactory.createOracleParseService(editorContext);
                break;
            default:
                console.log("error:暂时无法识别的数据源类型-" + editorContext.dataSourceName);
                break;
        }
        parseService.editorContext = editorContext;
        parseService.symbolTable = new symbolTable_1.SymbolTable();
        return parseService;
    }
    static createMySQlParseService(editorContext) {
        return new mysqlParseService_1.MysqlParseService();
    }
    static createOracleParseService(editorContext) {
        return new oracleParseService_1.OracleParseService();
    }
}
exports.ParseServiceFactory = ParseServiceFactory;
