diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/ProxyBackendHandlerChecker.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/checker/SQLExecutionChecker.java similarity index 90% rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/ProxyBackendHandlerChecker.java rename to infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/checker/SQLExecutionChecker.java index 24c7a4babf76e..8b3328e76f42d 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/ProxyBackendHandlerChecker.java +++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/checker/SQLExecutionChecker.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.proxy.backend.handler.checker; +package org.apache.shardingsphere.infra.executor.checker; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; @@ -24,13 +24,13 @@ import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; /** - * Proxy backend handler checker. + * SQL execution checker. */ @SingletonSPI -public interface ProxyBackendHandlerChecker { +public interface SQLExecutionChecker { /** - * Check. + * Check before SQL execute. * * @param metaData ShardingSphere meta data * @param grantee grantee diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuthorityProxyBackendHandlerChecker.java b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthoritySQLExecutionChecker.java similarity index 87% rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuthorityProxyBackendHandlerChecker.java rename to kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthoritySQLExecutionChecker.java index 490b7ae413e45..089f431080d78 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuthorityProxyBackendHandlerChecker.java +++ b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthoritySQLExecutionChecker.java @@ -15,21 +15,21 @@ * limitations under the License. */ -package org.apache.shardingsphere.proxy.backend.handler.checker; +package org.apache.shardingsphere.authority.checker; -import org.apache.shardingsphere.authority.checker.AuthorityChecker; import org.apache.shardingsphere.authority.rule.AuthorityRule; import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions; import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.database.UnknownDatabaseException; +import org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.session.query.QueryContext; /** - * Authority proxy backend handler checker. + * Authority SQL execution checker. */ -public final class AuthorityProxyBackendHandlerChecker implements ProxyBackendHandlerChecker { +public final class AuthoritySQLExecutionChecker implements SQLExecutionChecker { @Override public void check(final ShardingSphereMetaData metaData, final Grantee grantee, final QueryContext queryContext, final ShardingSphereDatabase database) { diff --git a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.handler.checker.ProxyBackendHandlerChecker b/kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker similarity index 81% rename from proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.handler.checker.ProxyBackendHandlerChecker rename to kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker index 9d048920821d9..f7c4e2193be1e 100644 --- a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.handler.checker.ProxyBackendHandlerChecker +++ b/kernel/authority/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker @@ -15,5 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.proxy.backend.handler.checker.AuthorityProxyBackendHandlerChecker -org.apache.shardingsphere.proxy.backend.handler.checker.AuditProxyBackendHandlerChecker +org.apache.shardingsphere.authority.checker.AuthoritySQLExecutionChecker diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java index 0eab1fa72e441..4028b6510b0b9 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactory.java @@ -41,7 +41,7 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext; import org.apache.shardingsphere.proxy.backend.distsql.DistSQLStatementContext; import org.apache.shardingsphere.proxy.backend.handler.admin.DatabaseAdminBackendHandlerFactory; -import org.apache.shardingsphere.proxy.backend.handler.checker.ProxyBackendHandlerChecker; +import org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker; import org.apache.shardingsphere.proxy.backend.handler.data.DatabaseBackendHandlerFactory; import org.apache.shardingsphere.proxy.backend.handler.database.DatabaseOperateBackendHandlerFactory; import org.apache.shardingsphere.proxy.backend.handler.distsql.DistSQLBackendHandlerFactory; @@ -147,7 +147,7 @@ public static ProxyBackendHandler newInstance(final DatabaseType databaseType, f Grantee grantee = connectionSession.getConnectionContext().getGrantee(); ShardingSphereMetaData metaData = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData(); ShardingSphereDatabase database = metaData.getDatabase(databaseName); - for (ProxyBackendHandlerChecker each : ShardingSphereServiceLoader.getServiceInstances(ProxyBackendHandlerChecker.class)) { + for (SQLExecutionChecker each : ShardingSphereServiceLoader.getServiceInstances(SQLExecutionChecker.class)) { each.check(metaData, grantee, queryContext, database); } return DatabaseAdminBackendHandlerFactory.newInstance(databaseType, sqlStatementContext, connectionSession) diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditProxyBackendHandlerChecker.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionChecker.java similarity index 88% rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditProxyBackendHandlerChecker.java rename to proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionChecker.java index c7123b9f1d98d..e01d3d87278c2 100644 --- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditProxyBackendHandlerChecker.java +++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/checker/AuditSQLExecutionChecker.java @@ -18,15 +18,16 @@ package org.apache.shardingsphere.proxy.backend.handler.checker; import org.apache.shardingsphere.infra.executor.audit.SQLAuditEngine; +import org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker; import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.user.Grantee; import org.apache.shardingsphere.infra.session.query.QueryContext; /** - * Audit proxy backend handler checker. + * Audit SQL execution checker. */ -public final class AuditProxyBackendHandlerChecker implements ProxyBackendHandlerChecker { +public final class AuditSQLExecutionChecker implements SQLExecutionChecker { @Override public void check(final ShardingSphereMetaData metaData, final Grantee grantee, final QueryContext queryContext, final ShardingSphereDatabase database) { diff --git a/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker new file mode 100644 index 0000000000000..b4f6279bfa846 --- /dev/null +++ b/proxy/backend/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker @@ -0,0 +1,18 @@ +# +# 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. +# + +org.apache.shardingsphere.proxy.backend.handler.checker.AuditSQLExecutionChecker