You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/10/27 09:15:02 UTC
[shardingsphere] branch master updated: Refactor
SQLParserConfiguration.getSQLVisitorFacadeClasses (#7932)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new f8c4479 Refactor SQLParserConfiguration.getSQLVisitorFacadeClasses (#7932)
f8c4479 is described below
commit f8c44796ebd86f74326d013af6cbe0b403ffcba5
Author: Liang Zhang <te...@163.com>
AuthorDate: Tue Oct 27 17:14:44 2020 +0800
Refactor SQLParserConfiguration.getSQLVisitorFacadeClasses (#7932)
* Add SQLVisitorFacade.getType
* Refactor SQLParserConfiguration.getSQLVisitorFacadeClasses
* Remove useless SQLVisitorFacadeFactory
* Remove SQLVisitorType
---
.../sql/parser/mysql/MySQLParserConfiguration.java | 15 ++++++---
.../visitor/MySQLSQLVisitorFacadeFactory.java | 38 ---------------------
.../format/facade/MySQLFormatSQLVisitorFacade.java | 5 +++
.../facade/MySQLStatementSQLVisitorFacade.java | 5 +++
.../parser/oracle/OracleParserConfiguration.java | 15 ++++++---
.../visitor/OracleSQLVisitorFacadeFactory.java | 37 --------------------
.../facade/OracleFormatSQLVisitorFacade.java | 5 +++
.../facade/OracleStatementSQLVisitorFacade.java | 5 +++
.../postgresql/PostgreSQLParserConfiguration.java | 15 ++++++---
.../visitor/PostgreSQLSQLVisitorFacadeFactory.java | 38 ---------------------
.../facade/PostgreSQLFormatSQLVisitorFacade.java | 5 +++
.../PostgreSQLStatementSQLVisitorFacade.java | 5 +++
.../sql/parser/sql92/SQL92ParserConfiguration.java | 15 ++++++---
.../visitor/SQL92SQLVisitorFacadeFactory.java | 39 ----------------------
.../format/facade/SQL92FormatSQLVisitorFacade.java | 5 +++
.../facade/SQL92StatementSQLVisitorFacade.java | 5 +++
.../sqlserver/SQLServerParserConfiguration.java | 15 ++++++---
.../visitor/SQLServerSQLVisitorFacadeFactory.java | 39 ----------------------
.../facade/SQLServerFormatSQLVisitorFacade.java | 5 +++
.../facade/SQLServerStatementSQLVisitorFacade.java | 5 +++
.../core/visitor/SQLFormatVisitorFactory.java | 4 +--
.../core/visitor/SQLStatementVisitorFactory.java | 4 +--
.../sql/parser/api/visitor/SQLVisitorFacade.java | 7 ++++
.../api/visitor/SQLVisitorFacadeFactory.java | 38 ---------------------
.../sql/parser/api/visitor/SQLVisitorType.java | 26 ---------------
.../sql/parser/spi/SQLParserConfiguration.java | 10 +++---
26 files changed, 120 insertions(+), 285 deletions(-)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserConfiguration.java
index 9d12f05..ed14844 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/MySQLParserConfiguration.java
@@ -19,12 +19,16 @@ package org.apache.shardingsphere.sql.parser.mysql;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.mysql.lexer.MySQLLexer;
import org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser;
-import org.apache.shardingsphere.sql.parser.mysql.visitor.MySQLSQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.mysql.visitor.format.facade.MySQLFormatSQLVisitorFacade;
+import org.apache.shardingsphere.sql.parser.mysql.visitor.statement.facade.MySQLStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* SQL parser configuration for MySQL.
*/
@@ -46,7 +50,10 @@ public final class MySQLParserConfiguration implements SQLParserConfiguration {
}
@Override
- public Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass() {
- return MySQLSQLVisitorFacadeFactory.class;
+ public Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses() {
+ Map<String, Class<? extends SQLVisitorFacade>> result = new HashMap<>(2, 1);
+ result.put("STATEMENT", MySQLStatementSQLVisitorFacade.class);
+ result.put("FORMAT", MySQLFormatSQLVisitorFacade.class);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLSQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLSQLVisitorFacadeFactory.java
deleted file mode 100644
index 8be9879..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/MySQLSQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.mysql.visitor;
-
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.mysql.visitor.format.facade.MySQLFormatSQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.mysql.visitor.statement.facade.MySQLStatementSQLVisitorFacade;
-
-/**
- * MySQL SQL visitor facade engine.
- */
-public final class MySQLSQLVisitorFacadeFactory implements SQLVisitorFacadeFactory {
-
- @Override
- public Class<MySQLStatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
- return MySQLStatementSQLVisitorFacade.class;
- }
-
- @Override
- public Class<MySQLFormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
- return MySQLFormatSQLVisitorFacade.class;
- }
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/facade/MySQLFormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/facade/MySQLFormatSQLVisitorFacade.java
index bea2f70..ba65f69 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/facade/MySQLFormatSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/facade/MySQLFormatSQLVisitorFacade.java
@@ -65,4 +65,9 @@ public final class MySQLFormatSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return MySQLRLFormatSQLVisitor.class;
}
+
+ @Override
+ public String getType() {
+ return "FORMAT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/facade/MySQLStatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/facade/MySQLStatementSQLVisitorFacade.java
index dba736d..0adbae6 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/facade/MySQLStatementSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/facade/MySQLStatementSQLVisitorFacade.java
@@ -65,4 +65,9 @@ public final class MySQLStatementSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return MySQLRLStatementSQLVisitor.class;
}
+
+ @Override
+ public String getType() {
+ return "STATEMENT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserConfiguration.java
index ba89982..621c45d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/OracleParserConfiguration.java
@@ -19,12 +19,16 @@ package org.apache.shardingsphere.sql.parser.oracle;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.oracle.lexer.OracleLexer;
import org.apache.shardingsphere.sql.parser.oracle.parser.OracleParser;
-import org.apache.shardingsphere.sql.parser.oracle.visitor.OracleSQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.oracle.visitor.format.facade.OracleFormatSQLVisitorFacade;
+import org.apache.shardingsphere.sql.parser.oracle.visitor.statement.facade.OracleStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* SQL parser configuration for Oracle.
*/
@@ -46,7 +50,10 @@ public final class OracleParserConfiguration implements SQLParserConfiguration {
}
@Override
- public Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass() {
- return OracleSQLVisitorFacadeFactory.class;
+ public Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses() {
+ Map<String, Class<? extends SQLVisitorFacade>> result = new HashMap<>(2, 1);
+ result.put("STATEMENT", OracleStatementSQLVisitorFacade.class);
+ result.put("FORMAT", OracleFormatSQLVisitorFacade.class);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/OracleSQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/OracleSQLVisitorFacadeFactory.java
deleted file mode 100644
index d8443e1..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/OracleSQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.oracle.visitor;
-
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.oracle.visitor.statement.facade.OracleStatementSQLVisitorFacade;
-
-/**
- * Oracle SQL visitor facade engine.
- */
-public final class OracleSQLVisitorFacadeFactory implements SQLVisitorFacadeFactory {
-
- @Override
- public Class<OracleStatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
- return OracleStatementSQLVisitorFacade.class;
- }
-
- @Override
- public Class<OracleStatementSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
- return OracleStatementSQLVisitorFacade.class;
- }
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/format/facade/OracleFormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/format/facade/OracleFormatSQLVisitorFacade.java
index dea71ce..cd3f687 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/format/facade/OracleFormatSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/format/facade/OracleFormatSQLVisitorFacade.java
@@ -59,4 +59,9 @@ public final class OracleFormatSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getType() {
+ return "FORMAT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/facade/OracleStatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/facade/OracleStatementSQLVisitorFacade.java
index 3ca3f13..0eb2be4 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/facade/OracleStatementSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/facade/OracleStatementSQLVisitorFacade.java
@@ -64,4 +64,9 @@ public final class OracleStatementSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return null;
}
+
+ @Override
+ public String getType() {
+ return "STATEMENT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserConfiguration.java
index ea65ec0..db482d3 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/PostgreSQLParserConfiguration.java
@@ -19,12 +19,16 @@ package org.apache.shardingsphere.sql.parser.postgresql;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.postgresql.lexer.PostgreSQLLexer;
import org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser;
-import org.apache.shardingsphere.sql.parser.postgresql.visitor.PostgreSQLSQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.format.facade.PostgreSQLFormatSQLVisitorFacade;
+import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.facade.PostgreSQLStatementSQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* SQL parser configuration for PostgreSQL.
*/
@@ -46,7 +50,10 @@ public final class PostgreSQLParserConfiguration implements SQLParserConfigurati
}
@Override
- public Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass() {
- return PostgreSQLSQLVisitorFacadeFactory.class;
+ public Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses() {
+ Map<String, Class<? extends SQLVisitorFacade>> result = new HashMap<>(2, 1);
+ result.put("STATEMENT", PostgreSQLStatementSQLVisitorFacade.class);
+ result.put("FORMAT", PostgreSQLFormatSQLVisitorFacade.class);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/PostgreSQLSQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/PostgreSQLSQLVisitorFacadeFactory.java
deleted file mode 100644
index 696ca95..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/PostgreSQLSQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.postgresql.visitor;
-
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.postgresql.visitor.format.facade.PostgreSQLFormatSQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.facade.PostgreSQLStatementSQLVisitorFacade;
-
-/**
- * PostgreSQL SQL visitor facade engine.
- */
-public final class PostgreSQLSQLVisitorFacadeFactory implements SQLVisitorFacadeFactory {
-
- @Override
- public Class<PostgreSQLStatementSQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
- return PostgreSQLStatementSQLVisitorFacade.class;
- }
-
- @Override
- public Class<PostgreSQLFormatSQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
- return PostgreSQLFormatSQLVisitorFacade.class;
- }
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/PostgreSQLFormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/PostgreSQLFormatSQLVisitorFacade.java
index 4a077d2..eb3324d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/PostgreSQLFormatSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/format/facade/PostgreSQLFormatSQLVisitorFacade.java
@@ -59,4 +59,9 @@ public final class PostgreSQLFormatSQLVisitorFacade implements SQLVisitorFacade
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getType() {
+ return "FORMAT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/PostgreSQLStatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/PostgreSQLStatementSQLVisitorFacade.java
index 2952bb4..9532c3e 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/PostgreSQLStatementSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/facade/PostgreSQLStatementSQLVisitorFacade.java
@@ -64,4 +64,9 @@ public final class PostgreSQLStatementSQLVisitorFacade implements SQLVisitorFaca
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return null;
}
+
+ @Override
+ public String getType() {
+ return "STATEMENT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserConfiguration.java
index ee42294..be8d31f 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/SQL92ParserConfiguration.java
@@ -19,11 +19,15 @@ package org.apache.shardingsphere.sql.parser.sql92;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sql92.lexer.SQL92Lexer;
import org.apache.shardingsphere.sql.parser.sql92.parser.SQL92Parser;
-import org.apache.shardingsphere.sql.parser.sql92.visitor.SQL92SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.sql92.visitor.format.facade.SQL92FormatSQLVisitorFacade;
+import org.apache.shardingsphere.sql.parser.sql92.visitor.statement.facade.SQL92StatementSQLVisitorFacade;
+
+import java.util.HashMap;
+import java.util.Map;
/**
* SQL parser configuration for SQL92.
@@ -46,7 +50,10 @@ public final class SQL92ParserConfiguration implements SQLParserConfiguration {
}
@Override
- public Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass() {
- return SQL92SQLVisitorFacadeFactory.class;
+ public Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses() {
+ Map<String, Class<? extends SQLVisitorFacade>> result = new HashMap<>(2, 1);
+ result.put("STATEMENT", SQL92StatementSQLVisitorFacade.class);
+ result.put("FORMAT", SQL92FormatSQLVisitorFacade.class);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/SQL92SQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/SQL92SQLVisitorFacadeFactory.java
deleted file mode 100644
index 175c0f6..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/SQL92SQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.sql92.visitor;
-
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.sql92.visitor.format.facade.SQL92FormatSQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.sql92.visitor.statement.facade.SQL92StatementSQLVisitorFacade;
-
-/**
- * SQL92 SQL visitor facade engine.
- */
-public final class SQL92SQLVisitorFacadeFactory implements SQLVisitorFacadeFactory {
-
- @Override
- public Class<? extends SQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
- return SQL92StatementSQLVisitorFacade.class;
- }
-
- @Override
- public Class<? extends SQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
- return SQL92FormatSQLVisitorFacade.class;
- }
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/format/facade/SQL92FormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/format/facade/SQL92FormatSQLVisitorFacade.java
index 80744d2..046b19f 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/format/facade/SQL92FormatSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/format/facade/SQL92FormatSQLVisitorFacade.java
@@ -59,4 +59,9 @@ public final class SQL92FormatSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getType() {
+ return "FORMAT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/facade/SQL92StatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/facade/SQL92StatementSQLVisitorFacade.java
index b4fdf18..1cf6efd 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/facade/SQL92StatementSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/facade/SQL92StatementSQLVisitorFacade.java
@@ -64,4 +64,9 @@ public final class SQL92StatementSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return null;
}
+
+ @Override
+ public String getType() {
+ return "STATEMENT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserConfiguration.java
index 083f786..b64e0db 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/SQLServerParserConfiguration.java
@@ -19,11 +19,15 @@ package org.apache.shardingsphere.sql.parser.sqlserver;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
import org.apache.shardingsphere.sql.parser.spi.SQLParserConfiguration;
import org.apache.shardingsphere.sql.parser.sqlserver.lexer.SQLServerLexer;
import org.apache.shardingsphere.sql.parser.sqlserver.parser.SQLServerParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.sqlserver.visitor.SQLServerSQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.sqlserver.visitor.format.facade.SQLServerFormatSQLVisitorFacade;
+import org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.facade.SQLServerStatementSQLVisitorFacade;
+
+import java.util.HashMap;
+import java.util.Map;
/**
* SQL parser configuration for SQLServer.
@@ -46,7 +50,10 @@ public final class SQLServerParserConfiguration implements SQLParserConfiguratio
}
@Override
- public Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass() {
- return SQLServerSQLVisitorFacadeFactory.class;
+ public Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses() {
+ Map<String, Class<? extends SQLVisitorFacade>> result = new HashMap<>(2, 1);
+ result.put("STATEMENT", SQLServerStatementSQLVisitorFacade.class);
+ result.put("FORMAT", SQLServerFormatSQLVisitorFacade.class);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/SQLServerSQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/SQLServerSQLVisitorFacadeFactory.java
deleted file mode 100644
index 31bb4c8..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/SQLServerSQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.sqlserver.visitor;
-
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
-import org.apache.shardingsphere.sql.parser.sqlserver.visitor.format.facade.SQLServerFormatSQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.facade.SQLServerStatementSQLVisitorFacade;
-
-/**
- * SQLServer SQL visitor facade engine.
- */
-public final class SQLServerSQLVisitorFacadeFactory implements SQLVisitorFacadeFactory {
-
- @Override
- public Class<? extends SQLVisitorFacade> getStatementSQLVisitorFacadeClass() {
- return SQLServerStatementSQLVisitorFacade.class;
- }
-
- @Override
- public Class<? extends SQLVisitorFacade> getFormatSQLVisitorFacadeClass() {
- return SQLServerFormatSQLVisitorFacade.class;
- }
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/format/facade/SQLServerFormatSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/format/facade/SQLServerFormatSQLVisitorFacade.java
index 33dce4b..5524c09 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/format/facade/SQLServerFormatSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/format/facade/SQLServerFormatSQLVisitorFacade.java
@@ -59,4 +59,9 @@ public final class SQLServerFormatSQLVisitorFacade implements SQLVisitorFacade {
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getType() {
+ return "FORMAT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/facade/SQLServerStatementSQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/facade/SQLServerStatementSQLVisitorFacade.java
index 190c249..d869576 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/facade/SQLServerStatementSQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/facade/SQLServerStatementSQLVisitorFacade.java
@@ -64,4 +64,9 @@ public final class SQLServerStatementSQLVisitorFacade implements SQLVisitorFacad
public Class<? extends RLSQLVisitor> getRLVisitorClass() {
return null;
}
+
+ @Override
+ public String getType() {
+ return "STATEMENT";
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLFormatVisitorFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLFormatVisitorFactory.java
index c5e1b42..20aac50 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLFormatVisitorFactory.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLFormatVisitorFactory.java
@@ -22,7 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
import org.apache.shardingsphere.sql.parser.core.SQLParserConfigurationRegistry;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementType;
@@ -46,8 +45,7 @@ public final class SQLFormatVisitorFactory {
@SneakyThrows(ReflectiveOperationException.class)
private static SQLVisitorFacade getSQLVisitorFacadeEngine(final String databaseTypeName) {
- SQLVisitorFacadeFactory facade = SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName).getVisitorFacadeFactoryClass().getConstructor().newInstance();
- return facade.getFormatSQLVisitorFacadeClass().getConstructor().newInstance();
+ return SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName).getSQLVisitorFacadeClasses().get("FORMAT").getConstructor().newInstance();
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLStatementVisitorFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLStatementVisitorFactory.java
index a5101b6..0055d90 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLStatementVisitorFactory.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/visitor/SQLStatementVisitorFactory.java
@@ -22,7 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
import org.apache.shardingsphere.sql.parser.core.SQLParserConfigurationRegistry;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementType;
@@ -46,8 +45,7 @@ public final class SQLStatementVisitorFactory {
@SneakyThrows(ReflectiveOperationException.class)
private static SQLVisitorFacade getSQLVisitorFacadeEngine(final String databaseTypeName) {
- SQLVisitorFacadeFactory facade = SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName).getVisitorFacadeFactoryClass().getConstructor().newInstance();
- return facade.getStatementSQLVisitorFacadeClass().getConstructor().newInstance();
+ return SQLParserConfigurationRegistry.getInstance().getSQLParserConfiguration(databaseTypeName).getSQLVisitorFacadeClasses().get("STATEMENT").getConstructor().newInstance();
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacade.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacade.java
index 86e94ae..d339d7c 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacade.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacade.java
@@ -63,4 +63,11 @@ public interface SQLVisitorFacade {
* @return RL visitor class
*/
Class<? extends SQLVisitor> getRLVisitorClass();
+
+ /**
+ * Get SQL visitor facade type.
+ *
+ * @return SQL visitor facade type
+ */
+ String getType();
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacadeFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacadeFactory.java
deleted file mode 100644
index 541d46d..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorFacadeFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.api.visitor;
-
-/**
- * SQL visitor facade engine.
- */
-public interface SQLVisitorFacadeFactory {
-
- /**
- * Get statement visitor facade class.
- *
- * @return DML visitor class
- */
- Class<? extends SQLVisitorFacade> getStatementSQLVisitorFacadeClass();
-
- /**
- * Get format visitor facade class.
- *
- * @return DDL visitor class
- */
- Class<? extends SQLVisitorFacade> getFormatSQLVisitorFacadeClass();
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorType.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorType.java
deleted file mode 100644
index 5cc459d..0000000
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/api/visitor/SQLVisitorType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sql.parser.api.visitor;
-
-/**
- * SQL visitor type.
- */
-public enum SQLVisitorType {
-
- STATEMENT, FORMAT
-}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/spi/SQLParserConfiguration.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/spi/SQLParserConfiguration.java
index bbf93ad..cb439ba 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/spi/SQLParserConfiguration.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-spi/src/main/java/org/apache/shardingsphere/sql/parser/spi/SQLParserConfiguration.java
@@ -19,7 +19,9 @@ package org.apache.shardingsphere.sql.parser.spi;
import org.apache.shardingsphere.sql.parser.api.lexer.SQLLexer;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacadeFactory;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitorFacade;
+
+import java.util.Map;
/**
* SQL parser configuration.
@@ -48,9 +50,9 @@ public interface SQLParserConfiguration {
Class<? extends SQLParser> getParserClass();
/**
- * Get SQL visitor facade factory class.
+ * Get SQL visitor facade classes.
*
- * @return SQL visitor facade factory class
+ * @return SQL visitor facade classes
*/
- Class<? extends SQLVisitorFacadeFactory> getVisitorFacadeFactoryClass();
+ Map<String, Class<? extends SQLVisitorFacade>> getSQLVisitorFacadeClasses();
}