From 9696b7188828d8806e0b5154ea431e367727676f Mon Sep 17 00:00:00 2001 From: shiyiue1102 Date: Wed, 21 Dec 2022 14:49:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9request=20response=20?= =?UTF-8?q?=E7=B1=BB=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E7=B1=BB=E6=89=AB=E6=8F=8F=E6=94=B9=E6=88=90=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../remote/request/RequestRegistry.java | 49 +++++++++++++++++ .../request/cluster/RequestRegistry.java | 43 +++++++++++++++ .../remote/response/ResponseRegistry.java | 47 ++++++++++++++++ .../response/cluster/ResponseRegistry.java | 42 ++++++++++++++ .../remote/request/RequestRegistry.java | 49 +++++++++++++++++ .../remote/response/ResponseRegistry.java | 47 ++++++++++++++++ .../api/remote/request/RequestRegistry.java | 52 ++++++++++++++++++ .../api/remote/response/ResponseRegistry.java | 49 +++++++++++++++++ .../remote/ClientPayloadPackageProvider.java | 46 ---------------- .../remote/ClientPayloadPackageRegistry.java | 55 +++++++++++++++++++ ...nacos.common.remote.PayloadPackageRegistry | 17 ++++++ ...acos.common.remote.PayloadPackageRegistry} | 2 +- ...vider.java => PayloadPackageRegistry.java} | 7 ++- .../nacos/common/remote/PayloadRegistry.java | 18 +++--- .../remote/MockPayloadPackageProvider.java | 40 -------------- .../remote/MockPayloadPackageRegistry.java | 42 ++++++++++++++ ...acos.common.remote.PayloadPackageRegistry} | 2 +- .../remote/ConfigPayloadPackageProvider.java | 44 --------------- .../remote/ConfigPayloadPackageRegistry.java | 54 ++++++++++++++++++ ...nacos.common.remote.PayloadPackageRegistry | 17 ++++++ ...nacos.common.remote.PayloadPackageProvider | 18 ------ ...acos.common.remote.PayloadPackageRegistry} | 2 +- .../remote/MockPayloadPackageProvider.java | 48 ---------------- .../remote/MockPayloadPackageRegistry.java | 48 ++++++++++++++++ ...acos.common.remote.PayloadPackageRegistry} | 2 +- .../remote/request/RequestRegistry.java | 43 +++++++++++++++ .../remote/response/ResponseRegistry.java | 42 ++++++++++++++ .../rpc/NamingPayloadPackageProvider.java | 46 ---------------- .../rpc/NamingPayloadPackageRegistry.java | 53 ++++++++++++++++++ ...nacos.common.remote.PayloadPackageProvider | 18 ------ ...nacos.common.remote.PayloadPackageRegistry | 17 ++++++ ...nacos.common.remote.PayloadPackageProvider | 18 ------ ...nacos.common.remote.PayloadPackageRegistry | 2 +- 33 files changed, 783 insertions(+), 296 deletions(-) create mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java create mode 100644 api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java delete mode 100644 client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageProvider.java create mode 100644 client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java create mode 100644 client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry rename client/src/{main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider => test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry} (91%) rename common/src/main/java/com/alibaba/nacos/common/remote/{PayloadPackageProvider.java => PayloadPackageRegistry.java} (84%) delete mode 100644 common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageProvider.java create mode 100644 common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java rename common/src/test/resources/META-INF/services/{com.alibaba.nacos.common.remote.PayloadPackageProvider => com.alibaba.nacos.common.remote.PayloadPackageRegistry} (91%) delete mode 100644 config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageProvider.java create mode 100644 config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java create mode 100644 config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename config/src/{main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider => test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry} (90%) delete mode 100644 core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageProvider.java create mode 100644 core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java rename core/src/test/resources/META-INF/services/{com.alibaba.nacos.common.remote.PayloadPackageProvider => com.alibaba.nacos.common.remote.PayloadPackageRegistry} (91%) create mode 100644 naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/request/RequestRegistry.java create mode 100644 naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/response/ResponseRegistry.java delete mode 100644 naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageProvider.java create mode 100644 naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java delete mode 100644 naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider create mode 100644 naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider => naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry (90%) diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java new file mode 100644 index 00000000000..830444a67e0 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java @@ -0,0 +1,49 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.config.remote.request; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class RequestRegistry { + + private static Set> payloads = registryPayload(); + + private static Set> registryPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(AbstractConfigRequest.class); + payloads.add(ClientConfigMetricRequest.class); + payloads.add(ConfigBatchListenRequest.class); + payloads.add(ConfigChangeNotifyRequest.class); + payloads.add(ConfigPublishRequest.class); + payloads.add(ConfigQueryRequest.class); + payloads.add(ConfigRemoveRequest.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } + +} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java new file mode 100644 index 00000000000..c8fe7f3cd0a --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java @@ -0,0 +1,43 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.config.remote.request.cluster; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class RequestRegistry { + + private static Set> payloads = registryPayload(); + + private static Set> registryPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(ConfigChangeClusterSyncRequest.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } + +} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java new file mode 100644 index 00000000000..f507b20f505 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java @@ -0,0 +1,47 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.config.remote.response; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class ResponseRegistry { + + private static Set> payloads = getPayload(); + + private static Set> getPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(ClientConfigMetricResponse.class); + payloads.add(ConfigChangeBatchListenResponse.class); + payloads.add(ConfigChangeNotifyResponse.class); + payloads.add(ConfigPublishResponse.class); + payloads.add(ConfigQueryResponse.class); + payloads.add(ConfigRemoveResponse.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java new file mode 100644 index 00000000000..571bdc4db95 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java @@ -0,0 +1,42 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.config.remote.response.cluster; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class ResponseRegistry { + + private static Set> payloads = getPayload(); + + private static Set> getPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(ConfigChangeClusterSyncResponse.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java new file mode 100644 index 00000000000..768523e8478 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java @@ -0,0 +1,49 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.naming.remote.request; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class RequestRegistry { + + private static Set> payloads = registryPayload(); + + private static Set> registryPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(AbstractNamingRequest.class); + payloads.add(BatchInstanceRequest.class); + payloads.add(InstanceRequest.class); + payloads.add(NotifySubscriberRequest.class); + payloads.add(ServiceListRequest.class); + payloads.add(ServiceQueryRequest.class); + payloads.add(SubscribeServiceRequest.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } + +} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java new file mode 100644 index 00000000000..e924f26ca78 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java @@ -0,0 +1,47 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.naming.remote.response; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class ResponseRegistry { + + private static Set> payloads = getPayload(); + + private static final Set> getPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(BatchInstanceResponse.class); + payloads.add(InstanceResponse.class); + payloads.add(NotifySubscriberResponse.class); + payloads.add(QueryServiceResponse.class); + payloads.add(ServiceListResponse.class); + payloads.add(SubscribeServiceResponse.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java new file mode 100644 index 00000000000..1144531affe --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java @@ -0,0 +1,52 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.remote.request; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * request payload registry. + * @author shiyiyue + */ +public class RequestRegistry { + + private static Set> payloads = registryPayload(); + + private static Set> registryPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(InternalRequest.class); + payloads.add(Request.class); + payloads.add(ServerRequest.class); + payloads.add(ClientDetectionRequest.class); + payloads.add(ConnectionSetupRequest.class); + payloads.add(ConnectResetRequest.class); + payloads.add(HealthCheckRequest.class); + payloads.add(PushAckRequest.class); + payloads.add(ServerCheckRequest.class); + payloads.add(ServerLoaderInfoRequest.class); + payloads.add(ServerReloadRequest.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } + +} diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java new file mode 100644 index 00000000000..dee528af9e3 --- /dev/null +++ b/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java @@ -0,0 +1,49 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.api.remote.response; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class ResponseRegistry { + + private static Set> payloads = getPayload(); + + private static Set> getPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(Response.class); + payloads.add(ClientDetectionResponse.class); + payloads.add(ConnectResetResponse.class); + payloads.add(ErrorResponse.class); + payloads.add(HealthCheckResponse.class); + payloads.add(ServerCheckResponse.class); + payloads.add(ServerLoaderInfoResponse.class); + payloads.add(ServerReloadResponse.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageProvider.java b/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageProvider.java deleted file mode 100644 index ef153062e54..00000000000 --- a/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.client.remote; - -import com.alibaba.nacos.common.remote.PayloadPackageProvider; - -import java.util.HashSet; -import java.util.Set; - -/** - * client package provider. - * - * @author hujun - */ -public class ClientPayloadPackageProvider implements PayloadPackageProvider { - - private final Set scanPackage = new HashSet<>(); - - { - scanPackage.add("com.alibaba.nacos.api.naming.remote.request"); - scanPackage.add("com.alibaba.nacos.api.remote.request"); - scanPackage.add("com.alibaba.nacos.api.config.remote.request"); - scanPackage.add("com.alibaba.nacos.api.naming.remote.response"); - scanPackage.add("com.alibaba.nacos.api.config.remote.response"); - scanPackage.add("com.alibaba.nacos.api.remote.response"); - } - - @Override - public Set getScanPackage() { - return scanPackage; - } -} diff --git a/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java b/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java new file mode 100644 index 00000000000..2e4b17354dd --- /dev/null +++ b/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java @@ -0,0 +1,55 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.client.remote; + +import com.alibaba.nacos.api.remote.Payload; +import com.alibaba.nacos.common.remote.PayloadPackageRegistry; + +import java.util.HashSet; +import java.util.Set; + +/** + * client payload package registry. + * + * @author shiyiyue + */ +public class ClientPayloadPackageRegistry implements PayloadPackageRegistry { + + @Override + public Set> getPackagePayloads() { + HashSet> payloads = new HashSet<>(); + + //com.alibaba.nacos.api.remote.request + payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.remote.response + payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.config.remote.request + payloads.addAll(com.alibaba.nacos.api.config.remote.request.RequestRegistry.getPayloads()); + + //com.alibaba.nacos.api.config.remote.response + payloads.addAll(com.alibaba.nacos.api.config.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.request + payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.response + payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); + + return payloads; + } +} diff --git a/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry new file mode 100644 index 00000000000..69d5df1a385 --- /dev/null +++ b/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -0,0 +1,17 @@ +# +# Copyright 1999-2020 Alibaba Group Holding Ltd. +# +# Licensed 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. +# + +com.alibaba.nacos.client.remote.ClientPayloadPackageRegistry \ No newline at end of file diff --git a/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry similarity index 91% rename from client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename to client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry index 26f9a08be88..8079cd09966 100644 --- a/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ b/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -15,4 +15,4 @@ # # -com.alibaba.nacos.client.remote.ClientPayloadPackageProvider \ No newline at end of file +com.alibaba.nacos.client.remote.ClientPayloadPackageRegistry \ No newline at end of file diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageProvider.java b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java similarity index 84% rename from common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageProvider.java rename to common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java index a9a19ab5d39..3176311fe76 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageProvider.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java @@ -16,6 +16,8 @@ package com.alibaba.nacos.common.remote; +import com.alibaba.nacos.api.remote.Payload; + import java.util.Set; /** @@ -23,12 +25,13 @@ * * @author hujun */ -public interface PayloadPackageProvider { +public interface PayloadPackageRegistry { /** * get scan package. + * * @return scan package list */ - Set getScanPackage(); + Set> getPackagePayloads(); } diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java index 722a02ad406..23d88030020 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java @@ -17,7 +17,7 @@ package com.alibaba.nacos.common.remote; import com.alibaba.nacos.api.remote.Payload; -import com.alibaba.nacos.common.packagescan.DefaultPackageScan; + import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.HashSet; @@ -48,17 +48,13 @@ private static synchronized void scan() { return; } - ServiceLoader payloadPackages = ServiceLoader.load(PayloadPackageProvider.class); - Set result = new HashSet<>(); - for (PayloadPackageProvider payloadPackage : payloadPackages) { - result.addAll(payloadPackage.getScanPackage()); + ServiceLoader payloadPackages = ServiceLoader.load(PayloadPackageRegistry.class); + Set> result = new HashSet<>(); + for (PayloadPackageRegistry payloadPackage : payloadPackages) { + result.addAll(payloadPackage.getPackagePayloads()); } - for (String pkg : result) { - DefaultPackageScan packageScan = new DefaultPackageScan(); - Set> subTypesResponse = packageScan.getSubTypesOf(pkg, Payload.class); - for (Class clazz : subTypesResponse) { - register(clazz.getSimpleName(), clazz); - } + for (Class clazz : result) { + register(clazz.getSimpleName(), clazz); } initialized = true; } diff --git a/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageProvider.java b/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageProvider.java deleted file mode 100644 index bf32b100600..00000000000 --- a/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.common.remote; - -import java.util.HashSet; -import java.util.Set; - -public class MockPayloadPackageProvider implements PayloadPackageProvider { - - private final Set scanPackage = new HashSet<>(); - - { - scanPackage.add("com.alibaba.nacos.api.naming.remote.request"); - scanPackage.add("com.alibaba.nacos.api.remote.request"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.request"); - scanPackage.add("com.alibaba.nacos.api.naming.remote.response"); - scanPackage.add("com.alibaba.nacos.api.config.remote.response"); - scanPackage.add("com.alibaba.nacos.api.remote.response"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.response"); - } - - @Override - public Set getScanPackage() { - return scanPackage; - } -} diff --git a/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java b/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java new file mode 100644 index 00000000000..0f1159ccad4 --- /dev/null +++ b/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java @@ -0,0 +1,42 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.common.remote; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +public class MockPayloadPackageRegistry implements PayloadPackageRegistry { + @Override + public Set> getPackagePayloads() { + HashSet> payloads = new HashSet<>(); + + //com.alibaba.nacos.api.remote.request + payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.remote.response + payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.request.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); + + return payloads; + } + +} diff --git a/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry similarity index 91% rename from common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename to common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry index f8b9cce83e4..06e53d8fcd2 100644 --- a/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ b/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -15,4 +15,4 @@ # # -com.alibaba.nacos.common.remote.MockPayloadPackageProvider \ No newline at end of file +com.alibaba.nacos.common.remote.MockPayloadPackageRegistry \ No newline at end of file diff --git a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageProvider.java b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageProvider.java deleted file mode 100644 index bb098f090dc..00000000000 --- a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.config.server.remote; - -import com.alibaba.nacos.common.remote.PayloadPackageProvider; - -import java.util.HashSet; -import java.util.Set; - -/** - * config package provider. - * - * @author hujun - */ -public class ConfigPayloadPackageProvider implements PayloadPackageProvider { - - private final Set scanPackage = new HashSet<>(); - - { - scanPackage.add("com.alibaba.nacos.api.remote.request"); - scanPackage.add("com.alibaba.nacos.api.remote.response"); - scanPackage.add("com.alibaba.nacos.api.config.remote.request"); - scanPackage.add("com.alibaba.nacos.api.config.remote.response"); - } - - @Override - public Set getScanPackage() { - return scanPackage; - } -} diff --git a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java new file mode 100644 index 00000000000..374b99e7d0f --- /dev/null +++ b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java @@ -0,0 +1,54 @@ +/* + * Copyright 1999-2021 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.config.server.remote; + +import com.alibaba.nacos.api.remote.Payload; +import com.alibaba.nacos.common.remote.PayloadPackageRegistry; + +import java.util.HashSet; +import java.util.Set; + +/** + * config package provider. + * + * @author hujun + * @author shiyiyue + */ +public class ConfigPayloadPackageRegistry implements PayloadPackageRegistry { + + @Override + public Set> getPackagePayloads() { + HashSet> payloads = new HashSet<>(); + + //com.alibaba.nacos.api.remote.request + payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.remote.response + payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.config.remote.request + payloads.addAll(com.alibaba.nacos.api.config.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response + payloads.addAll(com.alibaba.nacos.api.config.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.config.remote.request.cluster + payloads.addAll(com.alibaba.nacos.api.config.remote.request.cluster.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response.cluster + payloads.addAll(com.alibaba.nacos.api.config.remote.response.cluster.ResponseRegistry.getPayloads()); + + return payloads; + } +} diff --git a/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry new file mode 100644 index 00000000000..84b94e13881 --- /dev/null +++ b/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -0,0 +1,17 @@ +# +# Copyright 1999-2020 Alibaba Group Holding Ltd. +# +# Licensed 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. +# + +com.alibaba.nacos.config.server.remote.ConfigPayloadPackageRegistry \ No newline at end of file diff --git a/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider deleted file mode 100644 index 7295acaee6d..00000000000 --- a/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.config.server.remote.ConfigPayloadPackageProvider \ No newline at end of file diff --git a/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry similarity index 90% rename from config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename to config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry index 7295acaee6d..44a0459ba07 100644 --- a/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ b/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -15,4 +15,4 @@ # # -com.alibaba.nacos.config.server.remote.ConfigPayloadPackageProvider \ No newline at end of file +com.alibaba.nacos.config.server.remote.ConfigPayloadPackageRegistry \ No newline at end of file diff --git a/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageProvider.java b/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageProvider.java deleted file mode 100644 index f2d1cbd9de7..00000000000 --- a/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.core.remote; - -import com.alibaba.nacos.common.remote.PayloadPackageProvider; - -import java.util.HashSet; -import java.util.Set; - -/** - * test package provider. - * - * @author hujun - */ -public class MockPayloadPackageProvider implements PayloadPackageProvider { - - private final Set scanPackage = new HashSet<>(); - - { - scanPackage.add("com.alibaba.nacos.api.naming.remote.request"); - scanPackage.add("com.alibaba.nacos.api.remote.request"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.request"); - scanPackage.add("com.alibaba.nacos.api.config.remote.request"); - scanPackage.add("com.alibaba.nacos.api.naming.remote.response"); - scanPackage.add("com.alibaba.nacos.api.config.remote.response"); - scanPackage.add("com.alibaba.nacos.api.remote.response"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.response"); - } - - @Override - public Set getScanPackage() { - return scanPackage; - } -} diff --git a/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java b/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java new file mode 100644 index 00000000000..6daf9b5b033 --- /dev/null +++ b/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java @@ -0,0 +1,48 @@ +/* + * Copyright 1999-2021 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.core.remote; + +import com.alibaba.nacos.api.remote.Payload; +import com.alibaba.nacos.common.remote.PayloadPackageRegistry; + +import java.util.HashSet; +import java.util.Set; + +/** + * test package provider. + * + * @author hujun + */ +public class MockPayloadPackageRegistry implements PayloadPackageRegistry { + + @Override + public Set> getPackagePayloads() { + HashSet> payloads = new HashSet<>(); + + //com.alibaba.nacos.api.remote.request + payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.remote.response + payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.request.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); + + return payloads; + } +} diff --git a/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry similarity index 91% rename from core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename to core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry index 12bc123e718..98101090cb4 100644 --- a/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ b/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -15,4 +15,4 @@ # # -com.alibaba.nacos.core.remote.MockPayloadPackageProvider \ No newline at end of file +com.alibaba.nacos.core.remote.MockPayloadPackageRegistry \ No newline at end of file diff --git a/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/request/RequestRegistry.java b/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/request/RequestRegistry.java new file mode 100644 index 00000000000..5a6800b033c --- /dev/null +++ b/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/request/RequestRegistry.java @@ -0,0 +1,43 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.naming.cluster.remote.request; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * payload registry. + * + * @author shiyiyue + */ +public class RequestRegistry { + + private static Set> payloads = registryPayload(); + + private static Set> registryPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(AbstractClusterRequest.class); + payloads.add(DistroDataRequest.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/response/ResponseRegistry.java b/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/response/ResponseRegistry.java new file mode 100644 index 00000000000..8a653f9479d --- /dev/null +++ b/naming/src/main/java/com/alibaba/nacos/naming/cluster/remote/response/ResponseRegistry.java @@ -0,0 +1,42 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.naming.cluster.remote.response; + +import com.alibaba.nacos.api.remote.Payload; + +import java.util.HashSet; +import java.util.Set; + +/** + * pay load registry. + * + * @author shiyiyue + */ +public class ResponseRegistry { + + private static Set> payloads = getPayload(); + + private static Set> getPayload() { + HashSet> payloads = new HashSet<>(); + payloads.add(DistroDataResponse.class); + return payloads; + } + + public static final Set> getPayloads() { + return payloads; + } +} diff --git a/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageProvider.java b/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageProvider.java deleted file mode 100644 index fccc0a520fb..00000000000 --- a/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.naming.remote.rpc; - -import com.alibaba.nacos.common.remote.PayloadPackageProvider; - -import java.util.HashSet; -import java.util.Set; - -/** - * naming package provider. - * - * @author hujun - */ -public class NamingPayloadPackageProvider implements PayloadPackageProvider { - - private final Set scanPackage = new HashSet<>(); - - { - scanPackage.add("com.alibaba.nacos.api.remote.request"); - scanPackage.add("com.alibaba.nacos.api.remote.response"); - scanPackage.add("com.alibaba.nacos.api.naming.remote.request"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.request"); - scanPackage.add("com.alibaba.nacos.api.naming.remote.response"); - scanPackage.add("com.alibaba.nacos.naming.cluster.remote.response"); - } - - @Override - public Set getScanPackage() { - return scanPackage; - } -} diff --git a/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java b/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java new file mode 100644 index 00000000000..fef8a4ac646 --- /dev/null +++ b/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java @@ -0,0 +1,53 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * Licensed 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 com.alibaba.nacos.naming.remote.rpc; + +import com.alibaba.nacos.api.remote.Payload; +import com.alibaba.nacos.common.remote.PayloadPackageRegistry; + +import java.util.HashSet; +import java.util.Set; + +/** + * naming module package payload registry. + * + * @author shiyiyue + */ +public class NamingPayloadPackageRegistry implements PayloadPackageRegistry { + + @Override + public Set> getPackagePayloads() { + HashSet> payloads = new HashSet<>(); + + //com.alibaba.nacos.api.remote.request + payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.remote.response + payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.request.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response.cluster + payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); + + //com.alibaba.nacos.api.naming.remote.request.cluster + payloads.addAll(com.alibaba.nacos.naming.cluster.remote.request.RequestRegistry.getPayloads()); + //com.alibaba.nacos.api.config.remote.response.cluster + payloads.addAll(com.alibaba.nacos.naming.cluster.remote.response.ResponseRegistry.getPayloads()); + + return payloads; + } +} diff --git a/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider deleted file mode 100644 index 6ab52b4eccf..00000000000 --- a/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageProvider \ No newline at end of file diff --git a/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry new file mode 100644 index 00000000000..8e35ae8d332 --- /dev/null +++ b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -0,0 +1,17 @@ +# +# Copyright 1999-2020 Alibaba Group Holding Ltd. +# +# Licensed 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. +# + +com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageRegistry \ No newline at end of file diff --git a/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider deleted file mode 100644 index 6ab52b4eccf..00000000000 --- a/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageProvider \ No newline at end of file diff --git a/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider b/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry similarity index 90% rename from client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider rename to naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry index 26f9a08be88..cc264cd1ff8 100644 --- a/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageProvider +++ b/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry @@ -15,4 +15,4 @@ # # -com.alibaba.nacos.client.remote.ClientPayloadPackageProvider \ No newline at end of file +com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageRegistry \ No newline at end of file From 5a849a568ef5bf97a9ab8c1ab50cea59a97aaaae Mon Sep 17 00:00:00 2001 From: shiyiue1102 Date: Wed, 21 Dec 2022 17:47:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E7=9B=B4=E6=8E=A5SPI=E6=B3=A8?= =?UTF-8?q?=E5=86=8Cpayload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../remote/request/RequestRegistry.java | 49 ---------------- .../request/cluster/RequestRegistry.java | 43 -------------- .../remote/response/ResponseRegistry.java | 47 --------------- .../response/cluster/ResponseRegistry.java | 42 -------------- .../remote/request/RequestRegistry.java | 49 ---------------- .../remote/response/ResponseRegistry.java | 47 --------------- .../api/remote/request/RequestRegistry.java | 52 ----------------- .../api/remote/response/ResponseRegistry.java | 49 ---------------- .../com.alibaba.nacos.api.remote.Payload | 57 +++++++++++++++++++ client/pom.xml | 6 ++ .../remote/ClientPayloadPackageRegistry.java | 55 ------------------ ...nacos.common.remote.PayloadPackageRegistry | 18 ------ .../common/remote/PayloadPackageRegistry.java | 37 ------------ .../nacos/common/remote/PayloadRegistry.java | 15 ++--- .../remote/MockPayloadPackageRegistry.java | 42 -------------- ...nacos.common.remote.PayloadPackageRegistry | 18 ------ .../remote/ConfigPayloadPackageRegistry.java | 54 ------------------ ...nacos.common.remote.PayloadPackageRegistry | 17 ------ ...nacos.common.remote.PayloadPackageRegistry | 18 ------ .../remote/MockPayloadPackageRegistry.java | 48 ---------------- ...nacos.common.remote.PayloadPackageRegistry | 18 ------ .../naming/controllers/ServiceController.java | 2 +- .../rpc/NamingPayloadPackageRegistry.java | 53 ----------------- .../com.alibaba.nacos.api.remote.Payload | 3 +- ...nacos.common.remote.PayloadPackageRegistry | 17 ------ ...nacos.common.remote.PayloadPackageRegistry | 18 ------ 26 files changed, 70 insertions(+), 804 deletions(-) delete mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java delete mode 100644 api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java create mode 100644 api/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload delete mode 100644 client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java delete mode 100644 client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java delete mode 100644 common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java delete mode 100644 common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java delete mode 100644 config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java delete mode 100644 core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java rename client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry => naming/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload (81%) delete mode 100644 naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry delete mode 100644 naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java deleted file mode 100644 index 830444a67e0..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/RequestRegistry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.config.remote.request; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class RequestRegistry { - - private static Set> payloads = registryPayload(); - - private static Set> registryPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(AbstractConfigRequest.class); - payloads.add(ClientConfigMetricRequest.class); - payloads.add(ConfigBatchListenRequest.class); - payloads.add(ConfigChangeNotifyRequest.class); - payloads.add(ConfigPublishRequest.class); - payloads.add(ConfigQueryRequest.class); - payloads.add(ConfigRemoveRequest.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } - -} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java deleted file mode 100644 index c8fe7f3cd0a..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/request/cluster/RequestRegistry.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.config.remote.request.cluster; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class RequestRegistry { - - private static Set> payloads = registryPayload(); - - private static Set> registryPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(ConfigChangeClusterSyncRequest.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } - -} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java deleted file mode 100644 index f507b20f505..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/ResponseRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.config.remote.response; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class ResponseRegistry { - - private static Set> payloads = getPayload(); - - private static Set> getPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(ClientConfigMetricResponse.class); - payloads.add(ConfigChangeBatchListenResponse.class); - payloads.add(ConfigChangeNotifyResponse.class); - payloads.add(ConfigPublishResponse.class); - payloads.add(ConfigQueryResponse.class); - payloads.add(ConfigRemoveResponse.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } -} diff --git a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java deleted file mode 100644 index 571bdc4db95..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/config/remote/response/cluster/ResponseRegistry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.config.remote.response.cluster; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class ResponseRegistry { - - private static Set> payloads = getPayload(); - - private static Set> getPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(ConfigChangeClusterSyncResponse.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } -} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java deleted file mode 100644 index 768523e8478..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/naming/remote/request/RequestRegistry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.naming.remote.request; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class RequestRegistry { - - private static Set> payloads = registryPayload(); - - private static Set> registryPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(AbstractNamingRequest.class); - payloads.add(BatchInstanceRequest.class); - payloads.add(InstanceRequest.class); - payloads.add(NotifySubscriberRequest.class); - payloads.add(ServiceListRequest.class); - payloads.add(ServiceQueryRequest.class); - payloads.add(SubscribeServiceRequest.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } - -} diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java deleted file mode 100644 index e924f26ca78..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/naming/remote/response/ResponseRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.naming.remote.response; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class ResponseRegistry { - - private static Set> payloads = getPayload(); - - private static final Set> getPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(BatchInstanceResponse.class); - payloads.add(InstanceResponse.class); - payloads.add(NotifySubscriberResponse.class); - payloads.add(QueryServiceResponse.class); - payloads.add(ServiceListResponse.class); - payloads.add(SubscribeServiceResponse.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } -} diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java b/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java deleted file mode 100644 index 1144531affe..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/remote/request/RequestRegistry.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.remote.request; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * request payload registry. - * @author shiyiyue - */ -public class RequestRegistry { - - private static Set> payloads = registryPayload(); - - private static Set> registryPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(InternalRequest.class); - payloads.add(Request.class); - payloads.add(ServerRequest.class); - payloads.add(ClientDetectionRequest.class); - payloads.add(ConnectionSetupRequest.class); - payloads.add(ConnectResetRequest.class); - payloads.add(HealthCheckRequest.class); - payloads.add(PushAckRequest.class); - payloads.add(ServerCheckRequest.class); - payloads.add(ServerLoaderInfoRequest.class); - payloads.add(ServerReloadRequest.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } - -} diff --git a/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java b/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java deleted file mode 100644 index dee528af9e3..00000000000 --- a/api/src/main/java/com/alibaba/nacos/api/remote/response/ResponseRegistry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.api.remote.response; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -/** - * payload registry. - * - * @author shiyiyue - */ -public class ResponseRegistry { - - private static Set> payloads = getPayload(); - - private static Set> getPayload() { - HashSet> payloads = new HashSet<>(); - payloads.add(Response.class); - payloads.add(ClientDetectionResponse.class); - payloads.add(ConnectResetResponse.class); - payloads.add(ErrorResponse.class); - payloads.add(HealthCheckResponse.class); - payloads.add(ServerCheckResponse.class); - payloads.add(ServerLoaderInfoResponse.class); - payloads.add(ServerReloadResponse.class); - return payloads; - } - - public static final Set> getPayloads() { - return payloads; - } -} diff --git a/api/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload b/api/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload new file mode 100644 index 00000000000..d838e65ea2c --- /dev/null +++ b/api/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload @@ -0,0 +1,57 @@ +# +# Copyright 1999-2021 Alibaba Group Holding Ltd. +# +# Licensed 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. +# +# +com.alibaba.nacos.api.remote.request.ClientDetectionRequest +com.alibaba.nacos.api.remote.request.ConnectionSetupRequest +com.alibaba.nacos.api.remote.request.ConnectResetRequest +com.alibaba.nacos.api.remote.request.HealthCheckRequest +com.alibaba.nacos.api.remote.request.PushAckRequest +com.alibaba.nacos.api.remote.request.ServerCheckRequest +com.alibaba.nacos.api.remote.request.ServerLoaderInfoRequest +com.alibaba.nacos.api.remote.request.ServerReloadRequest +com.alibaba.nacos.api.remote.response.ClientDetectionResponse +com.alibaba.nacos.api.remote.response.ConnectResetResponse +com.alibaba.nacos.api.remote.response.ErrorResponse +com.alibaba.nacos.api.remote.response.HealthCheckResponse +com.alibaba.nacos.api.remote.response.ServerCheckResponse +com.alibaba.nacos.api.remote.response.ServerLoaderInfoResponse +com.alibaba.nacos.api.remote.response.ServerReloadResponse +com.alibaba.nacos.api.config.remote.request.ClientConfigMetricRequest +com.alibaba.nacos.api.config.remote.request.ConfigBatchListenRequest +com.alibaba.nacos.api.config.remote.request.ConfigChangeNotifyRequest +com.alibaba.nacos.api.config.remote.request.ConfigPublishRequest +com.alibaba.nacos.api.config.remote.request.ConfigQueryRequest +com.alibaba.nacos.api.config.remote.request.ConfigRemoveRequest +com.alibaba.nacos.api.config.remote.response.ClientConfigMetricResponse +com.alibaba.nacos.api.config.remote.response.ConfigChangeBatchListenResponse +com.alibaba.nacos.api.config.remote.response.ConfigChangeNotifyResponse +com.alibaba.nacos.api.config.remote.response.ConfigPublishResponse +com.alibaba.nacos.api.config.remote.response.ConfigQueryResponse +com.alibaba.nacos.api.config.remote.response.ConfigRemoveResponse +com.alibaba.nacos.api.config.remote.request.cluster.ConfigChangeClusterSyncRequest +com.alibaba.nacos.api.config.remote.response.cluster.ConfigChangeClusterSyncResponse +com.alibaba.nacos.api.naming.remote.request.BatchInstanceRequest +com.alibaba.nacos.api.naming.remote.request.InstanceRequest +com.alibaba.nacos.api.naming.remote.request.NotifySubscriberRequest +com.alibaba.nacos.api.naming.remote.request.ServiceListRequest +com.alibaba.nacos.api.naming.remote.request.ServiceQueryRequest +com.alibaba.nacos.api.naming.remote.request.SubscribeServiceRequest +com.alibaba.nacos.api.naming.remote.response.BatchInstanceResponse +com.alibaba.nacos.api.naming.remote.response.InstanceResponse +com.alibaba.nacos.api.naming.remote.response.NotifySubscriberResponse +com.alibaba.nacos.api.naming.remote.response.QueryServiceResponse +com.alibaba.nacos.api.naming.remote.response.ServiceListResponse +com.alibaba.nacos.api.naming.remote.response.SubscribeServiceResponse \ No newline at end of file diff --git a/client/pom.xml b/client/pom.xml index 6ed18aea215..a5987163ae4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -183,6 +183,9 @@ com/alibaba/nacos/api/**/** + + META-INF/**/*.* + @@ -339,6 +342,9 @@ com/alibaba/nacos/api/**/** + + META-INF/**/*.* + diff --git a/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java b/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java deleted file mode 100644 index 2e4b17354dd..00000000000 --- a/client/src/main/java/com/alibaba/nacos/client/remote/ClientPayloadPackageRegistry.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.client.remote; - -import com.alibaba.nacos.api.remote.Payload; -import com.alibaba.nacos.common.remote.PayloadPackageRegistry; - -import java.util.HashSet; -import java.util.Set; - -/** - * client payload package registry. - * - * @author shiyiyue - */ -public class ClientPayloadPackageRegistry implements PayloadPackageRegistry { - - @Override - public Set> getPackagePayloads() { - HashSet> payloads = new HashSet<>(); - - //com.alibaba.nacos.api.remote.request - payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.remote.response - payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.config.remote.request - payloads.addAll(com.alibaba.nacos.api.config.remote.request.RequestRegistry.getPayloads()); - - //com.alibaba.nacos.api.config.remote.response - payloads.addAll(com.alibaba.nacos.api.config.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.request - payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.response - payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); - - return payloads; - } -} diff --git a/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 8079cd09966..00000000000 --- a/client/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.client.remote.ClientPayloadPackageRegistry \ No newline at end of file diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java deleted file mode 100644 index 3176311fe76..00000000000 --- a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadPackageRegistry.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.common.remote; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.Set; - -/** - * package provider. - * - * @author hujun - */ -public interface PayloadPackageRegistry { - - /** - * get scan package. - * - * @return scan package list - */ - Set> getPackagePayloads(); - -} diff --git a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java index 23d88030020..fb9a5d4fc8c 100644 --- a/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java +++ b/common/src/main/java/com/alibaba/nacos/common/remote/PayloadRegistry.java @@ -20,13 +20,11 @@ import java.lang.reflect.Modifier; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.ServiceLoader; -import java.util.Set; /** - * payload regitry,Define basic scan behavior request and response. + * payload registry,Define basic scan behavior request and response. * * @author liuzunfei * @author hujun @@ -47,14 +45,9 @@ private static synchronized void scan() { if (initialized) { return; } - - ServiceLoader payloadPackages = ServiceLoader.load(PayloadPackageRegistry.class); - Set> result = new HashSet<>(); - for (PayloadPackageRegistry payloadPackage : payloadPackages) { - result.addAll(payloadPackage.getPackagePayloads()); - } - for (Class clazz : result) { - register(clazz.getSimpleName(), clazz); + ServiceLoader payloads = ServiceLoader.load(Payload.class); + for (Payload payload : payloads) { + register(payload.getClass().getSimpleName(), payload.getClass()); } initialized = true; } diff --git a/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java b/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java deleted file mode 100644 index 0f1159ccad4..00000000000 --- a/common/src/test/java/com/alibaba/nacos/common/remote/MockPayloadPackageRegistry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 1999-2018 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.common.remote; - -import com.alibaba.nacos.api.remote.Payload; - -import java.util.HashSet; -import java.util.Set; - -public class MockPayloadPackageRegistry implements PayloadPackageRegistry { - @Override - public Set> getPackagePayloads() { - HashSet> payloads = new HashSet<>(); - - //com.alibaba.nacos.api.remote.request - payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.remote.response - payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.request.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); - - return payloads; - } - -} diff --git a/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 06e53d8fcd2..00000000000 --- a/common/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.common.remote.MockPayloadPackageRegistry \ No newline at end of file diff --git a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java b/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java deleted file mode 100644 index 374b99e7d0f..00000000000 --- a/config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigPayloadPackageRegistry.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.config.server.remote; - -import com.alibaba.nacos.api.remote.Payload; -import com.alibaba.nacos.common.remote.PayloadPackageRegistry; - -import java.util.HashSet; -import java.util.Set; - -/** - * config package provider. - * - * @author hujun - * @author shiyiyue - */ -public class ConfigPayloadPackageRegistry implements PayloadPackageRegistry { - - @Override - public Set> getPackagePayloads() { - HashSet> payloads = new HashSet<>(); - - //com.alibaba.nacos.api.remote.request - payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.remote.response - payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.config.remote.request - payloads.addAll(com.alibaba.nacos.api.config.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response - payloads.addAll(com.alibaba.nacos.api.config.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.config.remote.request.cluster - payloads.addAll(com.alibaba.nacos.api.config.remote.request.cluster.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response.cluster - payloads.addAll(com.alibaba.nacos.api.config.remote.response.cluster.ResponseRegistry.getPayloads()); - - return payloads; - } -} diff --git a/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 84b94e13881..00000000000 --- a/config/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright 1999-2020 Alibaba Group Holding Ltd. -# -# Licensed 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. -# - -com.alibaba.nacos.config.server.remote.ConfigPayloadPackageRegistry \ No newline at end of file diff --git a/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 44a0459ba07..00000000000 --- a/config/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.config.server.remote.ConfigPayloadPackageRegistry \ No newline at end of file diff --git a/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java b/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java deleted file mode 100644 index 6daf9b5b033..00000000000 --- a/core/src/test/java/com/alibaba/nacos/core/remote/MockPayloadPackageRegistry.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 1999-2021 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.core.remote; - -import com.alibaba.nacos.api.remote.Payload; -import com.alibaba.nacos.common.remote.PayloadPackageRegistry; - -import java.util.HashSet; -import java.util.Set; - -/** - * test package provider. - * - * @author hujun - */ -public class MockPayloadPackageRegistry implements PayloadPackageRegistry { - - @Override - public Set> getPackagePayloads() { - HashSet> payloads = new HashSet<>(); - - //com.alibaba.nacos.api.remote.request - payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.remote.response - payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.request.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); - - return payloads; - } -} diff --git a/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 98101090cb4..00000000000 --- a/core/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.core.remote.MockPayloadPackageRegistry \ No newline at end of file diff --git a/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java b/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java index 0830ae0cbbc..d6077706685 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java @@ -216,7 +216,7 @@ public ObjectNode searchService(@RequestParam(defaultValue = StringUtils.EMPTY) } } ObjectNode result = JacksonUtils.createEmptyJsonNode(); - result.replace("services", JacksonUtils.transferToJsonNode(serviceNameMap)); + result.replace("META-INF/services", JacksonUtils.transferToJsonNode(serviceNameMap)); result.put("count", totalCount); return result; } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java b/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java deleted file mode 100644 index fef8a4ac646..00000000000 --- a/naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/NamingPayloadPackageRegistry.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 1999-2020 Alibaba Group Holding Ltd. - * - * Licensed 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 com.alibaba.nacos.naming.remote.rpc; - -import com.alibaba.nacos.api.remote.Payload; -import com.alibaba.nacos.common.remote.PayloadPackageRegistry; - -import java.util.HashSet; -import java.util.Set; - -/** - * naming module package payload registry. - * - * @author shiyiyue - */ -public class NamingPayloadPackageRegistry implements PayloadPackageRegistry { - - @Override - public Set> getPackagePayloads() { - HashSet> payloads = new HashSet<>(); - - //com.alibaba.nacos.api.remote.request - payloads.addAll(com.alibaba.nacos.api.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.remote.response - payloads.addAll(com.alibaba.nacos.api.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.request.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response.cluster - payloads.addAll(com.alibaba.nacos.api.naming.remote.response.ResponseRegistry.getPayloads()); - - //com.alibaba.nacos.api.naming.remote.request.cluster - payloads.addAll(com.alibaba.nacos.naming.cluster.remote.request.RequestRegistry.getPayloads()); - //com.alibaba.nacos.api.config.remote.response.cluster - payloads.addAll(com.alibaba.nacos.naming.cluster.remote.response.ResponseRegistry.getPayloads()); - - return payloads; - } -} diff --git a/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload similarity index 81% rename from client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry rename to naming/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload index 69d5df1a385..779bdb19d04 100644 --- a/client/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.api.remote.Payload @@ -14,4 +14,5 @@ # limitations under the License. # -com.alibaba.nacos.client.remote.ClientPayloadPackageRegistry \ No newline at end of file +com.alibaba.nacos.naming.cluster.remote.request.DistroDataRequest +com.alibaba.nacos.naming.cluster.remote.response.DistroDataResponse \ No newline at end of file diff --git a/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index 8e35ae8d332..00000000000 --- a/naming/src/main/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright 1999-2020 Alibaba Group Holding Ltd. -# -# Licensed 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. -# - -com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageRegistry \ No newline at end of file diff --git a/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry b/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry deleted file mode 100644 index cc264cd1ff8..00000000000 --- a/naming/src/test/resources/META-INF/services/com.alibaba.nacos.common.remote.PayloadPackageRegistry +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 1999-2021 Alibaba Group Holding Ltd. -# -# Licensed 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. -# -# - -com.alibaba.nacos.naming.remote.rpc.NamingPayloadPackageRegistry \ No newline at end of file