Class ShadowRuleStatementChecker
java.lang.Object
org.apache.shardingsphere.shadow.distsql.handler.checker.ShadowRuleStatementChecker
Shadow rule statement checker.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckAlgorithmCompleteness(Collection<ShadowAlgorithmSegment> algorithmSegments) Check the completeness of the algorithm.static voidcheckAlgorithmExist(Collection<String> requireAlgorithms, Collection<String> currentAlgorithms, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) Check if the algorithms exist.static voidcheckAnyDifferent(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) Check for any different data in the rules, and throw the specified exception.static voidcheckAnyDuplicate(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) Check if there are duplicates in the rules, and throw the specified exception.static voidcheckAnyDuplicate(Collection<String> rules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) Check for any duplicate data in the rules, and throw the specified exception.static voidcheckConfigurationExist(String databaseName, org.apache.shardingsphere.infra.config.scope.SchemaRuleConfiguration config) Check if the configuration exists.static voidcheckResourceExist(Collection<String> resources, org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase database) Check if resources exist in meta data.static voidcheckRulesExist(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) Check if the rules exist.
-
Field Details
-
SHADOW
- See Also:
-
-
Constructor Details
-
ShadowRuleStatementChecker
public ShadowRuleStatementChecker()
-
-
Method Details
-
checkConfigurationExist
public static void checkConfigurationExist(String databaseName, org.apache.shardingsphere.infra.config.scope.SchemaRuleConfiguration config) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLException Check if the configuration exists.- Parameters:
databaseName- database nameconfig- configuration- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkResourceExist
public static void checkResourceExist(Collection<String> resources, org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase database) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLException Check if resources exist in meta data.- Parameters:
resources- resource being checkeddatabase- database- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkAlgorithmCompleteness
public static void checkAlgorithmCompleteness(Collection<ShadowAlgorithmSegment> algorithmSegments) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLException Check the completeness of the algorithm.- Parameters:
algorithmSegments- algorithmSegments to be checked- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkRulesExist
public static void checkRulesExist(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLExceptionCheck if the rules exist.- Parameters:
requireRules- require rulescurrentRules- current rulesthrower- thrower- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkAlgorithmExist
public static void checkAlgorithmExist(Collection<String> requireAlgorithms, Collection<String> currentAlgorithms, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLExceptionCheck if the algorithms exist.- Parameters:
requireAlgorithms- require algorithmscurrentAlgorithms- current algorithmsthrower- thrower- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkAnyDuplicate
public static void checkAnyDuplicate(Collection<String> rules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLExceptionCheck for any duplicate data in the rules, and throw the specified exception.- Parameters:
rules- rules to be checkedthrower- exception thrower- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkAnyDuplicate
public static void checkAnyDuplicate(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLExceptionCheck if there are duplicates in the rules, and throw the specified exception.- Parameters:
requireRules- rules to be checkedcurrentRules- rules to be checkedthrower- exception thrower- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-
checkAnyDifferent
public static void checkAnyDifferent(Collection<String> requireRules, Collection<String> currentRules, Function<Collection<String>, org.apache.shardingsphere.infra.distsql.exception.DistSQLException> thrower) throws org.apache.shardingsphere.infra.distsql.exception.DistSQLExceptionCheck for any different data in the rules, and throw the specified exception.- Parameters:
requireRules- rules to be checkedcurrentRules- rules to be checkedthrower- exception thrower- Throws:
org.apache.shardingsphere.infra.distsql.exception.DistSQLException- DistSQL exception
-