You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/07/06 06:27:14 UTC
[shardingsphere] branch master updated: Remove useless implementations of RuleItemChangedEvent (#26786)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 fd354cc4164 Remove useless implementations of RuleItemChangedEvent (#26786)
fd354cc4164 is described below
commit fd354cc41645754fd9aaffe5a2cceec5f83fccde
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Jul 6 14:27:07 2023 +0800
Remove useless implementations of RuleItemChangedEvent (#26786)
* Remove useless implementations of RuleItemChangedEvent
* Remove useless implementations of RuleItemChangedEvent
---
.../event/BroadcastRuleChangedEventCreator.java | 2 +-
.../event/table/AlterBroadcastTableEvent.java | 30 ------
.../{creator => }/BroadcastTableEventCreator.java | 11 ++-
.../event/table/DropBroadcastTableEvent.java | 30 ------
.../subscriber/BroadcastTableChangedGenerator.java | 13 +--
.../CompatibleEncryptRuleChangedEventCreator.java | 4 +-
.../event/EncryptRuleChangedEventCreator.java | 4 +-
.../encryptor/AlterCompatibleEncryptorEvent.java | 32 -------
.../CompatibleEncryptorEventCreator.java | 11 ++-
.../encryptor/DropCompatibleEncryptorEvent.java | 32 -------
.../table/AlterCompatibleEncryptTableEvent.java | 32 -------
.../CompatibleEncryptTableEventCreator.java | 11 ++-
.../table/DropCompatibleEncryptTableEvent.java | 32 -------
.../event/encryptor/AlterEncryptorEvent.java | 30 ------
.../event/encryptor/DropEncryptorEvent.java | 30 ------
.../{creator => }/EncryptorEventCreator.java | 11 ++-
.../event/table/AlterEncryptTableEvent.java | 30 ------
.../encrypt/event/table/DropEncryptTableEvent.java | 30 ------
.../{creator => }/EncryptTableEventCreator.java | 11 ++-
.../subscriber/EncryptTableChangedGenerator.java | 13 +--
.../subscriber/EncryptorChangedGenerator.java | 13 +--
.../CompatibleEncryptTableChangedGenerator.java | 13 +--
.../CompatibleEncryptorChangedGenerator.java | 13 +--
.../mask/event/MaskRuleChangedEventCreator.java | 4 +-
.../event/algorithm/AlterMaskAlgorithmEvent.java | 30 ------
.../event/algorithm/DropMaskAlgorithmEvent.java | 30 ------
.../algorithm/{creator => }/MaskEventCreator.java | 11 ++-
.../mask/event/table/AlterMaskTableEvent.java | 30 ------
.../mask/event/table/DropMaskTableEvent.java | 30 ------
.../table/{creator => }/MaskTableCreator.java | 11 ++-
.../subscriber/MaskAlgorithmChangedGenerator.java | 13 +--
.../mask/subscriber/MaskTableChangedGenerator.java | 13 +--
.../ReadwriteSplittingRuleChangedEventCreator.java | 4 +-
.../AlterReadwriteSplittingDataSourceEvent.java | 30 ------
.../DropReadwriteSplittingDataSourceEvent.java | 30 ------
.../ReadwriteSplittingDataSourceEventCreator.java | 11 ++-
.../AlterReadwriteSplittingLoadBalancerEvent.java | 30 ------
.../DropReadwriteSplittingLoadBalancerEvent.java | 30 ------
...ReadwriteSplittingLoadBalancerEventCreator.java | 11 ++-
...adwriteSplittingDataSourceChangedGenerator.java | 13 +--
...writeSplittingLoadBalancerChangedGenerator.java | 13 +--
...dwriteSplittingRuleChangedEventCreatorTest.java | 70 --------------
.../event/ShadowRuleChangedEventCreator.java | 8 +-
.../AlterDefaultShadowAlgorithmEvent.java | 30 ------
.../event/algorithm/AlterShadowAlgorithmEvent.java | 30 ------
.../DefaultShadowAlgorithmEventCreator.java | 11 ++-
.../algorithm/DropDefaultShadowAlgorithmEvent.java | 30 ------
.../event/algorithm/DropShadowAlgorithmEvent.java | 30 ------
.../{creator => }/ShadowAlgorithmEventCreator.java | 11 ++-
.../datasource/AlterShadowDataSourceEvent.java | 30 ------
.../datasource/DropShadowDataSourceEvent.java | 30 ------
.../ShadowDataSourceEventCreator.java | 11 ++-
.../shadow/event/table/AlterShadowTableEvent.java | 30 ------
.../shadow/event/table/DropShadowTableEvent.java | 30 ------
.../{creator => }/ShadowTableEventCreator.java | 11 ++-
...DefaultShadowAlgorithmNameChangedGenerator.java | 14 +--
.../ShadowAlgorithmChangedGenerator.java | 14 +--
.../ShadowDataSourceChangedGenerator.java | 14 +--
.../subscriber/ShadowTableChangedGenerator.java | 14 +--
.../event/ShadowRuleChangedEventCreatorTest.java | 103 ---------------------
.../event/ShardingRuleChangedEventCreator.java | 24 ++---
.../auditor/AlterShardingAuditorEvent.java | 30 ------
.../{creator => }/AuditShardingEventCreator.java | 11 ++-
.../auditor/DropShardingAuditorEvent.java | 30 ------
.../keygenerator/AlterKeyGeneratorEvent.java | 30 ------
.../keygenerator/DropKeyGeneratorEvent.java | 30 ------
.../{creator => }/KeyGeneratorEventCreator.java | 11 ++-
.../sharding/AlterShardingAlgorithmEvent.java | 30 ------
.../sharding/DropShardingAlgorithmEvent.java | 30 ------
.../ShardingAlgorithmEventCreator.java | 11 ++-
.../event/cache/AlterShardingCacheEvent.java | 30 ------
.../event/cache/DropShardingCacheEvent.java | 30 ------
.../{creator => }/ShardingCacheEventCreator.java | 11 ++-
.../AlterDefaultShardingAuditorStrategyEvent.java | 30 ------
...DefaultShardingAuditorStrategyEventCreator.java | 11 ++-
.../DropDefaultShardingAuditorStrategyEvent.java | 30 ------
.../AlterDefaultDatabaseShardingStrategyEvent.java | 30 ------
...efaultDatabaseShardingStrategyEventCreator.java | 11 ++-
.../DropDefaultDatabaseShardingStrategyEvent.java | 30 ------
.../AlterDefaultKeyGenerateStrategyEvent.java | 30 ------
.../DefaultKeyGenerateStrategyEventCreator.java | 11 ++-
.../DropDefaultKeyGenerateStrategyEvent.java | 30 ------
.../AlterDefaultShardingColumnEvent.java | 30 ------
.../DefaultShardingColumnEventCreator.java | 11 ++-
.../DropDefaultShardingColumnEvent.java | 30 ------
.../AlterDefaultTableShardingStrategyEvent.java | 30 ------
.../DefaultTableShardingStrategyEventCreator.java | 11 ++-
.../DropDefaultTableShardingStrategyEvent.java | 30 ------
.../table/auto/AlterShardingAutoTableEvent.java | 30 ------
.../table/auto/DropShardingAutoTableEvent.java | 30 ------
.../ShardingAutoTableEventCreator.java | 11 ++-
.../binding/AlterShardingTableReferenceEvent.java | 30 ------
.../binding/DropShardingTableReferenceEvent.java | 30 ------
.../ShardingTableReferenceEventCreator.java | 11 ++-
.../table/sharding/AlterShardingTableEvent.java | 30 ------
.../table/sharding/DropShardingTableEvent.java | 30 ------
.../{creator => }/ShardingTableEventCreator.java | 11 ++-
...ltDatabaseShardingStrategyChangedGenerator.java | 14 +--
...DefaultKeyGenerateStrategyChangedGenerator.java | 14 +--
...ultShardingAuditorStrategyChangedGenerator.java | 14 +--
.../DefaultShardingColumnChangedGenerator.java | 14 +--
...faultTableShardingStrategyChangedGenerator.java | 14 +--
.../subscriber/KeyGeneratorChangedGenerator.java | 14 +--
.../ShardingAlgorithmChangedGenerator.java | 14 +--
.../ShardingAuditorChangedGenerator.java | 14 +--
.../ShardingAutoTableChangedGenerator.java | 14 +--
.../subscriber/ShardingCacheChangedGenerator.java | 14 +--
.../subscriber/ShardingTableChangedGenerator.java | 14 +--
.../ShardingTableReferenceChangedGenerator.java | 14 +--
.../rule/event/rule/RuleItemChangedEvent.java | 7 ++
.../event/rule/alter/AlterNamedRuleItemEvent.java | 4 +-
.../event/rule/alter/AlterUniqueRuleItemEvent.java | 4 +-
.../event/rule/drop/DropNamedRuleItemEvent.java | 4 +-
.../event/rule/drop/DropUniqueRuleItemEvent.java | 4 +-
.../event/SingleRuleChangedEventCreator.java | 2 +-
.../single/event/config/AlterSingleTableEvent.java | 30 ------
.../single/event/config/DropSingleTableEvent.java | 30 ------
.../{creator => }/SingleTableEventCreator.java | 11 ++-
.../subscriber/SingleTableChangedGenerator.java | 14 +--
.../mode/subsciber/RuleItemChangedSubscriber.java | 4 +-
120 files changed, 281 insertions(+), 2180 deletions(-)
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/BroadcastRuleChangedEventCreator.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/BroadcastRuleChangedEventCreator.java
index e5016ae2b14..aa97fce5fd1 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/BroadcastRuleChangedEventCreator.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/BroadcastRuleChangedEventCreator.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.broadcast.event;
-import org.apache.shardingsphere.broadcast.event.table.creator.BroadcastTableEventCreator;
+import org.apache.shardingsphere.broadcast.event.table.BroadcastTableEventCreator;
import org.apache.shardingsphere.broadcast.metadata.nodepath.BroadcastRuleNodePathProvider;
import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/AlterBroadcastTableEvent.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/AlterBroadcastTableEvent.java
deleted file mode 100644
index 27552e9a18f..00000000000
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/AlterBroadcastTableEvent.java
+++ /dev/null
@@ -1,30 +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.broadcast.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter broadcast table event.
- */
-public final class AlterBroadcastTableEvent extends AlterUniqueRuleItemEvent {
-
- public AlterBroadcastTableEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/creator/BroadcastTableEventCreator.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/BroadcastTableEventCreator.java
similarity index 72%
rename from features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/creator/BroadcastTableEventCreator.java
rename to features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/BroadcastTableEventCreator.java
index 2bdeb745dcf..3ea8020a8e4 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/creator/BroadcastTableEventCreator.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/BroadcastTableEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.broadcast.event.table.creator;
+package org.apache.shardingsphere.broadcast.event.table;
-import org.apache.shardingsphere.broadcast.event.table.AlterBroadcastTableEvent;
-import org.apache.shardingsphere.broadcast.event.table.DropBroadcastTableEvent;
+import org.apache.shardingsphere.broadcast.subscriber.BroadcastTableChangedGenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
@@ -32,8 +33,8 @@ public final class BroadcastTableEventCreator implements UniqueRuleItemChangedEv
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterBroadcastTableEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), BroadcastTableChangedGenerator.TYPE);
}
- return new DropBroadcastTableEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, BroadcastTableChangedGenerator.TYPE);
}
}
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/DropBroadcastTableEvent.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/DropBroadcastTableEvent.java
deleted file mode 100644
index 874a5e914ff..00000000000
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/event/table/DropBroadcastTableEvent.java
+++ /dev/null
@@ -1,30 +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.broadcast.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop broadcast table event.
- */
-public final class DropBroadcastTableEvent extends DropUniqueRuleItemEvent {
-
- public DropBroadcastTableEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/subscriber/BroadcastTableChangedGenerator.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/subscriber/BroadcastTableChangedGenerator.java
index 0f65cc36f1b..dc4cdccfe35 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/subscriber/BroadcastTableChangedGenerator.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/subscriber/BroadcastTableChangedGenerator.java
@@ -18,8 +18,6 @@
package org.apache.shardingsphere.broadcast.subscriber;
import org.apache.shardingsphere.broadcast.api.config.BroadcastRuleConfiguration;
-import org.apache.shardingsphere.broadcast.event.table.AlterBroadcastTableEvent;
-import org.apache.shardingsphere.broadcast.event.table.DropBroadcastTableEvent;
import org.apache.shardingsphere.broadcast.rule.BroadcastRule;
import org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -28,8 +26,6 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedList;
/**
@@ -37,6 +33,8 @@ import java.util.LinkedList;
*/
public final class BroadcastTableChangedGenerator implements RuleItemConfigurationChangedGenerator<BroadcastRuleConfiguration, BroadcastRuleConfiguration> {
+ public static final String TYPE = "Broadcast.Table";
+
@Override
public BroadcastRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new BroadcastRuleConfiguration(YamlEngine.unmarshal(yamlContent, YamlBroadcastRuleConfiguration.class).getTables());
@@ -60,11 +58,6 @@ public final class BroadcastTableChangedGenerator implements RuleItemConfigurati
@Override
public String getType() {
- return AlterBroadcastTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropBroadcastTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/CompatibleEncryptRuleChangedEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/CompatibleEncryptRuleChangedEventCreator.java
index 03934d78d85..8ad9239fc2f 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/CompatibleEncryptRuleChangedEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/CompatibleEncryptRuleChangedEventCreator.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.encrypt.event;
-import org.apache.shardingsphere.encrypt.event.compatible.encryptor.creator.CompatibleEncryptorEventCreator;
-import org.apache.shardingsphere.encrypt.event.compatible.table.creator.CompatibleEncryptTableEventCreator;
+import org.apache.shardingsphere.encrypt.event.compatible.encryptor.CompatibleEncryptorEventCreator;
+import org.apache.shardingsphere.encrypt.event.compatible.table.CompatibleEncryptTableEventCreator;
import org.apache.shardingsphere.encrypt.metadata.nodepath.EncryptRuleNodePathProvider;
import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/EncryptRuleChangedEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/EncryptRuleChangedEventCreator.java
index c6de985f564..d1d19759517 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/EncryptRuleChangedEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/EncryptRuleChangedEventCreator.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.encrypt.event;
-import org.apache.shardingsphere.encrypt.event.encryptor.creator.EncryptorEventCreator;
-import org.apache.shardingsphere.encrypt.event.table.creator.EncryptTableEventCreator;
+import org.apache.shardingsphere.encrypt.event.encryptor.EncryptorEventCreator;
+import org.apache.shardingsphere.encrypt.event.table.EncryptTableEventCreator;
import org.apache.shardingsphere.encrypt.metadata.nodepath.EncryptRuleNodePathProvider;
import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/AlterCompatibleEncryptorEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/AlterCompatibleEncryptorEvent.java
deleted file mode 100644
index fd48b44c55f..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/AlterCompatibleEncryptorEvent.java
+++ /dev/null
@@ -1,32 +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.encrypt.event.compatible.encryptor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter compatible encryptor event.
- * @deprecated compatible support will remove in next version.
- */
-@Deprecated
-public final class AlterCompatibleEncryptorEvent extends AlterNamedRuleItemEvent {
-
- public AlterCompatibleEncryptorEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/creator/CompatibleEncryptorEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/CompatibleEncryptorEventCreator.java
similarity index 74%
rename from features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/creator/CompatibleEncryptorEventCreator.java
rename to features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/CompatibleEncryptorEventCreator.java
index a9ef85cfd58..6f4a46280aa 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/creator/CompatibleEncryptorEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/CompatibleEncryptorEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.encrypt.event.compatible.encryptor.creator;
+package org.apache.shardingsphere.encrypt.event.compatible.encryptor;
-import org.apache.shardingsphere.encrypt.event.compatible.encryptor.AlterCompatibleEncryptorEvent;
-import org.apache.shardingsphere.encrypt.event.compatible.encryptor.DropCompatibleEncryptorEvent;
+import org.apache.shardingsphere.encrypt.subscriber.compatible.CompatibleEncryptorChangedGenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -34,8 +35,8 @@ public final class CompatibleEncryptorEventCreator implements NamedRuleItemChang
@Override
public RuleItemChangedEvent create(final String databaseName, final String encryptorName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterCompatibleEncryptorEvent(databaseName, encryptorName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, encryptorName, event.getKey(), event.getValue(), CompatibleEncryptorChangedGenerator.TYPE);
}
- return new DropCompatibleEncryptorEvent(databaseName, encryptorName);
+ return new DropNamedRuleItemEvent(databaseName, encryptorName, CompatibleEncryptorChangedGenerator.TYPE);
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/DropCompatibleEncryptorEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/DropCompatibleEncryptorEvent.java
deleted file mode 100644
index 9cc04d4a792..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/encryptor/DropCompatibleEncryptorEvent.java
+++ /dev/null
@@ -1,32 +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.encrypt.event.compatible.encryptor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop compatible encryptor event.
- * @deprecated compatible support will remove in next version.
- */
-@Deprecated
-public final class DropCompatibleEncryptorEvent extends DropNamedRuleItemEvent {
-
- public DropCompatibleEncryptorEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/AlterCompatibleEncryptTableEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/AlterCompatibleEncryptTableEvent.java
deleted file mode 100644
index 9dcfd01ddc6..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/AlterCompatibleEncryptTableEvent.java
+++ /dev/null
@@ -1,32 +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.encrypt.event.compatible.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter compatible encrypt table event.
- * @deprecated compatible support will remove in next version.
- */
-@Deprecated
-public final class AlterCompatibleEncryptTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterCompatibleEncryptTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/creator/CompatibleEncryptTableEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/CompatibleEncryptTableEventCreator.java
similarity index 74%
rename from features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/creator/CompatibleEncryptTableEventCreator.java
rename to features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/CompatibleEncryptTableEventCreator.java
index 5833a10b4e8..01a59c8078c 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/creator/CompatibleEncryptTableEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/CompatibleEncryptTableEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.encrypt.event.compatible.table.creator;
+package org.apache.shardingsphere.encrypt.event.compatible.table;
-import org.apache.shardingsphere.encrypt.event.compatible.table.AlterCompatibleEncryptTableEvent;
-import org.apache.shardingsphere.encrypt.event.compatible.table.DropCompatibleEncryptTableEvent;
+import org.apache.shardingsphere.encrypt.subscriber.compatible.CompatibleEncryptTableChangedGenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -34,8 +35,8 @@ public final class CompatibleEncryptTableEventCreator implements NamedRuleItemCh
@Override
public RuleItemChangedEvent create(final String databaseName, final String groupName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterCompatibleEncryptTableEvent(databaseName, groupName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, groupName, event.getKey(), event.getValue(), CompatibleEncryptTableChangedGenerator.TYPE);
}
- return new DropCompatibleEncryptTableEvent(databaseName, groupName);
+ return new DropNamedRuleItemEvent(databaseName, groupName, CompatibleEncryptTableChangedGenerator.TYPE);
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/DropCompatibleEncryptTableEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/DropCompatibleEncryptTableEvent.java
deleted file mode 100644
index 20a23a6cebd..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/compatible/table/DropCompatibleEncryptTableEvent.java
+++ /dev/null
@@ -1,32 +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.encrypt.event.compatible.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop compatible encrypt table event.
- * @deprecated compatible support will remove in next version.
- */
-@Deprecated
-public final class DropCompatibleEncryptTableEvent extends DropNamedRuleItemEvent {
-
- public DropCompatibleEncryptTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/AlterEncryptorEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/AlterEncryptorEvent.java
deleted file mode 100644
index 387cbe548cf..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/AlterEncryptorEvent.java
+++ /dev/null
@@ -1,30 +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.encrypt.event.encryptor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter encryptor event.
- */
-public final class AlterEncryptorEvent extends AlterNamedRuleItemEvent {
-
- public AlterEncryptorEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/DropEncryptorEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/DropEncryptorEvent.java
deleted file mode 100644
index 672c16c82ab..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/DropEncryptorEvent.java
+++ /dev/null
@@ -1,30 +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.encrypt.event.encryptor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop encryptor event.
- */
-public final class DropEncryptorEvent extends DropNamedRuleItemEvent {
-
- public DropEncryptorEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/creator/EncryptorEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/EncryptorEventCreator.java
similarity index 72%
rename from features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/creator/EncryptorEventCreator.java
rename to features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/EncryptorEventCreator.java
index f705892c8b9..684c5bc3759 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/creator/EncryptorEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/encryptor/EncryptorEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.encrypt.event.encryptor.creator;
+package org.apache.shardingsphere.encrypt.event.encryptor;
-import org.apache.shardingsphere.encrypt.event.encryptor.AlterEncryptorEvent;
-import org.apache.shardingsphere.encrypt.event.encryptor.DropEncryptorEvent;
+import org.apache.shardingsphere.encrypt.subscriber.EncryptorChangedGenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -32,8 +33,8 @@ public final class EncryptorEventCreator implements NamedRuleItemChangedEventCre
@Override
public RuleItemChangedEvent create(final String databaseName, final String encryptorName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterEncryptorEvent(databaseName, encryptorName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, encryptorName, event.getKey(), event.getValue(), EncryptorChangedGenerator.TYPE);
}
- return new DropEncryptorEvent(databaseName, encryptorName);
+ return new DropNamedRuleItemEvent(databaseName, encryptorName, EncryptorChangedGenerator.TYPE);
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/AlterEncryptTableEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/AlterEncryptTableEvent.java
deleted file mode 100644
index d82199a4dc9..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/AlterEncryptTableEvent.java
+++ /dev/null
@@ -1,30 +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.encrypt.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter encrypt table event.
- */
-public final class AlterEncryptTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterEncryptTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/DropEncryptTableEvent.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/DropEncryptTableEvent.java
deleted file mode 100644
index 595ed23b8c9..00000000000
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/DropEncryptTableEvent.java
+++ /dev/null
@@ -1,30 +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.encrypt.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop encrypt table event.
- */
-public final class DropEncryptTableEvent extends DropNamedRuleItemEvent {
-
- public DropEncryptTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/creator/EncryptTableEventCreator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/EncryptTableEventCreator.java
similarity index 72%
rename from features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/creator/EncryptTableEventCreator.java
rename to features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/EncryptTableEventCreator.java
index 9998288c78c..004965a52d5 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/creator/EncryptTableEventCreator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/event/table/EncryptTableEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.encrypt.event.table.creator;
+package org.apache.shardingsphere.encrypt.event.table;
-import org.apache.shardingsphere.encrypt.event.table.AlterEncryptTableEvent;
-import org.apache.shardingsphere.encrypt.event.table.DropEncryptTableEvent;
+import org.apache.shardingsphere.encrypt.subscriber.EncryptTableChangedGenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -32,8 +33,8 @@ public final class EncryptTableEventCreator implements NamedRuleItemChangedEvent
@Override
public RuleItemChangedEvent create(final String databaseName, final String groupName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterEncryptTableEvent(databaseName, groupName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, groupName, event.getKey(), event.getValue(), EncryptTableChangedGenerator.TYPE);
}
- return new DropEncryptTableEvent(databaseName, groupName);
+ return new DropNamedRuleItemEvent(databaseName, groupName, EncryptTableChangedGenerator.TYPE);
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptTableChangedGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptTableChangedGenerator.java
index f9a2ff980e4..69791447e00 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptTableChangedGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptTableChangedGenerator.java
@@ -19,8 +19,6 @@ package org.apache.shardingsphere.encrypt.subscriber;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
-import org.apache.shardingsphere.encrypt.event.table.AlterEncryptTableEvent;
-import org.apache.shardingsphere.encrypt.event.table.DropEncryptTableEvent;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.swapper.rule.YamlEncryptTableRuleConfigurationSwapper;
@@ -31,8 +29,6 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -41,6 +37,8 @@ import java.util.LinkedList;
*/
public final class EncryptTableChangedGenerator implements RuleItemConfigurationChangedGenerator<EncryptRuleConfiguration, EncryptTableRuleConfiguration> {
+ public static final String TYPE = "Encrypt.Table";
+
@Override
public EncryptTableRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlEncryptTableRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlEncryptTableRuleConfiguration.class));
@@ -71,11 +69,6 @@ public final class EncryptTableChangedGenerator implements RuleItemConfiguration
@Override
public String getType() {
- return AlterEncryptTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropEncryptTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptorChangedGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptorChangedGenerator.java
index a323dc6d546..fad3834f35d 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptorChangedGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptorChangedGenerator.java
@@ -18,8 +18,6 @@
package org.apache.shardingsphere.encrypt.subscriber;
import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.event.encryptor.AlterEncryptorEvent;
-import org.apache.shardingsphere.encrypt.event.encryptor.DropEncryptorEvent;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -32,8 +30,6 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -42,6 +38,8 @@ import java.util.LinkedList;
*/
public final class EncryptorChangedGenerator implements RuleItemConfigurationChangedGenerator<EncryptRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Encrypt.Encryptor";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -70,11 +68,6 @@ public final class EncryptorChangedGenerator implements RuleItemConfigurationCha
@Override
public String getType() {
- return AlterEncryptorEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropEncryptorEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptTableChangedGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptTableChangedGenerator.java
index 900984fdd0d..b463ced9033 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptTableChangedGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptTableChangedGenerator.java
@@ -19,8 +19,6 @@ package org.apache.shardingsphere.encrypt.subscriber.compatible;
import org.apache.shardingsphere.encrypt.api.config.CompatibleEncryptRuleConfiguration;
import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
-import org.apache.shardingsphere.encrypt.event.compatible.table.AlterCompatibleEncryptTableEvent;
-import org.apache.shardingsphere.encrypt.event.compatible.table.DropCompatibleEncryptTableEvent;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.yaml.swapper.rule.YamlEncryptTableRuleConfigurationSwapper;
@@ -31,8 +29,6 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -43,6 +39,8 @@ import java.util.LinkedList;
@Deprecated
public final class CompatibleEncryptTableChangedGenerator implements RuleItemConfigurationChangedGenerator<CompatibleEncryptRuleConfiguration, EncryptTableRuleConfiguration> {
+ public static final String TYPE = "Encrypt.CompatibleTable";
+
@Override
public EncryptTableRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlEncryptTableRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlEncryptTableRuleConfiguration.class));
@@ -73,11 +71,6 @@ public final class CompatibleEncryptTableChangedGenerator implements RuleItemCon
@Override
public String getType() {
- return AlterCompatibleEncryptTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropCompatibleEncryptTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptorChangedGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptorChangedGenerator.java
index 7f868be92bb..a49a546dbd9 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptorChangedGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/compatible/CompatibleEncryptorChangedGenerator.java
@@ -18,8 +18,6 @@
package org.apache.shardingsphere.encrypt.subscriber.compatible;
import org.apache.shardingsphere.encrypt.api.config.CompatibleEncryptRuleConfiguration;
-import org.apache.shardingsphere.encrypt.event.compatible.encryptor.AlterCompatibleEncryptorEvent;
-import org.apache.shardingsphere.encrypt.event.compatible.encryptor.DropCompatibleEncryptorEvent;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -32,8 +30,6 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -44,6 +40,8 @@ import java.util.LinkedList;
@Deprecated
public final class CompatibleEncryptorChangedGenerator implements RuleItemConfigurationChangedGenerator<CompatibleEncryptRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Encrypt.CompatibleEncryptor";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -72,11 +70,6 @@ public final class CompatibleEncryptorChangedGenerator implements RuleItemConfig
@Override
public String getType() {
- return AlterCompatibleEncryptorEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropCompatibleEncryptorEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/MaskRuleChangedEventCreator.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/MaskRuleChangedEventCreator.java
index 963dd46278d..3fae974ebc7 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/MaskRuleChangedEventCreator.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/MaskRuleChangedEventCreator.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.mask.event;
import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
-import org.apache.shardingsphere.mask.event.algorithm.creator.MaskEventCreator;
-import org.apache.shardingsphere.mask.event.table.creator.MaskTableCreator;
+import org.apache.shardingsphere.mask.event.algorithm.MaskEventCreator;
+import org.apache.shardingsphere.mask.event.table.MaskTableCreator;
import org.apache.shardingsphere.mask.metadata.nodepath.MaskRuleNodePathProvider;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/AlterMaskAlgorithmEvent.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/AlterMaskAlgorithmEvent.java
deleted file mode 100644
index 867dc22bad3..00000000000
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/AlterMaskAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.mask.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter mask algorithm event.
- */
-public final class AlterMaskAlgorithmEvent extends AlterNamedRuleItemEvent {
-
- public AlterMaskAlgorithmEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/DropMaskAlgorithmEvent.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/DropMaskAlgorithmEvent.java
deleted file mode 100644
index 618b6532eb4..00000000000
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/DropMaskAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.mask.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop mask algorithm event.
- */
-public final class DropMaskAlgorithmEvent extends DropNamedRuleItemEvent {
-
- public DropMaskAlgorithmEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/creator/MaskEventCreator.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/MaskEventCreator.java
similarity index 72%
rename from features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/creator/MaskEventCreator.java
rename to features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/MaskEventCreator.java
index 45c936b1db1..e7e74ea3aba 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/creator/MaskEventCreator.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/algorithm/MaskEventCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mask.event.algorithm.creator;
+package org.apache.shardingsphere.mask.event.algorithm;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
-import org.apache.shardingsphere.mask.event.algorithm.AlterMaskAlgorithmEvent;
-import org.apache.shardingsphere.mask.event.algorithm.DropMaskAlgorithmEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
+import org.apache.shardingsphere.mask.subscriber.MaskAlgorithmChangedGenerator;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -32,8 +33,8 @@ public final class MaskEventCreator implements NamedRuleItemChangedEventCreator
@Override
public RuleItemChangedEvent create(final String databaseName, final String algorithmName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterMaskAlgorithmEvent(databaseName, algorithmName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, algorithmName, event.getKey(), event.getValue(), MaskAlgorithmChangedGenerator.TYPE);
}
- return new DropMaskAlgorithmEvent(databaseName, algorithmName);
+ return new DropNamedRuleItemEvent(databaseName, algorithmName, MaskAlgorithmChangedGenerator.TYPE);
}
}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/AlterMaskTableEvent.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/AlterMaskTableEvent.java
deleted file mode 100644
index 31919ab8894..00000000000
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/AlterMaskTableEvent.java
+++ /dev/null
@@ -1,30 +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.mask.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter mask configuration event.
- */
-public final class AlterMaskTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterMaskTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/DropMaskTableEvent.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/DropMaskTableEvent.java
deleted file mode 100644
index 6847042fda8..00000000000
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/DropMaskTableEvent.java
+++ /dev/null
@@ -1,30 +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.mask.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop mask configuration event.
- */
-public final class DropMaskTableEvent extends DropNamedRuleItemEvent {
-
- public DropMaskTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/creator/MaskTableCreator.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/MaskTableCreator.java
similarity index 72%
rename from features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/creator/MaskTableCreator.java
rename to features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/MaskTableCreator.java
index e4c52122ab3..b31d48d4e00 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/creator/MaskTableCreator.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/event/table/MaskTableCreator.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mask.event.table.creator;
+package org.apache.shardingsphere.mask.event.table;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
-import org.apache.shardingsphere.mask.event.table.AlterMaskTableEvent;
-import org.apache.shardingsphere.mask.event.table.DropMaskTableEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
+import org.apache.shardingsphere.mask.subscriber.MaskTableChangedGenerator;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
@@ -32,8 +33,8 @@ public final class MaskTableCreator implements NamedRuleItemChangedEventCreator
@Override
public RuleItemChangedEvent create(final String databaseName, final String tableName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterMaskTableEvent(databaseName, tableName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, tableName, event.getKey(), event.getValue(), MaskTableChangedGenerator.TYPE);
}
- return new DropMaskTableEvent(databaseName, tableName);
+ return new DropNamedRuleItemEvent(databaseName, tableName, MaskTableChangedGenerator.TYPE);
}
}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskAlgorithmChangedGenerator.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskAlgorithmChangedGenerator.java
index 3c0859492b1..823d78c2206 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskAlgorithmChangedGenerator.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskAlgorithmChangedGenerator.java
@@ -27,13 +27,9 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration;
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
-import org.apache.shardingsphere.mask.event.algorithm.AlterMaskAlgorithmEvent;
-import org.apache.shardingsphere.mask.event.algorithm.DropMaskAlgorithmEvent;
import org.apache.shardingsphere.mask.rule.MaskRule;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -42,6 +38,8 @@ import java.util.LinkedList;
*/
public final class MaskAlgorithmChangedGenerator implements RuleItemConfigurationChangedGenerator<MaskRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Mask.Algorithm";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -69,11 +67,6 @@ public final class MaskAlgorithmChangedGenerator implements RuleItemConfiguratio
@Override
public String getType() {
- return AlterMaskAlgorithmEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropMaskAlgorithmEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskTableChangedGenerator.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskTableChangedGenerator.java
index a2b224fd180..a53c74b16ea 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskTableChangedGenerator.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/subscriber/MaskTableChangedGenerator.java
@@ -24,15 +24,11 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
import org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration;
-import org.apache.shardingsphere.mask.event.table.AlterMaskTableEvent;
-import org.apache.shardingsphere.mask.event.table.DropMaskTableEvent;
import org.apache.shardingsphere.mask.rule.MaskRule;
import org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration;
import org.apache.shardingsphere.mask.yaml.swapper.rule.YamlMaskTableRuleConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -41,6 +37,8 @@ import java.util.LinkedList;
*/
public final class MaskTableChangedGenerator implements RuleItemConfigurationChangedGenerator<MaskRuleConfiguration, MaskTableRuleConfiguration> {
+ public static final String TYPE = "Mask.Table";
+
@Override
public MaskTableRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlMaskTableRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlMaskTableRuleConfiguration.class));
@@ -70,11 +68,6 @@ public final class MaskTableChangedGenerator implements RuleItemConfigurationCha
@Override
public String getType() {
- return AlterMaskTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropMaskTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreator.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreator.java
index 04b4f0d98a5..0f4651a43a7 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreator.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreator.java
@@ -21,8 +21,8 @@ import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.spi.RuleChangedEventCreator;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.creator.ReadwriteSplittingDataSourceEventCreator;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.creator.ReadwriteSplittingLoadBalancerEventCreator;
+import org.apache.shardingsphere.readwritesplitting.event.datasource.ReadwriteSplittingDataSourceEventCreator;
+import org.apache.shardingsphere.readwritesplitting.event.loadbalance.ReadwriteSplittingLoadBalancerEventCreator;
import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
/**
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/AlterReadwriteSplittingDataSourceEvent.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/AlterReadwriteSplittingDataSourceEvent.java
deleted file mode 100644
index 6ff892d4b11..00000000000
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/AlterReadwriteSplittingDataSourceEvent.java
+++ /dev/null
@@ -1,30 +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.readwritesplitting.event.datasource;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter readwrite-splitting configuration event.
- */
-public final class AlterReadwriteSplittingDataSourceEvent extends AlterNamedRuleItemEvent {
-
- public AlterReadwriteSplittingDataSourceEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/DropReadwriteSplittingDataSourceEvent.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/DropReadwriteSplittingDataSourceEvent.java
deleted file mode 100644
index 5f58f1fa176..00000000000
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/DropReadwriteSplittingDataSourceEvent.java
+++ /dev/null
@@ -1,30 +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.readwritesplitting.event.datasource;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop readwrite-splitting configuration event.
- */
-public final class DropReadwriteSplittingDataSourceEvent extends DropNamedRuleItemEvent {
-
- public DropReadwriteSplittingDataSourceEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/creator/ReadwriteSplittingDataSourceEventCreator.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/ReadwriteSplittingDataSourceEventCreator.java
similarity index 73%
rename from features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/creator/ReadwriteSplittingDataSourceEventCreator.java
rename to features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/ReadwriteSplittingDataSourceEventCreator.java
index 69d06303d30..5d23d8f4b97 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/creator/ReadwriteSplittingDataSourceEventCreator.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/datasource/ReadwriteSplittingDataSourceEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.readwritesplitting.event.datasource.creator;
+package org.apache.shardingsphere.readwritesplitting.event.datasource;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.AlterReadwriteSplittingDataSourceEvent;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.DropReadwriteSplittingDataSourceEvent;
+import org.apache.shardingsphere.readwritesplitting.subscriber.ReadwriteSplittingDataSourceChangedGenerator;
/**
* Readwrite-splitting data source event creator.
@@ -32,8 +33,8 @@ public final class ReadwriteSplittingDataSourceEventCreator implements NamedRule
@Override
public RuleItemChangedEvent create(final String databaseName, final String groupName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterReadwriteSplittingDataSourceEvent(databaseName, groupName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, groupName, event.getKey(), event.getValue(), ReadwriteSplittingDataSourceChangedGenerator.TYPE);
}
- return new DropReadwriteSplittingDataSourceEvent(databaseName, groupName);
+ return new DropNamedRuleItemEvent(databaseName, groupName, ReadwriteSplittingDataSourceChangedGenerator.TYPE);
}
}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/AlterReadwriteSplittingLoadBalancerEvent.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/AlterReadwriteSplittingLoadBalancerEvent.java
deleted file mode 100644
index b84237ed58a..00000000000
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/AlterReadwriteSplittingLoadBalancerEvent.java
+++ /dev/null
@@ -1,30 +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.readwritesplitting.event.loadbalance;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter readwrite-splitting load-balancer event.
- */
-public final class AlterReadwriteSplittingLoadBalancerEvent extends AlterNamedRuleItemEvent {
-
- public AlterReadwriteSplittingLoadBalancerEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/DropReadwriteSplittingLoadBalancerEvent.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/DropReadwriteSplittingLoadBalancerEvent.java
deleted file mode 100644
index 60533eda988..00000000000
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/DropReadwriteSplittingLoadBalancerEvent.java
+++ /dev/null
@@ -1,30 +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.readwritesplitting.event.loadbalance;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop readwrite-splitting load-balancer event.
- */
-public final class DropReadwriteSplittingLoadBalancerEvent extends DropNamedRuleItemEvent {
-
- public DropReadwriteSplittingLoadBalancerEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/creator/ReadwriteSplittingLoadBalancerEventCreator.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/ReadwriteSplittingLoadBalancerEventCreator.java
similarity index 72%
rename from features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/creator/ReadwriteSplittingLoadBalancerEventCreator.java
rename to features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/ReadwriteSplittingLoadBalancerEventCreator.java
index be19d57245a..948e13bf2eb 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/creator/ReadwriteSplittingLoadBalancerEventCreator.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/event/loadbalance/ReadwriteSplittingLoadBalancerEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.readwritesplitting.event.loadbalance.creator;
+package org.apache.shardingsphere.readwritesplitting.event.loadbalance;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DropReadwriteSplittingLoadBalancerEvent;
+import org.apache.shardingsphere.readwritesplitting.subscriber.ReadwriteSplittingLoadBalancerChangedGenerator;
/**
* Readwrite-splitting load-balancer event creator.
@@ -32,8 +33,8 @@ public final class ReadwriteSplittingLoadBalancerEventCreator implements NamedRu
@Override
public RuleItemChangedEvent create(final String databaseName, final String loadBalancerName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterReadwriteSplittingLoadBalancerEvent(databaseName, loadBalancerName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, loadBalancerName, event.getKey(), event.getValue(), ReadwriteSplittingLoadBalancerChangedGenerator.TYPE);
}
- return new DropReadwriteSplittingLoadBalancerEvent(databaseName, loadBalancerName);
+ return new DropNamedRuleItemEvent(databaseName, loadBalancerName, ReadwriteSplittingLoadBalancerChangedGenerator.TYPE);
}
}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingDataSourceChangedGenerator.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingDataSourceChangedGenerator.java
index befdd259655..d887d0b22b1 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingDataSourceChangedGenerator.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingDataSourceChangedGenerator.java
@@ -28,13 +28,9 @@ import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGene
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.transaction.TransactionalReadQueryStrategy;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.AlterReadwriteSplittingDataSourceEvent;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.DropReadwriteSplittingDataSourceEvent;
import org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
import org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Optional;
@@ -44,6 +40,8 @@ import java.util.Optional;
*/
public final class ReadwriteSplittingDataSourceChangedGenerator implements RuleItemConfigurationChangedGenerator<ReadwriteSplittingRuleConfiguration, ReadwriteSplittingDataSourceRuleConfiguration> {
+ public static final String TYPE = "ReadwriteSplitting.DataSource";
+
@Override
public ReadwriteSplittingDataSourceRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
YamlReadwriteSplittingDataSourceRuleConfiguration yamlDataSourceRuleConfig = YamlEngine.unmarshal(yamlContent, YamlReadwriteSplittingDataSourceRuleConfiguration.class);
@@ -79,11 +77,6 @@ public final class ReadwriteSplittingDataSourceChangedGenerator implements RuleI
@Override
public String getType() {
- return AlterReadwriteSplittingDataSourceEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropReadwriteSplittingDataSourceEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingLoadBalancerChangedGenerator.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingLoadBalancerChangedGenerator.java
index 131fd21ace0..0e29bc0c606 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingLoadBalancerChangedGenerator.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/subscriber/ReadwriteSplittingLoadBalancerChangedGenerator.java
@@ -28,12 +28,8 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DropReadwriteSplittingLoadBalancerEvent;
import org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -42,6 +38,8 @@ import java.util.LinkedList;
*/
public final class ReadwriteSplittingLoadBalancerChangedGenerator implements RuleItemConfigurationChangedGenerator<ReadwriteSplittingRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "ReadwriteSplitting.LoadBalancer";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -65,11 +63,6 @@ public final class ReadwriteSplittingLoadBalancerChangedGenerator implements Rul
@Override
public String getType() {
- return AlterReadwriteSplittingLoadBalancerEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropReadwriteSplittingLoadBalancerEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java
deleted file mode 100644
index 8d1191dfeb9..00000000000
--- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/event/ReadwriteSplittingRuleChangedEventCreatorTest.java
+++ /dev/null
@@ -1,70 +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.readwritesplitting.event;
-
-import org.apache.shardingsphere.mode.event.DataChangedEvent;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.AlterReadwriteSplittingDataSourceEvent;
-import org.apache.shardingsphere.readwritesplitting.event.datasource.DropReadwriteSplittingDataSourceEvent;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.AlterReadwriteSplittingLoadBalancerEvent;
-import org.apache.shardingsphere.readwritesplitting.event.loadbalance.DropReadwriteSplittingLoadBalancerEvent;
-import org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.junit.jupiter.MockitoExtension;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-@ExtendWith(MockitoExtension.class)
-class ReadwriteSplittingRuleChangedEventCreatorTest {
-
- private ReadwriteSplittingRuleChangedEventCreator readwriteSplittingRuleChangedEventCreator;
-
- @BeforeEach
- void setUp() {
- readwriteSplittingRuleChangedEventCreator = new ReadwriteSplittingRuleChangedEventCreator();
- }
-
- @Test
- void assertReadWriteSplittingRuleChangeEventForDataSource() {
- assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DropReadwriteSplittingDataSourceEvent.class));
- assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
- ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AlterReadwriteSplittingDataSourceEvent.class));
- }
-
- @Test
- void assertReadWriteEventsRuleChangeCreatorForLoadBalancers() {
- assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(DropReadwriteSplittingLoadBalancerEvent.class));
- assertThat(readwriteSplittingRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
- ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS, "test"), instanceOf(AlterReadwriteSplittingLoadBalancerEvent.class));
- }
-
- @Test
- void assertReadWriteEventsRuleChangeCreatorThrowsUnsupportedException() {
- assertThrows(UnsupportedOperationException.class, () -> readwriteSplittingRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- "Invalid Type", "test"));
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreator.java
index f78991b326b..0bc8c1a60f2 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreator.java
@@ -22,10 +22,10 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.spi.RuleChangedEventCreator;
-import org.apache.shardingsphere.shadow.event.algorithm.creator.DefaultShadowAlgorithmEventCreator;
-import org.apache.shardingsphere.shadow.event.algorithm.creator.ShadowAlgorithmEventCreator;
-import org.apache.shardingsphere.shadow.event.datasource.creator.ShadowDataSourceEventCreator;
-import org.apache.shardingsphere.shadow.event.table.creator.ShadowTableEventCreator;
+import org.apache.shardingsphere.shadow.event.algorithm.DefaultShadowAlgorithmEventCreator;
+import org.apache.shardingsphere.shadow.event.algorithm.ShadowAlgorithmEventCreator;
+import org.apache.shardingsphere.shadow.event.datasource.ShadowDataSourceEventCreator;
+import org.apache.shardingsphere.shadow.event.table.ShadowTableEventCreator;
import org.apache.shardingsphere.shadow.metadata.nodepath.ShadowRuleNodePathProvider;
/**
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterDefaultShadowAlgorithmEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterDefaultShadowAlgorithmEvent.java
deleted file mode 100644
index 5db775655fb..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterDefaultShadowAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default shadow algorithm event.
- */
-public final class AlterDefaultShadowAlgorithmEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultShadowAlgorithmEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterShadowAlgorithmEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterShadowAlgorithmEvent.java
deleted file mode 100644
index 3b911ff87db..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/AlterShadowAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter shadow algorithm event.
- */
-public final class AlterShadowAlgorithmEvent extends AlterNamedRuleItemEvent {
-
- public AlterShadowAlgorithmEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/DefaultShadowAlgorithmEventCreator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DefaultShadowAlgorithmEventCreator.java
similarity index 71%
rename from features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/DefaultShadowAlgorithmEventCreator.java
rename to features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DefaultShadowAlgorithmEventCreator.java
index 5cc8aaf1224..fb0d33f075e 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/DefaultShadowAlgorithmEventCreator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DefaultShadowAlgorithmEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.event.algorithm.creator;
+package org.apache.shardingsphere.shadow.event.algorithm;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterDefaultShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropDefaultShadowAlgorithmEvent;
+import org.apache.shardingsphere.shadow.subscriber.DefaultShadowAlgorithmNameChangedGenerator;
/**
* Default shadow algorithm event creator.
@@ -32,8 +33,8 @@ public final class DefaultShadowAlgorithmEventCreator implements UniqueRuleItemC
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultShadowAlgorithmEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultShadowAlgorithmNameChangedGenerator.TYPE);
}
- return new DropDefaultShadowAlgorithmEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultShadowAlgorithmNameChangedGenerator.TYPE);
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropDefaultShadowAlgorithmEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropDefaultShadowAlgorithmEvent.java
deleted file mode 100644
index 384cd53670b..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropDefaultShadowAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default shadow algorithm event.
- */
-public final class DropDefaultShadowAlgorithmEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultShadowAlgorithmEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropShadowAlgorithmEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropShadowAlgorithmEvent.java
deleted file mode 100644
index 9159554cc5b..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/DropShadowAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.algorithm;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop shadow algorithm event.
- */
-public final class DropShadowAlgorithmEvent extends DropNamedRuleItemEvent {
-
- public DropShadowAlgorithmEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/ShadowAlgorithmEventCreator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/ShadowAlgorithmEventCreator.java
similarity index 71%
rename from features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/ShadowAlgorithmEventCreator.java
rename to features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/ShadowAlgorithmEventCreator.java
index f723954db45..096af5b7399 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/creator/ShadowAlgorithmEventCreator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/algorithm/ShadowAlgorithmEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.event.algorithm.creator;
+package org.apache.shardingsphere.shadow.event.algorithm;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropShadowAlgorithmEvent;
+import org.apache.shardingsphere.shadow.subscriber.ShadowAlgorithmChangedGenerator;
/**
* Shadow algorithm event creator.
@@ -32,8 +33,8 @@ public final class ShadowAlgorithmEventCreator implements NamedRuleItemChangedEv
@Override
public RuleItemChangedEvent create(final String databaseName, final String algorithmName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShadowAlgorithmEvent(databaseName, algorithmName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, algorithmName, event.getKey(), event.getValue(), ShadowAlgorithmChangedGenerator.TYPE);
}
- return new DropShadowAlgorithmEvent(databaseName, algorithmName);
+ return new DropNamedRuleItemEvent(databaseName, algorithmName, ShadowAlgorithmChangedGenerator.TYPE);
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/AlterShadowDataSourceEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/AlterShadowDataSourceEvent.java
deleted file mode 100644
index 60a065152b6..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/AlterShadowDataSourceEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.datasource;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter shadow configuration event.
- */
-public final class AlterShadowDataSourceEvent extends AlterNamedRuleItemEvent {
-
- public AlterShadowDataSourceEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/DropShadowDataSourceEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/DropShadowDataSourceEvent.java
deleted file mode 100644
index 2536c864d65..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/DropShadowDataSourceEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.datasource;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop shadow configuration event.
- */
-public final class DropShadowDataSourceEvent extends DropNamedRuleItemEvent {
-
- public DropShadowDataSourceEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/creator/ShadowDataSourceEventCreator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/ShadowDataSourceEventCreator.java
similarity index 71%
rename from features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/creator/ShadowDataSourceEventCreator.java
rename to features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/ShadowDataSourceEventCreator.java
index 22440bd54c6..965b18fff99 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/creator/ShadowDataSourceEventCreator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/datasource/ShadowDataSourceEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.event.datasource.creator;
+package org.apache.shardingsphere.shadow.event.datasource;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.shadow.event.datasource.AlterShadowDataSourceEvent;
-import org.apache.shardingsphere.shadow.event.datasource.DropShadowDataSourceEvent;
+import org.apache.shardingsphere.shadow.subscriber.ShadowDataSourceChangedGenerator;
/**
* Shadow data source event creator.
@@ -32,8 +33,8 @@ public final class ShadowDataSourceEventCreator implements NamedRuleItemChangedE
@Override
public RuleItemChangedEvent create(final String databaseName, final String dataSourceName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShadowDataSourceEvent(databaseName, dataSourceName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, dataSourceName, event.getKey(), event.getValue(), ShadowDataSourceChangedGenerator.TYPE);
}
- return new DropShadowDataSourceEvent(databaseName, dataSourceName);
+ return new DropNamedRuleItemEvent(databaseName, dataSourceName, ShadowDataSourceChangedGenerator.TYPE);
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/AlterShadowTableEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/AlterShadowTableEvent.java
deleted file mode 100644
index 3f8014dd1ca..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/AlterShadowTableEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter shadow table event.
- */
-public final class AlterShadowTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterShadowTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/DropShadowTableEvent.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/DropShadowTableEvent.java
deleted file mode 100644
index d616ae2ce21..00000000000
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/DropShadowTableEvent.java
+++ /dev/null
@@ -1,30 +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.shadow.event.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop shadow table event.
- */
-public final class DropShadowTableEvent extends DropNamedRuleItemEvent {
-
- public DropShadowTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/creator/ShadowTableEventCreator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/ShadowTableEventCreator.java
similarity index 72%
rename from features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/creator/ShadowTableEventCreator.java
rename to features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/ShadowTableEventCreator.java
index 89459ef90f8..c36fb148061 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/creator/ShadowTableEventCreator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/event/table/ShadowTableEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.shadow.event.table.creator;
+package org.apache.shardingsphere.shadow.event.table;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.shadow.event.table.AlterShadowTableEvent;
-import org.apache.shardingsphere.shadow.event.table.DropShadowTableEvent;
+import org.apache.shardingsphere.shadow.subscriber.ShadowTableChangedGenerator;
/**
* Shadow table event creator.
@@ -32,8 +33,8 @@ public final class ShadowTableEventCreator implements NamedRuleItemChangedEventC
@Override
public RuleItemChangedEvent create(final String databaseName, final String tableName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShadowTableEvent(databaseName, tableName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, tableName, event.getKey(), event.getValue(), ShadowTableChangedGenerator.TYPE);
}
- return new DropShadowTableEvent(databaseName, tableName);
+ return new DropNamedRuleItemEvent(databaseName, tableName, ShadowTableChangedGenerator.TYPE);
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/DefaultShadowAlgorithmNameChangedGenerator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/DefaultShadowAlgorithmNameChangedGenerator.java
index 7a1b2f4cf24..6f4b998bc27 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/DefaultShadowAlgorithmNameChangedGenerator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/DefaultShadowAlgorithmNameChangedGenerator.java
@@ -22,18 +22,15 @@ import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterRuleItemEvent;
import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterDefaultShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropDefaultShadowAlgorithmEvent;
import org.apache.shardingsphere.shadow.rule.ShadowRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default shadow algorithm name changed generator.
*/
public final class DefaultShadowAlgorithmNameChangedGenerator implements RuleItemConfigurationChangedGenerator<ShadowRuleConfiguration, String> {
+ public static final String TYPE = "Shadow.DefaultShadowAlgorithmName";
+
@Override
public String swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return yamlContent;
@@ -56,11 +53,6 @@ public final class DefaultShadowAlgorithmNameChangedGenerator implements RuleIte
@Override
public String getType() {
- return AlterDefaultShadowAlgorithmEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultShadowAlgorithmEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowAlgorithmChangedGenerator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowAlgorithmChangedGenerator.java
index 82f8ce3065a..d74a3eb397e 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowAlgorithmChangedGenerator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowAlgorithmChangedGenerator.java
@@ -28,18 +28,15 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropShadowAlgorithmEvent;
import org.apache.shardingsphere.shadow.rule.ShadowRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Shadow algorithm changed generator.
*/
public final class ShadowAlgorithmChangedGenerator implements RuleItemConfigurationChangedGenerator<ShadowRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Shadow.Algorithm";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -62,11 +59,6 @@ public final class ShadowAlgorithmChangedGenerator implements RuleItemConfigurat
@Override
public String getType() {
- return AlterShadowAlgorithmEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShadowAlgorithmEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowDataSourceChangedGenerator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowDataSourceChangedGenerator.java
index 6ff26967e4c..741759bbfb1 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowDataSourceChangedGenerator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowDataSourceChangedGenerator.java
@@ -26,19 +26,16 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.shadow.api.config.datasource.ShadowDataSourceConfiguration;
-import org.apache.shardingsphere.shadow.event.datasource.AlterShadowDataSourceEvent;
-import org.apache.shardingsphere.shadow.event.datasource.DropShadowDataSourceEvent;
import org.apache.shardingsphere.shadow.rule.ShadowRule;
import org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Shadow data source changed generator.
*/
public final class ShadowDataSourceChangedGenerator implements RuleItemConfigurationChangedGenerator<ShadowRuleConfiguration, ShadowDataSourceConfiguration> {
+ public static final String TYPE = "Shadow.DataSource";
+
@Override
public ShadowDataSourceConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
YamlShadowDataSourceConfiguration yamlConfig = YamlEngine.unmarshal(yamlContent, YamlShadowDataSourceConfiguration.class);
@@ -64,11 +61,6 @@ public final class ShadowDataSourceChangedGenerator implements RuleItemConfigura
@Override
public String getType() {
- return AlterShadowDataSourceEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShadowDataSourceEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowTableChangedGenerator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowTableChangedGenerator.java
index 72e9144088e..253eddb546b 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowTableChangedGenerator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/subscriber/ShadowTableChangedGenerator.java
@@ -26,20 +26,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import org.apache.shardingsphere.shadow.api.config.table.ShadowTableConfiguration;
-import org.apache.shardingsphere.shadow.event.table.AlterShadowTableEvent;
-import org.apache.shardingsphere.shadow.event.table.DropShadowTableEvent;
import org.apache.shardingsphere.shadow.rule.ShadowRule;
import org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration;
import org.apache.shardingsphere.shadow.yaml.swapper.table.YamlShadowTableConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Shadow table changed generator.
*/
public final class ShadowTableChangedGenerator implements RuleItemConfigurationChangedGenerator<ShadowRuleConfiguration, ShadowTableConfiguration> {
+ public static final String TYPE = "Shadow.Table";
+
@Override
public ShadowTableConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShadowTableConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShadowTableConfiguration.class));
@@ -62,11 +59,6 @@ public final class ShadowTableChangedGenerator implements RuleItemConfigurationC
@Override
public String getType() {
- return AlterShadowTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShadowTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreatorTest.java b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreatorTest.java
deleted file mode 100644
index fbc9c990fe1..00000000000
--- a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/event/ShadowRuleChangedEventCreatorTest.java
+++ /dev/null
@@ -1,103 +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.shadow.event;
-
-import org.apache.shardingsphere.mode.event.DataChangedEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterDefaultShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.AlterShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropDefaultShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.algorithm.DropShadowAlgorithmEvent;
-import org.apache.shardingsphere.shadow.event.datasource.AlterShadowDataSourceEvent;
-import org.apache.shardingsphere.shadow.event.datasource.DropShadowDataSourceEvent;
-import org.apache.shardingsphere.shadow.event.table.AlterShadowTableEvent;
-import org.apache.shardingsphere.shadow.event.table.DropShadowTableEvent;
-import org.apache.shardingsphere.shadow.metadata.nodepath.ShadowRuleNodePathProvider;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-class ShadowRuleChangedEventCreatorTest {
-
- private ShadowRuleChangedEventCreator shadowRuleChangedEventCreator;
-
- @BeforeEach
- void setUp() {
- shadowRuleChangedEventCreator = new ShadowRuleChangedEventCreator();
- }
-
- @Test
- void assertNamedRuleItemChangedDataSourceCreatorEvent() {
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ShadowRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(DropShadowDataSourceEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
- ShadowRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AlterShadowDataSourceEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.UPDATED),
- ShadowRuleNodePathProvider.DATA_SOURCES, "test"), instanceOf(AlterShadowDataSourceEvent.class));
- }
-
- @Test
- void assertNamedRuleItemChangedAlgorithmCreatorEvent() {
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ShadowRuleNodePathProvider.ALGORITHMS, "test"), instanceOf(DropShadowAlgorithmEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
- ShadowRuleNodePathProvider.ALGORITHMS, "test"), instanceOf(AlterShadowAlgorithmEvent.class));
- }
-
- @Test
- void assertNamedRuleItemChangedTableCreatorEvent() {
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ShadowRuleNodePathProvider.TABLES, "test"), instanceOf(DropShadowTableEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.ADDED),
- ShadowRuleNodePathProvider.TABLES, "test"), instanceOf(AlterShadowTableEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.UPDATED),
- ShadowRuleNodePathProvider.TABLES, "test"), instanceOf(AlterShadowTableEvent.class));
- }
-
- @Test
- void assertNamedRuleItemChangedCreatorThrowsUnsupportedException() {
- assertThrows(UnsupportedOperationException.class, () -> shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- "Invalid Type", "test"));
- }
-
- @Test
- void assertUniqueRuleItemChangedDatasourceCreatorEvent() {
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED),
- ShadowRuleNodePathProvider.DATA_SOURCES), instanceOf(DropDefaultShadowAlgorithmEvent.class));
- assertThat(shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.UPDATED),
- ShadowRuleNodePathProvider.DATA_SOURCES), instanceOf(AlterDefaultShadowAlgorithmEvent.class));
- }
-
- @Test
- void assertUniqueRuleItemChangedCreatorThrowsUnsupportedException() {
- assertThrows(UnsupportedOperationException.class, () -> shadowRuleChangedEventCreator.create("test",
- new DataChangedEvent("RANDOM", "RANDOM", DataChangedEvent.Type.DELETED), "Invalid Type"));
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/ShardingRuleChangedEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/ShardingRuleChangedEventCreator.java
index 1134f57407a..25719e78beb 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/ShardingRuleChangedEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/ShardingRuleChangedEventCreator.java
@@ -22,18 +22,18 @@ import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.spi.RuleChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.auditor.creator.AuditShardingEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.creator.KeyGeneratorEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.sharding.creator.ShardingAlgorithmEventCreator;
-import org.apache.shardingsphere.sharding.event.cache.creator.ShardingCacheEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.audit.creator.DefaultShardingAuditorStrategyEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.database.creator.DefaultDatabaseShardingStrategyEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.keygenerate.creator.DefaultKeyGenerateStrategyEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.creator.DefaultShardingColumnEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.table.creator.DefaultTableShardingStrategyEventCreator;
-import org.apache.shardingsphere.sharding.event.table.auto.creator.ShardingAutoTableEventCreator;
-import org.apache.shardingsphere.sharding.event.table.binding.creator.ShardingTableReferenceEventCreator;
-import org.apache.shardingsphere.sharding.event.table.sharding.creator.ShardingTableEventCreator;
+import org.apache.shardingsphere.sharding.event.algorithm.auditor.AuditShardingEventCreator;
+import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.KeyGeneratorEventCreator;
+import org.apache.shardingsphere.sharding.event.algorithm.sharding.ShardingAlgorithmEventCreator;
+import org.apache.shardingsphere.sharding.event.cache.ShardingCacheEventCreator;
+import org.apache.shardingsphere.sharding.event.strategy.audit.DefaultShardingAuditorStrategyEventCreator;
+import org.apache.shardingsphere.sharding.event.strategy.database.DefaultDatabaseShardingStrategyEventCreator;
+import org.apache.shardingsphere.sharding.event.strategy.keygenerate.DefaultKeyGenerateStrategyEventCreator;
+import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.DefaultShardingColumnEventCreator;
+import org.apache.shardingsphere.sharding.event.strategy.table.DefaultTableShardingStrategyEventCreator;
+import org.apache.shardingsphere.sharding.event.table.auto.ShardingAutoTableEventCreator;
+import org.apache.shardingsphere.sharding.event.table.binding.ShardingTableReferenceEventCreator;
+import org.apache.shardingsphere.sharding.event.table.sharding.ShardingTableEventCreator;
import org.apache.shardingsphere.sharding.metadata.nodepath.ShardingRuleNodePathProvider;
/**
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AlterShardingAuditorEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AlterShardingAuditorEvent.java
deleted file mode 100644
index 7eb7e213a70..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AlterShardingAuditorEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.auditor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter sharding auditor event.
- */
-public final class AlterShardingAuditorEvent extends AlterNamedRuleItemEvent {
-
- public AlterShardingAuditorEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/creator/AuditShardingEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AuditShardingEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/creator/AuditShardingEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AuditShardingEventCreator.java
index 9b64e3d1c61..2755483bc87 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/creator/AuditShardingEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/AuditShardingEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.algorithm.auditor.creator;
+package org.apache.shardingsphere.sharding.event.algorithm.auditor;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.auditor.AlterShardingAuditorEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.auditor.DropShardingAuditorEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingAuditorChangedGenerator;
/**
* Audit sharding event creator.
@@ -32,8 +33,8 @@ public final class AuditShardingEventCreator implements NamedRuleItemChangedEven
@Override
public RuleItemChangedEvent create(final String databaseName, final String algorithmName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingAuditorEvent(databaseName, algorithmName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, algorithmName, event.getKey(), event.getValue(), ShardingAuditorChangedGenerator.TYPE);
}
- return new DropShardingAuditorEvent(databaseName, algorithmName);
+ return new DropNamedRuleItemEvent(databaseName, algorithmName, ShardingAuditorChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/DropShardingAuditorEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/DropShardingAuditorEvent.java
deleted file mode 100644
index 7d518e8728e..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/auditor/DropShardingAuditorEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.auditor;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop sharding auditor event.
- */
-public final class DropShardingAuditorEvent extends DropNamedRuleItemEvent {
-
- public DropShardingAuditorEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/AlterKeyGeneratorEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/AlterKeyGeneratorEvent.java
deleted file mode 100644
index afd356a048c..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/AlterKeyGeneratorEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.keygenerator;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter key generate event.
- */
-public final class AlterKeyGeneratorEvent extends AlterNamedRuleItemEvent {
-
- public AlterKeyGeneratorEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/DropKeyGeneratorEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/DropKeyGeneratorEvent.java
deleted file mode 100644
index dcef645f108..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/DropKeyGeneratorEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.keygenerator;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop key generate event.
- */
-public final class DropKeyGeneratorEvent extends DropNamedRuleItemEvent {
-
- public DropKeyGeneratorEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/creator/KeyGeneratorEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/KeyGeneratorEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/creator/KeyGeneratorEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/KeyGeneratorEventCreator.java
index 7646dfe489f..b0bc23593f5 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/creator/KeyGeneratorEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/keygenerator/KeyGeneratorEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.algorithm.keygenerator.creator;
+package org.apache.shardingsphere.sharding.event.algorithm.keygenerator;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.AlterKeyGeneratorEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.DropKeyGeneratorEvent;
+import org.apache.shardingsphere.sharding.subscriber.KeyGeneratorChangedGenerator;
/**
* Key generator event creator.
@@ -32,8 +33,8 @@ public final class KeyGeneratorEventCreator implements NamedRuleItemChangedEvent
@Override
public RuleItemChangedEvent create(final String databaseName, final String algorithmName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterKeyGeneratorEvent(databaseName, algorithmName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, algorithmName, event.getKey(), event.getValue(), KeyGeneratorChangedGenerator.TYPE);
}
- return new DropKeyGeneratorEvent(databaseName, algorithmName);
+ return new DropNamedRuleItemEvent(databaseName, algorithmName, KeyGeneratorChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/AlterShardingAlgorithmEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/AlterShardingAlgorithmEvent.java
deleted file mode 100644
index 23762ddb197..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/AlterShardingAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.sharding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter sharding algorithm event.
- */
-public final class AlterShardingAlgorithmEvent extends AlterNamedRuleItemEvent {
-
- public AlterShardingAlgorithmEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/DropShardingAlgorithmEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/DropShardingAlgorithmEvent.java
deleted file mode 100644
index a12fc7be233..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/DropShardingAlgorithmEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.algorithm.sharding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop sharding algorithm event.
- */
-public final class DropShardingAlgorithmEvent extends DropNamedRuleItemEvent {
-
- public DropShardingAlgorithmEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/creator/ShardingAlgorithmEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/ShardingAlgorithmEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/creator/ShardingAlgorithmEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/ShardingAlgorithmEventCreator.java
index 927322cfd3d..a54287af159 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/creator/ShardingAlgorithmEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/algorithm/sharding/ShardingAlgorithmEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.algorithm.sharding.creator;
+package org.apache.shardingsphere.sharding.event.algorithm.sharding;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.algorithm.sharding.AlterShardingAlgorithmEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.sharding.DropShardingAlgorithmEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingAlgorithmChangedGenerator;
/**
* Sharding algorithm event creator.
@@ -32,8 +33,8 @@ public final class ShardingAlgorithmEventCreator implements NamedRuleItemChanged
@Override
public RuleItemChangedEvent create(final String databaseName, final String algorithmName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingAlgorithmEvent(databaseName, algorithmName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, algorithmName, event.getKey(), event.getValue(), ShardingAlgorithmChangedGenerator.TYPE);
}
- return new DropShardingAlgorithmEvent(databaseName, algorithmName);
+ return new DropNamedRuleItemEvent(databaseName, algorithmName, ShardingAlgorithmChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/AlterShardingCacheEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/AlterShardingCacheEvent.java
deleted file mode 100644
index dd2fca366e2..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/AlterShardingCacheEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.cache;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter sharding cache event.
- */
-public final class AlterShardingCacheEvent extends AlterUniqueRuleItemEvent {
-
- public AlterShardingCacheEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/DropShardingCacheEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/DropShardingCacheEvent.java
deleted file mode 100644
index 12c42e64914..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/DropShardingCacheEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.cache;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop sharding cache event.
- */
-public final class DropShardingCacheEvent extends DropUniqueRuleItemEvent {
-
- public DropShardingCacheEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/creator/ShardingCacheEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/ShardingCacheEventCreator.java
similarity index 72%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/creator/ShardingCacheEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/ShardingCacheEventCreator.java
index 393b27ab009..9fb617eb18e 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/creator/ShardingCacheEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/cache/ShardingCacheEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.cache.creator;
+package org.apache.shardingsphere.sharding.event.cache;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.cache.AlterShardingCacheEvent;
-import org.apache.shardingsphere.sharding.event.cache.DropShardingCacheEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingCacheChangedGenerator;
/**
* Sharding cache event creator.
@@ -32,8 +33,8 @@ public final class ShardingCacheEventCreator implements UniqueRuleItemChangedEve
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingCacheEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), ShardingCacheChangedGenerator.TYPE);
}
- return new DropShardingCacheEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, ShardingCacheChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/AlterDefaultShardingAuditorStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/AlterDefaultShardingAuditorStrategyEvent.java
deleted file mode 100644
index e50eac46596..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/AlterDefaultShardingAuditorStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.audit;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default sharding auditor strategy event.
- */
-public final class AlterDefaultShardingAuditorStrategyEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultShardingAuditorStrategyEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/creator/DefaultShardingAuditorStrategyEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DefaultShardingAuditorStrategyEventCreator.java
similarity index 71%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/creator/DefaultShardingAuditorStrategyEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DefaultShardingAuditorStrategyEventCreator.java
index b6ecc0cc7d5..07c3bfa6003 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/creator/DefaultShardingAuditorStrategyEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DefaultShardingAuditorStrategyEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.strategy.audit.creator;
+package org.apache.shardingsphere.sharding.event.strategy.audit;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.audit.AlterDefaultShardingAuditorStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.audit.DropDefaultShardingAuditorStrategyEvent;
+import org.apache.shardingsphere.sharding.subscriber.DefaultShardingAuditorStrategyChangedGenerator;
/**
* Default sharding auditor strategy event creator.
@@ -32,8 +33,8 @@ public final class DefaultShardingAuditorStrategyEventCreator implements UniqueR
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultShardingAuditorStrategyEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultShardingAuditorStrategyChangedGenerator.TYPE);
}
- return new DropDefaultShardingAuditorStrategyEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultShardingAuditorStrategyChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DropDefaultShardingAuditorStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DropDefaultShardingAuditorStrategyEvent.java
deleted file mode 100644
index f568a0ebc1b..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/audit/DropDefaultShardingAuditorStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.audit;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default sharding auditor strategy event.
- */
-public final class DropDefaultShardingAuditorStrategyEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultShardingAuditorStrategyEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/AlterDefaultDatabaseShardingStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/AlterDefaultDatabaseShardingStrategyEvent.java
deleted file mode 100644
index 216a6789f1b..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/AlterDefaultDatabaseShardingStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.database;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default database sharding strategy event.
- */
-public final class AlterDefaultDatabaseShardingStrategyEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultDatabaseShardingStrategyEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/creator/DefaultDatabaseShardingStrategyEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DefaultDatabaseShardingStrategyEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/creator/DefaultDatabaseShardingStrategyEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DefaultDatabaseShardingStrategyEventCreator.java
index 3ae6142168b..02fda6efacb 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/creator/DefaultDatabaseShardingStrategyEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DefaultDatabaseShardingStrategyEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.strategy.database.creator;
+package org.apache.shardingsphere.sharding.event.strategy.database;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.database.AlterDefaultDatabaseShardingStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.database.DropDefaultDatabaseShardingStrategyEvent;
+import org.apache.shardingsphere.sharding.subscriber.DefaultDatabaseShardingStrategyChangedGenerator;
/**
* Default database sharding strategy event creator.
@@ -32,8 +33,8 @@ public final class DefaultDatabaseShardingStrategyEventCreator implements Unique
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultDatabaseShardingStrategyEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultDatabaseShardingStrategyChangedGenerator.TYPE);
}
- return new DropDefaultDatabaseShardingStrategyEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultDatabaseShardingStrategyChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DropDefaultDatabaseShardingStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DropDefaultDatabaseShardingStrategyEvent.java
deleted file mode 100644
index b76762f7e9f..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/database/DropDefaultDatabaseShardingStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.database;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default database sharding strategy event.
- */
-public final class DropDefaultDatabaseShardingStrategyEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultDatabaseShardingStrategyEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/AlterDefaultKeyGenerateStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/AlterDefaultKeyGenerateStrategyEvent.java
deleted file mode 100644
index 4d1582c5443..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/AlterDefaultKeyGenerateStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.keygenerate;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default key generate strategy event.
- */
-public final class AlterDefaultKeyGenerateStrategyEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultKeyGenerateStrategyEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/creator/DefaultKeyGenerateStrategyEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DefaultKeyGenerateStrategyEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/creator/DefaultKeyGenerateStrategyEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DefaultKeyGenerateStrategyEventCreator.java
index 536f4403825..6bfb7293bba 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/creator/DefaultKeyGenerateStrategyEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DefaultKeyGenerateStrategyEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.strategy.keygenerate.creator;
+package org.apache.shardingsphere.sharding.event.strategy.keygenerate;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.keygenerate.AlterDefaultKeyGenerateStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.keygenerate.DropDefaultKeyGenerateStrategyEvent;
+import org.apache.shardingsphere.sharding.subscriber.DefaultKeyGenerateStrategyChangedGenerator;
/**
* Default key generate strategy event creator.
@@ -32,8 +33,8 @@ public final class DefaultKeyGenerateStrategyEventCreator implements UniqueRuleI
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultKeyGenerateStrategyEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultKeyGenerateStrategyChangedGenerator.TYPE);
}
- return new DropDefaultKeyGenerateStrategyEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultKeyGenerateStrategyChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DropDefaultKeyGenerateStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DropDefaultKeyGenerateStrategyEvent.java
deleted file mode 100644
index e02779bce99..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/keygenerate/DropDefaultKeyGenerateStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.keygenerate;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default key generate strategy event.
- */
-public final class DropDefaultKeyGenerateStrategyEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultKeyGenerateStrategyEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/AlterDefaultShardingColumnEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/AlterDefaultShardingColumnEvent.java
deleted file mode 100644
index f679f89934c..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/AlterDefaultShardingColumnEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.shardingcolumn;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default sharding column event.
- */
-public final class AlterDefaultShardingColumnEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultShardingColumnEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/creator/DefaultShardingColumnEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DefaultShardingColumnEventCreator.java
similarity index 74%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/creator/DefaultShardingColumnEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DefaultShardingColumnEventCreator.java
index d9f5464e08a..dcdb4352102 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/creator/DefaultShardingColumnEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DefaultShardingColumnEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.creator;
+package org.apache.shardingsphere.sharding.event.strategy.shardingcolumn;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.AlterDefaultShardingColumnEvent;
-import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.DropDefaultShardingColumnEvent;
+import org.apache.shardingsphere.sharding.subscriber.DefaultShardingColumnChangedGenerator;
/**
* Default sharding column event creator.
@@ -32,8 +33,8 @@ public final class DefaultShardingColumnEventCreator implements UniqueRuleItemCh
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultShardingColumnEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultShardingColumnChangedGenerator.TYPE);
}
- return new DropDefaultShardingColumnEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultShardingColumnChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DropDefaultShardingColumnEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DropDefaultShardingColumnEvent.java
deleted file mode 100644
index 5e52e2ee183..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/shardingcolumn/DropDefaultShardingColumnEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.shardingcolumn;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default sharding column event.
- */
-public final class DropDefaultShardingColumnEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultShardingColumnEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/AlterDefaultTableShardingStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/AlterDefaultTableShardingStrategyEvent.java
deleted file mode 100644
index e195170f3f7..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/AlterDefaultTableShardingStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter default database sharding strategy event.
- */
-public final class AlterDefaultTableShardingStrategyEvent extends AlterUniqueRuleItemEvent {
-
- public AlterDefaultTableShardingStrategyEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/creator/DefaultTableShardingStrategyEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DefaultTableShardingStrategyEventCreator.java
similarity index 71%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/creator/DefaultTableShardingStrategyEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DefaultTableShardingStrategyEventCreator.java
index 3eb1b304cae..8ef2b17266d 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/creator/DefaultTableShardingStrategyEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DefaultTableShardingStrategyEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.strategy.table.creator;
+package org.apache.shardingsphere.sharding.event.strategy.table;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.strategy.table.AlterDefaultTableShardingStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.table.DropDefaultTableShardingStrategyEvent;
+import org.apache.shardingsphere.sharding.subscriber.DefaultTableShardingStrategyChangedGenerator;
/**
* Default table sharding strategy event creator.
@@ -32,8 +33,8 @@ public final class DefaultTableShardingStrategyEventCreator implements UniqueRul
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterDefaultTableShardingStrategyEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), DefaultTableShardingStrategyChangedGenerator.TYPE);
}
- return new DropDefaultTableShardingStrategyEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, DefaultTableShardingStrategyChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DropDefaultTableShardingStrategyEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DropDefaultTableShardingStrategyEvent.java
deleted file mode 100644
index 58454ea1391..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/strategy/table/DropDefaultTableShardingStrategyEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.strategy.table;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop default database sharding strategy event.
- */
-public final class DropDefaultTableShardingStrategyEvent extends DropUniqueRuleItemEvent {
-
- public DropDefaultTableShardingStrategyEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/AlterShardingAutoTableEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/AlterShardingAutoTableEvent.java
deleted file mode 100644
index 0f2c6a315b8..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/AlterShardingAutoTableEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.auto;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter sharding auto table event.
- */
-public final class AlterShardingAutoTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterShardingAutoTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/DropShardingAutoTableEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/DropShardingAutoTableEvent.java
deleted file mode 100644
index 4164a3857ba..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/DropShardingAutoTableEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.auto;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop sharding auto table event.
- */
-public final class DropShardingAutoTableEvent extends DropNamedRuleItemEvent {
-
- public DropShardingAutoTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/creator/ShardingAutoTableEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/ShardingAutoTableEventCreator.java
similarity index 71%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/creator/ShardingAutoTableEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/ShardingAutoTableEventCreator.java
index cdb38df92fb..a80f8b113bd 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/creator/ShardingAutoTableEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/auto/ShardingAutoTableEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.table.auto.creator;
+package org.apache.shardingsphere.sharding.event.table.auto;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.table.auto.AlterShardingAutoTableEvent;
-import org.apache.shardingsphere.sharding.event.table.auto.DropShardingAutoTableEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingAutoTableChangedGenerator;
/**
* Sharding auto table event creator.
@@ -32,8 +33,8 @@ public final class ShardingAutoTableEventCreator implements NamedRuleItemChanged
@Override
public RuleItemChangedEvent create(final String databaseName, final String tableName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingAutoTableEvent(databaseName, tableName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, tableName, event.getKey(), event.getValue(), ShardingAutoTableChangedGenerator.TYPE);
}
- return new DropShardingAutoTableEvent(databaseName, tableName);
+ return new DropNamedRuleItemEvent(databaseName, tableName, ShardingAutoTableChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/AlterShardingTableReferenceEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/AlterShardingTableReferenceEvent.java
deleted file mode 100644
index 65d518e2232..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/AlterShardingTableReferenceEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.binding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter sharding table reference event.
- */
-public final class AlterShardingTableReferenceEvent extends AlterNamedRuleItemEvent {
-
- public AlterShardingTableReferenceEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/DropShardingTableReferenceEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/DropShardingTableReferenceEvent.java
deleted file mode 100644
index 1d385148c2b..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/DropShardingTableReferenceEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.binding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop sharding table reference event.
- */
-public final class DropShardingTableReferenceEvent extends DropNamedRuleItemEvent {
-
- public DropShardingTableReferenceEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/creator/ShardingTableReferenceEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/ShardingTableReferenceEventCreator.java
similarity index 71%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/creator/ShardingTableReferenceEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/ShardingTableReferenceEventCreator.java
index 956113f49be..6d3d9bf28f5 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/creator/ShardingTableReferenceEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/binding/ShardingTableReferenceEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.table.binding.creator;
+package org.apache.shardingsphere.sharding.event.table.binding;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.table.binding.AlterShardingTableReferenceEvent;
-import org.apache.shardingsphere.sharding.event.table.binding.DropShardingTableReferenceEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingTableReferenceChangedGenerator;
/**
* Sharding table reference creator.
@@ -32,8 +33,8 @@ public final class ShardingTableReferenceEventCreator implements NamedRuleItemCh
@Override
public RuleItemChangedEvent create(final String databaseName, final String tableName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingTableReferenceEvent(databaseName, tableName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, tableName, event.getKey(), event.getValue(), ShardingTableReferenceChangedGenerator.TYPE);
}
- return new DropShardingTableReferenceEvent(databaseName, tableName);
+ return new DropNamedRuleItemEvent(databaseName, tableName, ShardingTableReferenceChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/AlterShardingTableEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/AlterShardingTableEvent.java
deleted file mode 100644
index ba69b453ed1..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/AlterShardingTableEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.sharding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
-
-/**
- * Alter sharding table event.
- */
-public final class AlterShardingTableEvent extends AlterNamedRuleItemEvent {
-
- public AlterShardingTableEvent(final String databaseName, final String itemName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, itemName, activeVersionKey, activeVersion);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/DropShardingTableEvent.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/DropShardingTableEvent.java
deleted file mode 100644
index 36f64f6e2b1..00000000000
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/DropShardingTableEvent.java
+++ /dev/null
@@ -1,30 +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.sharding.event.table.sharding;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
-
-/**
- * Drop sharding table event.
- */
-public final class DropShardingTableEvent extends DropNamedRuleItemEvent {
-
- public DropShardingTableEvent(final String databaseName, final String itemName) {
- super(databaseName, itemName);
- }
-}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/creator/ShardingTableEventCreator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/ShardingTableEventCreator.java
similarity index 72%
rename from features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/creator/ShardingTableEventCreator.java
rename to features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/ShardingTableEventCreator.java
index 75357700c37..6885cddaae8 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/creator/ShardingTableEventCreator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/event/table/sharding/ShardingTableEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.event.table.sharding.creator;
+package org.apache.shardingsphere.sharding.event.table.sharding;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterNamedRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropNamedRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.NamedRuleItemChangedEventCreator;
-import org.apache.shardingsphere.sharding.event.table.sharding.AlterShardingTableEvent;
-import org.apache.shardingsphere.sharding.event.table.sharding.DropShardingTableEvent;
+import org.apache.shardingsphere.sharding.subscriber.ShardingTableChangedGenerator;
/**
* Sharding table event creator.
@@ -32,8 +33,8 @@ public final class ShardingTableEventCreator implements NamedRuleItemChangedEven
@Override
public RuleItemChangedEvent create(final String databaseName, final String tableName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterShardingTableEvent(databaseName, tableName, event.getKey(), event.getValue());
+ return new AlterNamedRuleItemEvent(databaseName, tableName, event.getKey(), event.getValue(), ShardingTableChangedGenerator.TYPE);
}
- return new DropShardingTableEvent(databaseName, tableName);
+ return new DropNamedRuleItemEvent(databaseName, tableName, ShardingTableChangedGenerator.TYPE);
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultDatabaseShardingStrategyChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultDatabaseShardingStrategyChangedGenerator.java
index be4ef40b346..d9a3c0e6b4e 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultDatabaseShardingStrategyChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultDatabaseShardingStrategyChangedGenerator.java
@@ -24,20 +24,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import org.apache.shardingsphere.sharding.event.strategy.database.AlterDefaultDatabaseShardingStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.database.DropDefaultDatabaseShardingStrategyEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingStrategyConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default database sharding strategy changed generator.
*/
public final class DefaultDatabaseShardingStrategyChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingStrategyConfiguration> {
+ public static final String TYPE = "Sharding.DefaultDatabaseShardingStrategy";
+
@Override
public ShardingStrategyConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingStrategyConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShardingStrategyConfiguration.class));
@@ -60,11 +57,6 @@ public final class DefaultDatabaseShardingStrategyChangedGenerator implements Ru
@Override
public String getType() {
- return AlterDefaultDatabaseShardingStrategyEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultDatabaseShardingStrategyEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultKeyGenerateStrategyChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultKeyGenerateStrategyChangedGenerator.java
index 4a21148e77a..c085484dfa0 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultKeyGenerateStrategyChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultKeyGenerateStrategyChangedGenerator.java
@@ -24,20 +24,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
-import org.apache.shardingsphere.sharding.event.strategy.keygenerate.AlterDefaultKeyGenerateStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.keygenerate.DropDefaultKeyGenerateStrategyEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlKeyGenerateStrategyConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default key generate strategy changed generator.
*/
public final class DefaultKeyGenerateStrategyChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, KeyGenerateStrategyConfiguration> {
+ public static final String TYPE = "Sharding.DefaultKeyGenerateStrategy";
+
@Override
public KeyGenerateStrategyConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlKeyGenerateStrategyConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlKeyGenerateStrategyConfiguration.class));
@@ -60,11 +57,6 @@ public final class DefaultKeyGenerateStrategyChangedGenerator implements RuleIte
@Override
public String getType() {
- return AlterDefaultKeyGenerateStrategyEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultKeyGenerateStrategyEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingAuditorStrategyChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingAuditorStrategyChangedGenerator.java
index dc443438ff1..c8ce85dff4d 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingAuditorStrategyChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingAuditorStrategyChangedGenerator.java
@@ -24,20 +24,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration;
-import org.apache.shardingsphere.sharding.event.strategy.audit.AlterDefaultShardingAuditorStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.audit.DropDefaultShardingAuditorStrategyEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.strategy.audit.YamlShardingAuditStrategyConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingAuditStrategyConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default sharding auditor strategy changed generator.
*/
public final class DefaultShardingAuditorStrategyChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingAuditStrategyConfiguration> {
+ public static final String TYPE = "Sharding.DefaultShardingAuditorStrategy";
+
@Override
public ShardingAuditStrategyConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingAuditStrategyConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShardingAuditStrategyConfiguration.class));
@@ -60,11 +57,6 @@ public final class DefaultShardingAuditorStrategyChangedGenerator implements Rul
@Override
public String getType() {
- return AlterDefaultShardingAuditorStrategyEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultShardingAuditorStrategyEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingColumnChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingColumnChangedGenerator.java
index 0037b667ad1..33caa6fc4db 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingColumnChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultShardingColumnChangedGenerator.java
@@ -22,18 +22,15 @@ import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterRuleItemEvent;
import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.AlterDefaultShardingColumnEvent;
-import org.apache.shardingsphere.sharding.event.strategy.shardingcolumn.DropDefaultShardingColumnEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default sharding column changed generator.
*/
public final class DefaultShardingColumnChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, String> {
+ public static final String TYPE = "Sharding.DefaultShardingColumn";
+
@Override
public String swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return yamlContent;
@@ -56,11 +53,6 @@ public final class DefaultShardingColumnChangedGenerator implements RuleItemConf
@Override
public String getType() {
- return AlterDefaultShardingColumnEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultShardingColumnEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultTableShardingStrategyChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultTableShardingStrategyChangedGenerator.java
index 0db5248d5b1..44c014538f4 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultTableShardingStrategyChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/DefaultTableShardingStrategyChangedGenerator.java
@@ -24,20 +24,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import org.apache.shardingsphere.sharding.event.strategy.table.AlterDefaultTableShardingStrategyEvent;
-import org.apache.shardingsphere.sharding.event.strategy.table.DropDefaultTableShardingStrategyEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingStrategyConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Default table sharding strategy changed generator.
*/
public final class DefaultTableShardingStrategyChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingStrategyConfiguration> {
+ public static final String TYPE = "Sharding.DefaultTableShardingStrategy";
+
@Override
public ShardingStrategyConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingStrategyConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShardingStrategyConfiguration.class));
@@ -60,11 +57,6 @@ public final class DefaultTableShardingStrategyChangedGenerator implements RuleI
@Override
public String getType() {
- return AlterDefaultTableShardingStrategyEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropDefaultTableShardingStrategyEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/KeyGeneratorChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/KeyGeneratorChangedGenerator.java
index 55472e13140..e01ef4e6f69 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/KeyGeneratorChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/KeyGeneratorChangedGenerator.java
@@ -28,18 +28,15 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.AlterKeyGeneratorEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.keygenerator.DropKeyGeneratorEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Key generator changed generator.
*/
public final class KeyGeneratorChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Sharding.KeyGenerator";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -62,11 +59,6 @@ public final class KeyGeneratorChangedGenerator implements RuleItemConfiguration
@Override
public String getType() {
- return AlterKeyGeneratorEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropKeyGeneratorEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAlgorithmChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAlgorithmChangedGenerator.java
index 4474de3dbd0..726d8e45b39 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAlgorithmChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAlgorithmChangedGenerator.java
@@ -28,18 +28,15 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.algorithm.sharding.AlterShardingAlgorithmEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.sharding.DropShardingAlgorithmEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding algorithm changed generator.
*/
public final class ShardingAlgorithmChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Sharding.Algorithm";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -62,11 +59,6 @@ public final class ShardingAlgorithmChangedGenerator implements RuleItemConfigur
@Override
public String getType() {
- return AlterShardingAlgorithmEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingAlgorithmEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAuditorChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAuditorChangedGenerator.java
index fb26b30282f..9f8f4e8845d 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAuditorChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAuditorChangedGenerator.java
@@ -28,18 +28,15 @@ import org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmC
import org.apache.shardingsphere.infra.yaml.config.swapper.algorithm.YamlAlgorithmConfigurationSwapper;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.algorithm.auditor.AlterShardingAuditorEvent;
-import org.apache.shardingsphere.sharding.event.algorithm.auditor.DropShardingAuditorEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding auditor changed generator.
*/
public final class ShardingAuditorChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, AlgorithmConfiguration> {
+ public static final String TYPE = "Sharding.Auditor";
+
@Override
public AlgorithmConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlAlgorithmConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlAlgorithmConfiguration.class));
@@ -62,11 +59,6 @@ public final class ShardingAuditorChangedGenerator implements RuleItemConfigurat
@Override
public String getType() {
- return AlterShardingAuditorEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingAuditorEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAutoTableChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAutoTableChangedGenerator.java
index d5fec5b2068..f86ca3480ab 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAutoTableChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingAutoTableChangedGenerator.java
@@ -26,20 +26,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.table.auto.AlterShardingAutoTableEvent;
-import org.apache.shardingsphere.sharding.event.table.auto.DropShardingAutoTableEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.rule.YamlShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingAutoTableRuleConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding auto table changed generator.
*/
public final class ShardingAutoTableChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingAutoTableRuleConfiguration> {
+ public static final String TYPE = "Sharding.AutoTable";
+
@Override
public ShardingAutoTableRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingAutoTableRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShardingAutoTableRuleConfiguration.class));
@@ -63,11 +60,6 @@ public final class ShardingAutoTableChangedGenerator implements RuleItemConfigur
@Override
public String getType() {
- return AlterShardingAutoTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingAutoTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingCacheChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingCacheChangedGenerator.java
index 88dfdb0a6e0..2d038c5a98c 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingCacheChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingCacheChangedGenerator.java
@@ -24,20 +24,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.cache.ShardingCacheConfiguration;
-import org.apache.shardingsphere.sharding.event.cache.AlterShardingCacheEvent;
-import org.apache.shardingsphere.sharding.event.cache.DropShardingCacheEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.cache.YamlShardingCacheConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding cache changed generator.
*/
public final class ShardingCacheChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingCacheConfiguration> {
+ public static final String TYPE = "Sharding.Cache";
+
@Override
public ShardingCacheConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingCacheConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlShardingCacheConfiguration.class));
@@ -60,11 +57,6 @@ public final class ShardingCacheChangedGenerator implements RuleItemConfiguratio
@Override
public String getType() {
- return AlterShardingCacheEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingCacheEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableChangedGenerator.java
index 24c26354951..1c5dce08ba2 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableChangedGenerator.java
@@ -26,20 +26,17 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.table.sharding.AlterShardingTableEvent;
-import org.apache.shardingsphere.sharding.event.table.sharding.DropShardingTableEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
import org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableRuleConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding table changed generator.
*/
public final class ShardingTableChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingTableRuleConfiguration> {
+ public static final String TYPE = "Sharding.Table";
+
@Override
public ShardingTableRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlShardingTableRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlTableRuleConfiguration.class));
@@ -63,11 +60,6 @@ public final class ShardingTableChangedGenerator implements RuleItemConfiguratio
@Override
public String getType() {
- return AlterShardingTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableReferenceChangedGenerator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableReferenceChangedGenerator.java
index 184ad92f8da..40d59164754 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableReferenceChangedGenerator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/subscriber/ShardingTableReferenceChangedGenerator.java
@@ -25,19 +25,16 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
-import org.apache.shardingsphere.sharding.event.table.binding.AlterShardingTableReferenceEvent;
-import org.apache.shardingsphere.sharding.event.table.binding.DropShardingTableReferenceEvent;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableReferenceRuleConfigurationConverter;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Sharding table reference changed generator.
*/
public final class ShardingTableReferenceChangedGenerator implements RuleItemConfigurationChangedGenerator<ShardingRuleConfiguration, ShardingTableReferenceRuleConfiguration> {
+ public static final String TYPE = "Sharding.TableReference";
+
@Override
public ShardingTableReferenceRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return YamlShardingTableReferenceRuleConfigurationConverter.convertToObject(yamlContent);
@@ -61,11 +58,6 @@ public final class ShardingTableReferenceChangedGenerator implements RuleItemCon
@Override
public String getType() {
- return AlterShardingTableReferenceEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropShardingTableReferenceEvent.class.getName());
+ return TYPE;
}
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/RuleItemChangedEvent.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/RuleItemChangedEvent.java
index aa54e8fb6db..1d24c4938e6 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/RuleItemChangedEvent.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/RuleItemChangedEvent.java
@@ -23,4 +23,11 @@ import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
* Rule item changed event.
*/
public interface RuleItemChangedEvent extends GovernanceEvent {
+
+ /**
+ * Get rule item type.
+ *
+ * @return rule item type
+ */
+ String getType();
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterNamedRuleItemEvent.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterNamedRuleItemEvent.java
index 2b4e8e15fcf..f6693f87d64 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterNamedRuleItemEvent.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterNamedRuleItemEvent.java
@@ -25,7 +25,7 @@ import lombok.RequiredArgsConstructor;
*/
@RequiredArgsConstructor
@Getter
-public class AlterNamedRuleItemEvent implements AlterRuleItemEvent {
+public final class AlterNamedRuleItemEvent implements AlterRuleItemEvent {
private final String databaseName;
@@ -34,4 +34,6 @@ public class AlterNamedRuleItemEvent implements AlterRuleItemEvent {
private final String activeVersionKey;
private final String activeVersion;
+
+ private final String type;
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterUniqueRuleItemEvent.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterUniqueRuleItemEvent.java
index a90409befe4..3fd74324b8c 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterUniqueRuleItemEvent.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/alter/AlterUniqueRuleItemEvent.java
@@ -25,11 +25,13 @@ import lombok.RequiredArgsConstructor;
*/
@RequiredArgsConstructor
@Getter
-public class AlterUniqueRuleItemEvent implements AlterRuleItemEvent {
+public final class AlterUniqueRuleItemEvent implements AlterRuleItemEvent {
private final String databaseName;
private final String activeVersionKey;
private final String activeVersion;
+
+ private final String type;
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropNamedRuleItemEvent.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropNamedRuleItemEvent.java
index f0dfb3d8388..6578d831036 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropNamedRuleItemEvent.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropNamedRuleItemEvent.java
@@ -25,9 +25,11 @@ import lombok.RequiredArgsConstructor;
*/
@RequiredArgsConstructor
@Getter
-public class DropNamedRuleItemEvent implements DropRuleItemEvent {
+public final class DropNamedRuleItemEvent implements DropRuleItemEvent {
private final String databaseName;
private final String itemName;
+
+ private final String type;
}
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropUniqueRuleItemEvent.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropUniqueRuleItemEvent.java
index 65ec5501bea..71afab76e64 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropUniqueRuleItemEvent.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/rule/event/rule/drop/DropUniqueRuleItemEvent.java
@@ -25,7 +25,9 @@ import lombok.RequiredArgsConstructor;
*/
@RequiredArgsConstructor
@Getter
-public class DropUniqueRuleItemEvent implements DropRuleItemEvent {
+public final class DropUniqueRuleItemEvent implements DropRuleItemEvent {
private final String databaseName;
+
+ private final String type;
}
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/SingleRuleChangedEventCreator.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/SingleRuleChangedEventCreator.java
index bf3b587f75b..ebd8c620bf7 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/SingleRuleChangedEventCreator.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/SingleRuleChangedEventCreator.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.rule.event.GovernanceEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
import org.apache.shardingsphere.mode.spi.RuleChangedEventCreator;
-import org.apache.shardingsphere.single.event.config.creator.SingleTableEventCreator;
+import org.apache.shardingsphere.single.event.config.SingleTableEventCreator;
import org.apache.shardingsphere.single.metadata.nodepath.SingleRuleNodePathProvider;
/**
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/AlterSingleTableEvent.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/AlterSingleTableEvent.java
deleted file mode 100644
index 93e0d288199..00000000000
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/AlterSingleTableEvent.java
+++ /dev/null
@@ -1,30 +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.single.event.config;
-
-import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
-
-/**
- * Alter single table event.
- */
-public final class AlterSingleTableEvent extends AlterUniqueRuleItemEvent {
-
- public AlterSingleTableEvent(final String databaseName, final String activeVersionKey, final String activeVersion) {
- super(databaseName, activeVersionKey, activeVersion);
- }
-}
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/DropSingleTableEvent.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/DropSingleTableEvent.java
deleted file mode 100644
index fb6ceb9b415..00000000000
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/DropSingleTableEvent.java
+++ /dev/null
@@ -1,30 +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.single.event.config;
-
-import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
-
-/**
- * Drop single table event.
- */
-public final class DropSingleTableEvent extends DropUniqueRuleItemEvent {
-
- public DropSingleTableEvent(final String databaseName) {
- super(databaseName);
- }
-}
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/creator/SingleTableEventCreator.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/SingleTableEventCreator.java
similarity index 73%
rename from kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/creator/SingleTableEventCreator.java
rename to kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/SingleTableEventCreator.java
index 8ce1e661211..0d5500d4523 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/creator/SingleTableEventCreator.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/event/config/SingleTableEventCreator.java
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.single.event.config.creator;
+package org.apache.shardingsphere.single.event.config;
import org.apache.shardingsphere.infra.rule.event.rule.RuleItemChangedEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.alter.AlterUniqueRuleItemEvent;
+import org.apache.shardingsphere.infra.rule.event.rule.drop.DropUniqueRuleItemEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.event.UniqueRuleItemChangedEventCreator;
-import org.apache.shardingsphere.single.event.config.AlterSingleTableEvent;
-import org.apache.shardingsphere.single.event.config.DropSingleTableEvent;
+import org.apache.shardingsphere.single.subscriber.SingleTableChangedGenerator;
/**
* Single table event creator.
@@ -32,8 +33,8 @@ public final class SingleTableEventCreator implements UniqueRuleItemChangedEvent
@Override
public RuleItemChangedEvent create(final String databaseName, final DataChangedEvent event) {
if (Type.ADDED == event.getType() || Type.UPDATED == event.getType()) {
- return new AlterSingleTableEvent(databaseName, event.getKey(), event.getValue());
+ return new AlterUniqueRuleItemEvent(databaseName, event.getKey(), event.getValue(), SingleTableChangedGenerator.TYPE);
}
- return new DropSingleTableEvent(databaseName);
+ return new DropUniqueRuleItemEvent(databaseName, SingleTableChangedGenerator.TYPE);
}
}
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/subscriber/SingleTableChangedGenerator.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/subscriber/SingleTableChangedGenerator.java
index 8b8af1a0f59..bdf9e6d064a 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/subscriber/SingleTableChangedGenerator.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/subscriber/SingleTableChangedGenerator.java
@@ -23,20 +23,17 @@ import org.apache.shardingsphere.infra.rule.event.rule.drop.DropRuleItemEvent;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.subsciber.RuleItemConfigurationChangedGenerator;
import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration;
-import org.apache.shardingsphere.single.event.config.AlterSingleTableEvent;
-import org.apache.shardingsphere.single.event.config.DropSingleTableEvent;
import org.apache.shardingsphere.single.rule.SingleRule;
import org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration;
import org.apache.shardingsphere.single.yaml.config.swapper.YamlSingleRuleConfigurationSwapper;
-import java.util.Collection;
-import java.util.Collections;
-
/**
* Single table changed generator.
*/
public final class SingleTableChangedGenerator implements RuleItemConfigurationChangedGenerator<SingleRuleConfiguration, SingleRuleConfiguration> {
+ public static final String TYPE = "Single.Table";
+
@Override
public SingleRuleConfiguration swapRuleItemConfigurationFromEvent(final AlterRuleItemEvent event, final String yamlContent) {
return new YamlSingleRuleConfigurationSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlSingleRuleConfiguration.class));
@@ -62,11 +59,6 @@ public final class SingleTableChangedGenerator implements RuleItemConfigurationC
@Override
public String getType() {
- return AlterSingleTableEvent.class.getName();
- }
-
- @Override
- public Collection<String> getTypeAliases() {
- return Collections.singleton(DropSingleTableEvent.class.getName());
+ return TYPE;
}
}
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
index e8fdeacc773..ce6fabee390 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
@@ -43,7 +43,7 @@ public final class RuleItemChangedSubscriber {
@SuppressWarnings({"UnstableApiUsage", "rawtypes", "unchecked"})
@Subscribe
public void renew(final AlterRuleItemEvent event) {
- RuleItemConfigurationChangedGenerator generator = TypedSPILoader.getService(RuleItemConfigurationChangedGenerator.class, event.getClass().getName());
+ RuleItemConfigurationChangedGenerator generator = TypedSPILoader.getService(RuleItemConfigurationChangedGenerator.class, event.getType());
if (!event.getActiveVersion().equals(contextManager.getInstanceContext().getModeContextManager().getActiveVersionByKey(event.getActiveVersionKey()))) {
return;
}
@@ -64,7 +64,7 @@ public final class RuleItemChangedSubscriber {
@SuppressWarnings({"UnstableApiUsage", "rawtypes", "unchecked"})
@Subscribe
public void renew(final DropRuleItemEvent event) {
- RuleItemConfigurationChangedGenerator generator = TypedSPILoader.getService(RuleItemConfigurationChangedGenerator.class, event.getClass().getName());
+ RuleItemConfigurationChangedGenerator generator = TypedSPILoader.getService(RuleItemConfigurationChangedGenerator.class, event.getType());
if (!contextManager.getMetaDataContexts().getMetaData().containsDatabase(event.getDatabaseName())) {
return;
}